Xqt has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/778620 )
Change subject: [pep8] Fixed some flake issues ......................................................................
[pep8] Fixed some flake issues
Change-Id: I3a6d7cab90a5ba17be5c21d12f4f2fba1798d1f7 --- M scripts/dataextend.py M tox.ini 2 files changed, 10 insertions(+), 19 deletions(-)
Approvals: Xqt: Verified; Looks good to me, approved
diff --git a/scripts/dataextend.py b/scripts/dataextend.py index f1c1b7f..6deb3b3 100644 --- a/scripts/dataextend.py +++ b/scripts/dataextend.py @@ -377,8 +377,6 @@ key, value = line.strip().split(':', 1) self.labels[key] = value
- - with suppress(IOError): with codecs.open(self.datafile, 'r', 'utf-8') as f: for line in f.readlines(): @@ -389,7 +387,6 @@ dtype, key, value = (parts[0], ':'.join(parts[1:-1]), parts[-1]) self.data[dtype][key] = value
- with suppress(IOError): with codecs.open(self.nonamefile, 'r', 'utf-8') as f: for line in f.readlines(): @@ -912,7 +909,7 @@ try: updatedclaims[claim[0]][ self.getlocnumber(claim[1], updatedclaims[claim[0]]) - ].addSources(sourcedata) + ].addSources(sourcedata) except AttributeError: if prop not in propstodo: propstodo.append(prop) @@ -1261,7 +1258,6 @@ self.html = unquote(self.html) self.html = self.prepare(self.html)
- pywikibot.output('\n=== {} ({}) ===='.format(self.dbname, self.dbproperty)) if self.hrtre: match = re.compile('(?s)' + self.hrtre).search(self.html) @@ -3437,8 +3433,8 @@ def findformationlocation(self, html): if not self.isperson: return self.findbyre(r'(?s)<dt>Founded in:</dt>.*?<bdi>(\w+)', html, 'city') \ - or self.findbyre(r'(?s)<dt>Founded in:</dt>.*?<bdi>(.*?)</bdi>', html, 'city') \ - or self.findbyre(r'(?s)<dt>Area:</dt>.*?<bdi>(.*?)</bdi>', html, 'city') + or self.findbyre(r'(?s)<dt>Founded in:</dt>.*?<bdi>(.*?)</bdi>', html, 'city') \ + or self.findbyre(r'(?s)<dt>Area:</dt>.*?<bdi>(.*?)</bdi>', html, 'city')
def findorigcountry(self, html): if not self.isperson: @@ -10577,7 +10573,6 @@ return self.findbyre('Release')
- class AmericanBiographyAnalyzer(Analyzer): def setup(self): self.dbproperty = 'P4823' @@ -11114,7 +11109,7 @@ return [ self.getvalue('ethnicity', html, 'ethnicity'), self.getvalue('background', html, 'ethnicity') - ] + ]
def findeyecolor(self, html): return self.getvalue(r'eye\s*color', html, 'eyecolor') @@ -11188,7 +11183,6 @@ return self.finddefaultmixedrefs(html)
- class NelsonAtkinsAnalyzer(Analyzer): def setup(self): self.dbproperty = 'P5273' @@ -12073,7 +12067,7 @@ return [ self.getvalue('Ethnicity', html, 'ethnicity'), self.getvalue('Background', html, 'ethnicity') - ] + ]
def findwebsite(self, html): return self.findbyre(r'(?s)href="([^<>"]*)"[^<>]*>(?:\s|<[^<>]*>)*Official Site', html) @@ -12391,7 +12385,6 @@ return self.findallbyre('"country_team[^"]*">(.*?)<', html, 'country')
- class MuziekwebAnalyzer(Analyzer): def setup(self): self.dbproperty = 'P5882' @@ -13735,7 +13728,7 @@ return [ self.getvalue('Nom', html), self.getvalue('Parcours de vie', html) - ] + ]
def findlongtext(self, html): return self.findbyre(r'(?s)Historique\s*</h3>(.*?)(?:<h3|<!--)', html) @@ -13943,7 +13936,6 @@ if result: return result[0]
- def findinstanceof(self, html): return self.getinfo([ 'background', 'färg', 'farve', 'fondo', 'culoare', '背景色', 'barva pozadí', @@ -14014,10 +14006,9 @@ self.findbyre(r" %s(?: stato)? (?:e[eiu]?n |an? |u[nm][ea]? |eine[nr]? |'n |ne |e |unha |ett? |o |một )?(.+?)[.;]" % word, html)) for word in [ 'is', 'w[aio]s', 'ist', 'wao?r', 'este?', 'était', 'fu', 'fou', '—', '-', 'era', 'е', 'היה', 'by[łl]', - 'foi', 'был', 'fue', 'oli', 'bio', 'wie', 'var', 'je', 'იყო', 'adalah', 'é', 'ήταν', 'هو', 'стала', - '[eé]s', 'er', 'est[ia]s', 'एक', 'یک', 'كان', 'è', 'бил', 'là', 'on', ',', 'on', 'egy', 'sono', - 'är', 'are', 'fuit', 'وهو', 'esas', 'は、', 'ni', 'là' - ]] \ + 'foi', 'был', 'fue', 'oli', 'bio', 'wie', 'var', 'je', 'იყო', 'adalah', 'é', 'ήταν', 'هو', 'стала', + '[eé]s', 'er', 'est[ia]s', 'एक', 'یک', 'كان', 'è', 'бил', 'là', 'on', ',', 'on', 'egy', 'sono', + 'är', 'are', 'fuit', 'وهو', 'esas', 'は、', 'ni', 'là']] \ + self.findallbyre(r'{{short description|(.*?)}', html) \ + self.findallbyre(r'[[[^[]|]+?:([^[]|]+)]]', html) \ + [x.replace('_', ' ') for x in self.findallbyre(r'((.*?))', self.id)] diff --git a/tox.ini b/tox.ini index 90abc67..67c9cfe 100644 --- a/tox.ini +++ b/tox.ini @@ -167,7 +167,7 @@ scripts/clean_sandbox.py: N816 scripts/commonscat.py: N802, N806, N816 scripts/cosmetic_changes.py: N816 - scripts/dataextend.py: D101, D102, D107, E121, E123, E126, E127, E131, E303, E501, N802 + scripts/dataextend.py: D101, D102, E126, E127, E131, E501 scripts/harvest_template.py: N802, N816 scripts/interwiki.py: N802, N803, N806, N816 scripts/imagetransfer.py: N803, N806, N816
pywikibot-commits@lists.wikimedia.org