Legoktm has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/341383 )

Change subject: Fix nearly all flake8 issues
......................................................................

Fix nearly all flake8 issues

Change-Id: I92c4147c1abbacea3cdf7380cfd8e4fa883b3259
---
M generate.py
A tox.ini
2 files changed, 35 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/labs/tools/extreg-wos 
refs/changes/83/341383/1

diff --git a/generate.py b/generate.py
index 2dcf74e..0b19363 100644
--- a/generate.py
+++ b/generate.py
@@ -40,6 +40,7 @@
 PATCH_TO_REVIEW = 'PHID-PROJ-onnxucoedheq3jevknyr'
 EASY = 'PHID-PROJ-2iftynis5nwxv3rpizpe'
 
+
 def get_all_things(thing):
     ext_dir = os.path.join(MW_DIR, thing)
     return sorted(
@@ -54,13 +55,17 @@
     if found:
         return set(json.loads(found.decode()))
     data = set()
-    r = 
requests.get('https://www.mediawiki.org/w/api.php?action=query&list=categorymembers&cmtitle=Category:Archived%20extensions&cmlimit=max&format=json')
+    r = requests.get(
+        'https://www.mediawiki.org/w/api.php?action=query' +
+        
'&list=categorymembers&cmtitle=Category:Archived%20extensions&cmlimit=max&format=json'
+    )
     resp = r.json()
     for info in resp['query']['categorymembers']:
         if info['ns'] == 102:
             data.add(info['title'].split(':', 1)[1])
-    cache.set('extreg-archived', json.dumps(list(data)), 60*60)
+    cache.set('extreg-archived', json.dumps(list(data)), 60 * 60)
     return data
+
 
 def get_bugs(task_id, wmf):
     cache_key = 'extreg-sos-task-{}'.format(task_id)
@@ -91,16 +96,16 @@
             'wmf_deployed': wmf,
         }
 
-    cache.set(cache_key, json.dumps(data), 60*60)
+    cache.set(cache_key, json.dumps(data), 60 * 60)
     return data
 
 
 def build_html(data):
     total = len(data)
     converted = sum(1 for info in data.values() if info['converted'])
-    print(converted/total)
-    percent = '{:.2f}'.format(converted/total*100) + '%'
-    superpowers = converted/total >= 0.5
+    print(converted / total)
+    percent = '{:.2f}'.format(converted / total * 100) + '%'
+    superpowers = converted / total >= 0.5
     s_text = 'superpowers' if superpowers else 'sadness'
     title = 'Extension registration wall of {s_text}'.format(s_text=s_text)
     excite = '!' if superpowers else ' :('
@@ -168,7 +173,9 @@
         <td><a 
href="https://phabricator.wikimedia.org/{bug}";>{bug}</a>{easy}{wmf}</td>
         {mv}
     </tr>
-""".format(name=name, converted=converted_text, classname=converted_class, 
bug=data[name].get('bug', ''), easy=easy_text, mv=mv, wmf=wmf_deployed)
+""".format(name=name, converted=converted_text,
+           classname=converted_class, bug=data[name].get('bug', ''),
+           easy=easy_text, mv=mv, wmf=wmf_deployed)
 
     text += """
 </table>
@@ -259,5 +266,6 @@
     build_html(data)
     print(bugs)
 
+
 if __name__ == '__main__':
     main()
diff --git a/tox.ini b/tox.ini
new file mode 100644
index 0000000..c184c6d
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,20 @@
+[tox]
+
+# Ensure 1.6+ is used to support 'skipsdist'
+minversion = 1.6
+
+# Do not run install command
+skipsdist = True
+
+# Environements to execute when invoking 'tox'
+envlist = flake8
+
+[testenv:flake8]
+commands = flake8
+deps = flake8
+basepython = python3
+
+[flake8]
+exclude = .tox
+max_line_length = 120
+ignore = F405

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I92c4147c1abbacea3cdf7380cfd8e4fa883b3259
Gerrit-PatchSet: 1
Gerrit-Project: labs/tools/extreg-wos
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>

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

Reply via email to