http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11243

Revision: 11243
Author:   xqt
Date:     2013-03-23 11:50:16 +0000 (Sat, 23 Mar 2013)
Log Message:
-----------
some PEP8 changes, update from trunk r11242

Modified Paths:
--------------
    branches/rewrite/pywikibot/family.py

Modified: branches/rewrite/pywikibot/family.py
===================================================================
--- branches/rewrite/pywikibot/family.py        2013-03-23 11:45:39 UTC (rev 
11242)
+++ branches/rewrite/pywikibot/family.py        2013-03-23 11:50:16 UTC (rev 
11243)
@@ -96,10 +96,10 @@
         ]
 
         # Order for fy: alphabetical by code, but y counts as i
-        def fycomp(x,y):
-            x = x.replace("y","i")+x.count("y")*"!"
-            y = y.replace("y","i")+y.count("y")*"!"
-            return cmp(x,y)
+        def fycomp(x, y):
+            x = x.replace("y", "i") + x.count("y") * "!"
+            y = y.replace("y", "i") + y.count("y") * "!"
+            return cmp(x, y)
         self.fyinterwiki = self.alphabetic[:]
         self.fyinterwiki.remove('nb')
         self.fyinterwiki.sort(fycomp)
@@ -114,29 +114,29 @@
         # [[MediaWiki:Linktrail]].
         # Note: this is a regular expression.
         self.linktrails = {
-           '_default': u'[a-z]*',
-           'ca': u'[a-zàèéíòóúç·ïü]*',
-           'cs': u'[a-záčďéěíňóřšťúůýž]*',
-           'de': u'[a-zäöüß]*',
-           'da': u'[a-zæøå]*',
-           'es': u'[a-záéíóúñ]*',
-           'fa': u'[a-zابپتثجچحخدذرزژسشصضطظعغفقکگلمنوهیآأئؤة‌]*',
-           'fi': u'[a-zäö]*',
-           'fr': u'[a-zàâçéèêîôûäëïöüùÇÉÂÊÎÔÛÄËÏÖÜÀÈÙ]*',
-           'frr': u'[a-zäöüßåāđē]*',
-           'he': u'[a-zא-ת]*',
-           'hu': u'[a-záéíóúöüőűÁÉÍÓÚÖÜŐŰ]*',
-           'it': u'[a-zàéèíîìóòúù]*',
-           'ka': u'[a-zაბგდევზთიკლმნოპჟრსტუფქღყშჩცძწჭხჯჰ“»]*',
-           'kk': 
u'[a-zäçéğıïñöşüýʺʹа-яёәғіқңөұүһٴابپتجحدرزسشعفقكلمنڭەوۇۋۆىيچھ“»]*',
-           'ksh': u'[a-zäöüėëijßəğåůæœç]*',
-           'mk': u'[a-zабвгдѓежзѕијклљмнњопрстќуфхцчџш]*',
-           'nl': u'[a-zäöüïëéèàë]*',
-           'pl': u'[a-zęóąśłżźćńĘÓĄŚŁŻŹĆŃ]*',
-           'pt': u'[a-záâàãéêíóôõúüç]*',
-           'ro': u'[a-zăâîşţșțĂÂÎŞŢȘȚ]*',
-           'ru': u'[a-zа-я]*',
-           'sk': u'[a-záäčďéíľĺňóôŕšťúýž]*',
+            '_default': u'[a-z]*',
+            'ca': u'[a-zàèéíòóúç·ïü]*',
+            'cs': u'[a-záčďéěíňóřšťúůýž]*',
+            'de': u'[a-zäöüß]*',
+            'da': u'[a-zæøå]*',
+            'es': u'[a-záéíóúñ]*',
+            'fa': u'[a-zابپتثجچحخدذرزژسشصضطظعغفقکگلمنوهیآأئؤة‌]*',
+            'fi': u'[a-zäö]*',
+            'fr': u'[a-zàâçéèêîôûäëïöüùÇÉÂÊÎÔÛÄËÏÖÜÀÈÙ]*',
+            'frr': u'[a-zäöüßåāđē]*',
+            'he': u'[a-zא-ת]*',
+            'hu': u'[a-záéíóúöüőűÁÉÍÓÚÖÜŐŰ]*',
+            'it': u'[a-zàéèíîìóòúù]*',
+            'ka': u'[a-zაბგდევზთიკლმნოპჟრსტუფქღყშჩცძწჭხჯჰ“»]*',
+            'kk': 
u'[a-zäçéğıïñöşüýʺʹа-яёәғіқңөұүһٴابپتجحدرزسشعفقكلمنڭەوۇۋۆىيچھ“»]*',
+            'ksh': u'[a-zäöüėëijßəğåůæœç]*',
+            'mk': u'[a-zабвгдѓежзѕијклљмнњопрстќуфхцчџш]*',
+            'nl': u'[a-zäöüïëéèàë]*',
+            'pl': u'[a-zęóąśłżźćńĘÓĄŚŁŻŹĆŃ]*',
+            'pt': u'[a-záâàãéêíóôõúüç]*',
+            'ro': u'[a-zăâîşţșțĂÂÎŞŢȘȚ]*',
+            'ru': u'[a-zа-я]*',
+            'sk': u'[a-záäčďéíľĺňóôŕšťúýž]*',
         }
 
         # Wikimedia wikis all use "bodyContent" as the id of the <div>
