Xqt has uploaded a new change for review. https://gerrit.wikimedia.org/r/95155
Change subject: [PEP8] pep8 changes ...................................................................... [PEP8] pep8 changes Change-Id: If3c462e84fee96f35e613ee08ae6499dc7d111a0 --- M articlenos.py 1 file changed, 8 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/compat refs/changes/55/95155/1 diff --git a/articlenos.py b/articlenos.py index 2f3bda6..e0707ca 100644 --- a/articlenos.py +++ b/articlenos.py @@ -23,14 +23,16 @@ from irclib import nm_to_n, nm_to_h, irc_lower, ip_numstr_to_quad from irclib import ip_quad_to_numstr + class ArtNoDisp(SingleServerIRCBot): + def __init__(self, site, channel, nickname, server, port=6667): SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname) self.channel = channel self.site = site ns = [] for n in site.namespaces(): - if type(n) == type(()): + if isinstance(n, tuple): # I am wondering that this may occur! ns += n[0] else: ns += [n] @@ -40,7 +42,8 @@ self.api_url += 'action=query&meta=siteinfo&siprop=statistics&format=xml' self.api_found = re.compile(r'articles="(.*?)"') self.re_edit = re.compile( - r'^C14\[\[^C07(?P<page>.+?)^C14\]\]^C4 (?P<flags>.*?)^C10 ^C02(?P<url>.+?)^C ^C5\*^C ^C03(?P<user>.+?)^C ^C5\*^C \(?^B?(?P<bytes>[+-]?\d+?)^B?\) ^C10(?P<summary>.*)^C'.replace('^B', '\002').replace('^C', '\003').replace('^U', '\037')) + r'^C14\[\[^C07(?P<page>.+?)^C14\]\]^C4 (?P<flags>.*?)^C10 ^C02(?P<url>.+?)^C ^C5\*^C ^C03(?P<user>.+?)^C ^C5\*^C \(?^B?(?P<bytes>[+-]?\d+?)^B?\) ^C10(?P<summary>.*)^C'.replace( + '^B', '\002').replace('^C', '\003').replace('^U', '\037')) def on_nicknameinuse(self, c, e): c.nick(c.get_nickname() + "_") @@ -58,12 +61,12 @@ if not ('N' in match.group('flags')): return try: - msg = unicode(e.arguments()[0],'utf-8') + msg = unicode(e.arguments()[0], 'utf-8') except UnicodeDecodeError: return if self.other_ns.match(msg): return - name = msg[8:msg.find(u'14',9)] + name = msg[8:msg.find(u'14', 9)] text = self.site.getUrl(self.api_url) entry = self.api_found.findall(text) page = pywikibot.Page(self.site, name) @@ -87,6 +90,7 @@ def on_quit(self, e, cmd): pass + def main(): site = pywikibot.getSite() site.forceLogin() -- To view, visit https://gerrit.wikimedia.org/r/95155 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If3c462e84fee96f35e613ee08ae6499dc7d111a0 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/compat Gerrit-Branch: master Gerrit-Owner: Xqt <i...@gno.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits