Milimetric has submitted this change and it was merged.

Change subject: Cleanup whitespaces
......................................................................


Cleanup whitespaces

Change-Id: I6edcf321581854cdde95bbdb36a379ef8518bff5
---
M geowiki/geo_coding.py
M geowiki/mysql_config.py
2 files changed, 24 insertions(+), 24 deletions(-)

Approvals:
  Milimetric: Verified; Looks good to me, approved



diff --git a/geowiki/geo_coding.py b/geowiki/geo_coding.py
index c58ed46..f01a646 100644
--- a/geowiki/geo_coding.py
+++ b/geowiki/geo_coding.py
@@ -1,9 +1,9 @@
 '''
 
-ETL for geo coding entries from the recentchanges table. 
+ETL for geo coding entries from the recentchanges table.
 
 1. Country, total editors, total active editors (5+), total very active 
editors (100+)
-2. Country, top 10 cities, percentage of total edits from each city  
+2. Country, top 10 cities, percentage of total edits from each city
 
 
 '''
@@ -57,7 +57,7 @@
             res = line[:-1].split(sep)
         else:
             res = line
-        
+
         user = res[0]
 
         # filter!
@@ -80,9 +80,9 @@
             country = 'Invalid IP'
 
         if record:
-            city = record['city'] 
-            country = record['country_name'] 
-            
+            city = record['city']
+            country = record['country_name']
+
             if city=='' or city==' ':
                 city = "Unknown"
 
@@ -105,7 +105,7 @@
         else:
             cities[country][city] = 1
 
-        
+
         # country -> editors data
 
         if user not in editors:
@@ -128,7 +128,7 @@
     ### Editor activity
 
     editor_counts = defaultdict(lambda : defaultdict(int))
-    
+
     bins = map(str,range(1,11))
     bins = bins + ['%d-%d' % (thresh, thresh + 10) for thresh in 
range(0,100,10)]
     bins = bins + ['all', '5+', '100+']
@@ -144,17 +144,17 @@
                 country_nest[country]["all"] +=1
                 world_nest["all"] += 1
                 if count >= 5:
-                    country_nest[country]["5+"] +=1                 
+                    country_nest[country]["5+"] +=1
                     world_nest["5+"] += 1
                     if count >= 100:
-                        country_nest[country]["100+"] +=1 
+                        country_nest[country]["100+"] +=1
                         world_nest["100+"] += 1
             if count <= 10:
                 country_nest[country]['%d' % count] += 1
             if count < 100:
                 bottom = 10 * (int(count) / 10)
                 country_nest[country]['%s-%s' % (bottom, bottom + 10)] += 1
-                
+
 
     #flatten
     country_rows = []
@@ -191,8 +191,8 @@
     start_str = opts['start'].isoformat()
     end_str = opts['end'].isoformat()
     for country,cities in countries.iteritems():
-        
-        city_info_sorted = 
sorted(cities.iteritems(),key=operator.itemgetter(1),reverse=True)   
+
+        city_info_sorted = 
sorted(cities.iteritems(),key=operator.itemgetter(1),reverse=True)
         totaledits = sum([c[1] for c in city_info_sorted])
         row = {'project' : wp_pr,
                'country' : country,
diff --git a/geowiki/mysql_config.py b/geowiki/mysql_config.py
index d71a16d..f018bce 100644
--- a/geowiki/mysql_config.py
+++ b/geowiki/mysql_config.py
@@ -50,11 +50,11 @@
         * `20120525`, the last 30 days from the day passed.
         * None, last 30 days from now()
 
-    Note:   
+    Note:
         The checkuser `cu_changes` table contains data for the last three 
month only!
 
-    :arg ts: str, timestamp '201205'. If None, last 30 days will be used. 
-    ''' 
+    :arg ts: str, timestamp '201205'. If None, last 30 days will be used.
+    '''
     def wiki_timestamp(dt):
         return datetime.strftime(dt,'%Y%m%d%H%M%S')
 
@@ -70,8 +70,8 @@
     #       d = int(ts[6:8])
     #       thirty = timedelta(days=30)
     #       end = datetime(y, m, d, 23, 59, 59)
-    #       start = end-thirty      
-    # else:     
+    #       start = end-thirty
+    # else:
     #   thirty = timedelta(days=30)
     #   end = datetime.now()
     #   start = end-thirty
@@ -86,13 +86,13 @@
 
 # new CNAME system.
 # TODO: abstract mapping to a use just number and then autogenerate CNAMES 
aliases
-db_mapping = {'s1':'s1-analytics-slave.eqiad.wmnet', 
-          's2':'s2-analytics-slave.eqiad.wmnet', 
+db_mapping = {'s1':'s1-analytics-slave.eqiad.wmnet',
+          's2':'s2-analytics-slave.eqiad.wmnet',
           's3':'s3-analytics-slave.eqiad.wmnet',
           's4':'s4-analytics-slave.eqiad.wmnet',
-          's5':'s5-analytics-slave.eqiad.wmnet', 
+          's5':'s5-analytics-slave.eqiad.wmnet',
           's6':'s6-analytics-slave.eqiad.wmnet',
-          's7':'s7-analytics-slave.eqiad.wmnet', 
+          's7':'s7-analytics-slave.eqiad.wmnet',
           }
 
 def get_db_name(wp_pr):
@@ -124,7 +124,7 @@
     '''
     db = get_analytics_db_connection(wp_pr, opts)
     cur = db.cursor(MySQLdb.cursors.SSCursor) if server_side else 
db.cursor(MySQLdb.cursors.Cursor)
-    
+
     return cur
 
 
@@ -222,7 +222,7 @@
     dict_fmt = ', '.join(map(lambda f : '%%(%s)s' % f, fields))
     query_fmt = """REPLACE INTO %s (%s) VALUES (%s);""" % (table, 
','.join(fields), dict_fmt)
     cursor.executemany(query_fmt, city_edit_fractions)
-    cursor.connection.commit()  
+    cursor.connection.commit()
 
 
 def write_country_total_edits_mysql(country_totals, opts, cursor):

-- 
To view, visit https://gerrit.wikimedia.org/r/85627
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I6edcf321581854cdde95bbdb36a379ef8518bff5
Gerrit-PatchSet: 1
Gerrit-Project: analytics/geowiki
Gerrit-Branch: master
Gerrit-Owner: QChris <[email protected]>
Gerrit-Reviewer: Milimetric <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to