@@ -218,8 +218,8 @@
             'dict':             'dict',
             'dictionary':       'dictionary',
             'disinfopedia':     'disinfopedia',
-            'distributedproofreaders':'distributedproofreaders',
-            'distributedproofreadersca':'distributedproofreadersca',
+            'distributedproofreaders': 'distributedproofreaders',
+            'distributedproofreadersca': 'distributedproofreadersca',
             'dk':               'dk',
             'dmoz':             'dmoz',
             'dmozs':            'dmozs',
@@ -368,7 +368,7 @@
             'organicdesign':    'organicdesign',
             'orgpatterns':      'orgpatterns',
             'orthodoxwiki':     'orthodoxwiki',
-            'osi reference model':'osi reference model',
+            'osi reference model': 'osi reference model',
             'otrs':             'otrs',
             'otrswiki':         'otrswiki',
             'ourmedia':         'ourmedia',
@@ -502,7 +502,7 @@
             'wikinvest':        'wikinvest',
             'wikipaltz':        'wikipaltz',
             'wikipedia':        'wikipedia',
-            'wikipediawikipedia':'wikipediawikipedia',
+            'wikipediawikipedia': 'wikipediawikipedia',
             'wikiquote':        'wikiquote',
             'wikireason':       'wikireason',
             'wikischool':       'wikischool',
@@ -641,7 +641,7 @@
         # equivalent articles have identical titles among the group.
         self.language_groups = {
             # languages using the arabic script (incomplete)
-            'arab' : [
+            'arab': [
                 'ar', 'arz', 'ps', 'sd', 'ur', 'bjn', 'ckb',
                 # languages using multiple scripts, including arabic
                 'kk', 'ku', 'tt', 'ug', 'pnb'
@@ -727,18 +727,19 @@
             return pywikibot.Family(self.interwiki_forward).langs.keys()
         return self.langs.keys()
 
-    def _addlang(self, code, location, namespaces = {}):
+    def _addlang(self, code, location, namespaces={}):
         """Add a new language to the langs and namespaces of the family.
-           This is supposed to be called in the constructor of the family."""
+           This is supposed to be called in the constructor of the family.
+
+        """
         self.langs[code] = location
-##
 ##        for num, val in namespaces.items():
-##            self.namespaces[num][code]=val
+##            self.namespaces[num][code] = val
 
     def get_known_families(self, site):
         return self.known_families
 
-    def linktrail(self, code, fallback = '_default'):
+    def linktrail(self, code, fallback='_default'):
         if code in self.linktrails:
             return self.linktrails[code]
         elif fallback:
@@ -758,7 +759,7 @@
 "ERROR: title for category redirect template in language '%s' unknown"
                 % code)
 
-    def disambig(self, code, fallback = '_default'):
+    def disambig(self, code, fallback='_default'):
         if code in self.disambiguationTemplates:
             return self.disambiguationTemplates[code]
         elif fallback:
@@ -772,8 +773,8 @@
     # Methods
     def protocol(self, code):
         """
-        Can be overridden to return 'https'.
-        Other protocols are not supported.
+        Can be overridden to return 'https'. Other protocols are not supported.
+
         """
         return 'http'
 
@@ -879,7 +880,9 @@
 
     def RversionTab(self, code):
         """Change this to some regular expression that shows the page we
-        found is an existing page, in case the normal regexp does not work."""
+        found is an existing page, in case the normal regexp does not work.
+
+        """
         return None
 
     def has_query_api(self, code):
@@ -938,4 +941,3 @@
 
     def shared_image_repository(self, code):
         return ('commons', 'commons')
-


_______________________________________________
Pywikipedia-svn mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-svn

Reply via email to