community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1705459 - in /comdev/reporter.apache.org/trunk: data/parsepmcs.py mailglomper.py parseversions.py prettify.py readjira.py site/addrelease.py site/chi.py site/getjson.py site/jiraversions.py
Date Sat, 26 Sep 2015 13:59:29 GMT
Author: sebb
Date: Sat Sep 26 13:59:29 2015
New Revision: 1705459

URL: http://svn.apache.org/viewvc?rev=1705459&view=rev
Log:
Write json data direct to file rather than creating a string first

Modified:
    comdev/reporter.apache.org/trunk/data/parsepmcs.py
    comdev/reporter.apache.org/trunk/mailglomper.py
    comdev/reporter.apache.org/trunk/parseversions.py
    comdev/reporter.apache.org/trunk/prettify.py
    comdev/reporter.apache.org/trunk/readjira.py
    comdev/reporter.apache.org/trunk/site/addrelease.py
    comdev/reporter.apache.org/trunk/site/chi.py
    comdev/reporter.apache.org/trunk/site/getjson.py
    comdev/reporter.apache.org/trunk/site/jiraversions.py

Modified: comdev/reporter.apache.org/trunk/data/parsepmcs.py
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/data/parsepmcs.py?rev=1705459&r1=1705458&r2=1705459&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/data/parsepmcs.py (original)
+++ comdev/reporter.apache.org/trunk/data/parsepmcs.py Sat Sep 26 13:59:29 2015
@@ -91,12 +91,12 @@ for project in pmcs:
     
 print("Writing pmcs.json")
 with open("pmcs.json", "w") as f:
-    f.write(json.dumps(pmcs, sort_keys=True, indent=1))
+    json.dump(pmcs, f, sort_keys=True, indent=1)
     f.close()
 
 print("Writing projects.json")
 with open("projects.json", "w") as f:
-    f.write(json.dumps(projects, sort_keys=True ,indent=1))
+    json.dump(projects, f, sort_keys=True ,indent=1)
     f.close()
     
     

Modified: comdev/reporter.apache.org/trunk/mailglomper.py
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/mailglomper.py?rev=1705459&r1=1705458&r2=1705459&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/mailglomper.py (original)
+++ comdev/reporter.apache.org/trunk/mailglomper.py Sat Sep 26 13:59:29 2015
@@ -101,8 +101,8 @@ for mlist in re.finditer(r"<a href='([-a
     if y == 50:
         y = 0
         with open("data/maildata_extended.json",'w+') as f:
-            f.write(json.dumps(mls, indent=1))
+            json.dump(mls, f, indent=1)
 tsprint("Completed scanning, writing JSON")
 with open("data/maildata_extended.json",'w+') as f:
-    f.write(json.dumps(mls, indent=1))
+    json.dump(mls, f, indent=1)
 print("Dumped JSON")

Modified: comdev/reporter.apache.org/trunk/parseversions.py
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/parseversions.py?rev=1705459&r1=1705458&r2=1705459&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/parseversions.py (original)
+++ comdev/reporter.apache.org/trunk/parseversions.py Sat Sep 26 13:59:29 2015
@@ -37,5 +37,5 @@ for project in projects:
            print(err)
        
        with open("/var/www/reporter.apache.org/data/releases/%s.json" % project, "w") as
f:
-              f.write(json.dumps(rdata, indent=1))
+              json.dump(rdata, f, indent=1)
               f.close()
\ No newline at end of file

Modified: comdev/reporter.apache.org/trunk/prettify.py
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/prettify.py?rev=1705459&r1=1705458&r2=1705459&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/prettify.py (original)
+++ comdev/reporter.apache.org/trunk/prettify.py Sat Sep 26 13:59:29 2015
@@ -15,5 +15,5 @@ for arg in sys.argv[1:]:
         out = arg + ".out"
         print("Writing " + out)
         with open(out, "w") as f:
-            f.write(json.dumps(input, indent=1, sort_keys=True))
+            json.dump(input, f, indent=1, sort_keys=True)
             f.close()

Modified: comdev/reporter.apache.org/trunk/readjira.py
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/readjira.py?rev=1705459&r1=1705458&r2=1705459&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/readjira.py (original)
+++ comdev/reporter.apache.org/trunk/readjira.py Sat Sep 26 13:59:29 2015
@@ -29,12 +29,12 @@ def getJIRAS(project):
             req.add_header("Authorization", "Basic %s" % base64string)
             rdata = json.loads(urllib2.urlopen(req).read())
             with open("%s/data/JIRA/%s.json" % (MYHOME, project), "w") as f:
-                f.write(json.dumps([cdata['total'], rdata['total'], project], indent=1))
+                json.dump([cdata['total'], rdata['total'], project], f, indent=1)
                 f.close()
             return cdata['total'], rdata['total'], project
         except Exception as err:
             with open("%s/data/JIRA/%s.json" % (MYHOME, project), "w") as f:
-                f.write(json.dumps([0,0,None], indent=1))
+                json.dump([0,0,None], f, indent=1)
                 f.close()
             return 0,0, None
 

Modified: comdev/reporter.apache.org/trunk/site/addrelease.py
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/site/addrelease.py?rev=1705459&r1=1705458&r2=1705459&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/site/addrelease.py (original)
+++ comdev/reporter.apache.org/trunk/site/addrelease.py Sat Sep 26 13:59:29 2015
@@ -50,7 +50,7 @@ if date != None and version and committe
             if version in rdata:
                 del rdata[version]
         with open("/var/www/reporter.apache.org/data/releases/%s.json" % committee, "w")
as f:
-            f.write(json.dumps(rdata, indent=1))
+            json.dump(rdata, f, indent=1)
             f.close()
             saved = True
             if dojson:

Modified: comdev/reporter.apache.org/trunk/site/chi.py
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/site/chi.py?rev=1705459&r1=1705458&r2=1705459&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/site/chi.py (original)
+++ comdev/reporter.apache.org/trunk/site/chi.py Sat Sep 26 13:59:29 2015
@@ -291,7 +291,7 @@ if m:
                 'cscore': s
             })
         with open("/var/www/reporter.apache.org/data/health.json", "w") as f:
-            f.write(json.dumps(notes, indent=1))
+            json.dump(notes, f, indent=1)
             f.close()
             
         print ("Content-Type: text/html\r\n\r\n<h1><img src='/img/chi.png' style='vertical-align:
middle;'/> Community Health Issues</h1><p>This is a quantitative guideline
only. There may be niche cases where the summaries below to not apply. <br/>Scores range
from -10.00 (worst possible score) to +10.00 (best possible score), harmonized by <img
src='/img/equation.png' style='vertical-align: middle;'/></p>")

Modified: comdev/reporter.apache.org/trunk/site/getjson.py
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/site/getjson.py?rev=1705459&r1=1705458&r2=1705459&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/site/getjson.py (original)
+++ comdev/reporter.apache.org/trunk/site/getjson.py Sat Sep 26 13:59:29 2015
@@ -79,7 +79,7 @@ def getJIRAProjects(project):
                 req.add_header("Authorization", "Basic %s" % base64string)
                 x = json.loads(urllib2.urlopen(req).read())
                 with open("/var/www/reporter.apache.org/data/JIRA/projects.json", "w") as
f:
-                    f.write(json.dumps(x, indent=1))
+                    json.dump(x, f, indent=1)
                     f.close()
             except:
                 pass
@@ -118,12 +118,12 @@ def getJIRAS(project):
             req.add_header("Authorization", "Basic %s" % base64string)
             rdata = json.loads(urllib2.urlopen(req).read())
             with open("/var/www/reporter.apache.org/data/JIRA/%s.json" % project, "w") as
f:
-                f.write(json.dumps([cdata['total'], rdata['total'], project], indent=1))
+                json.dump([cdata['total'], rdata['total'], project], f, indent=1)
                 f.close()
             return cdata['total'], rdata['total'], project
         except Exception as err:
             with open("/var/www/reporter.apache.org/data/JIRA/%s.json" % project, "w") as
f:
-                f.write(json.dumps([0,0,None], indent=1))
+                json.dump([0,0,None], f, indent=1)
                 f.close()
             return 0,0, None
 

Modified: comdev/reporter.apache.org/trunk/site/jiraversions.py
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/site/jiraversions.py?rev=1705459&r1=1705458&r2=1705459&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/site/jiraversions.py (original)
+++ comdev/reporter.apache.org/trunk/site/jiraversions.py Sat Sep 26 13:59:29 2015
@@ -63,7 +63,7 @@ if (isMember(user) or project in groups)
        except Exception as err:
            pass
        with open("/var/www/reporter.apache.org/data/releases/%s.json" % project, "w") as
f:
-              f.write(json.dumps(rdata, indent=1))
+              json.dump(rdata, f, indent=1)
               f.close()
               
        print("Content-Type: application/json\r\n\r\n")



Mime
View raw message