John Vandenberg has uploaded a new change for review.
https://gerrit.wikimedia.org/r/186341
Change subject: Fix pywikibot/ indents
......................................................................
Fix pywikibot/ indents
Change-Id: I064d67bd7f85fc0c47e07ae5d30f61dbbd3be92b
---
M pywikibot/family.py
M pywikibot/i18n.py
M pywikibot/page.py
M pywikibot/pagegenerators.py
M pywikibot/site.py
5 files changed, 45 insertions(+), 37 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core
refs/changes/41/186341/1
diff --git a/pywikibot/family.py b/pywikibot/family.py
index 130169f..64585b8 100644
--- a/pywikibot/family.py
+++ b/pywikibot/family.py
@@ -339,7 +339,6 @@
'dmoz': 'dmoz',
'dmozs': 'dmozs',
'docbook': 'docbook',
-# 'doi': 'doi',
'doom_wiki': 'doom_wiki',
'download': 'download',
'drae': 'drae',
@@ -1096,9 +1095,10 @@
else:
return None
if url_match.group(1) and url_match.group(1) != self.protocol(code):
- pywikibot.log('The entry in the interwikimap uses {0} but the '
- 'family is configured to use {1}'.format(
- url_match.group(1), self.protocol(code)))
+ pywikibot.log(
+ 'The entry in the interwikimap uses {0} but the family is '
+ 'configured to use {1}'.format(
+ url_match.group(1), self.protocol(code)))
return code
def maximum_GET_length(self, code):
diff --git a/pywikibot/i18n.py b/pywikibot/i18n.py
index ac10b82..5e87552 100644
--- a/pywikibot/i18n.py
+++ b/pywikibot/i18n.py
@@ -532,6 +532,6 @@
@rtype: unicode string
"""
code = config.userinterface_lang or \
- locale.getdefaultlocale()[0].split('_')[0]
+ locale.getdefaultlocale()[0].split('_')[0]
trans = twtranslate(code, twtitle, parameters)
return pywikibot.input(trans, password)
diff --git a/pywikibot/page.py b/pywikibot/page.py
index a10291f..45fd85f 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -2847,10 +2847,10 @@
# if none of the above applies, this item is in an invalid state
# which needs to be raise as an exception, but also logged in case
# an exception handler is catching the generic Error.
- pywikibot.error('%s is in invalid state' %
- self.__class__.__name__)
+ pywikibot.error('%s is in invalid state'
+ % self.__class__.__name__)
raise pywikibot.Error('%s is in invalid state' %
- self.__class__.__name__)
+ % self.__class__.__name__)
return params
@@ -3343,7 +3343,9 @@
claims[prop] = []
for claim1 in diffto['claims'][prop]:
if 'id' in claim1 and claim1['id'] not in \
- [claim2['id'] for claim2 in claims[prop] if 'id' in
claim2]:
+ [claim2['id']
+ for claim2 in claims[prop]
+ if 'id' in claim2]:
if prop not in temp:
temp[prop] = []
temp[prop].append({'id': claim1['id'], 'remove': ''})
@@ -3605,7 +3607,7 @@
@return: Claim
"""
return Claim(self.site, self.getID(), datatype=self.type,
- *args, **kwargs)
+ *args, **kwargs)
class Claim(Property):
@@ -3791,7 +3793,7 @@
value_class = self.types[self.type]
if not isinstance(value, value_class):
raise ValueError("%s is not type %s."
- % (value, value_class))
+ % (value, value_class))
self.target = value
def changeTarget(self, value=None, snaktype='value', **kwargs):
@@ -4264,7 +4266,7 @@
raise SiteDefinitionError(
u'{0} is not a local page on {1}, and the interwiki prefix
'
'{2} is not supported by PyWikiBot!'.format(
- self._text, self._site, prefix))
+ self._text, self._site, prefix))
else:
t = t[t.index(u":"):].lstrip(u":").lstrip(u" ")
if first_other_site:
@@ -4272,7 +4274,7 @@
raise pywikibot.InvalidTitle(
u'{0} links to a non local site {1} via an '
'interwiki link to {2}.'.format(
- self._text, newsite, first_other_site))
+ self._text, newsite, first_other_site))
elif newsite != self._source:
first_other_site = newsite
self._site = newsite
diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py
index 792e092..3114736 100644
--- a/pywikibot/pagegenerators.py
+++ b/pywikibot/pagegenerators.py
@@ -763,7 +763,8 @@
user = None
pywikibot.warning(u'The usage of "{0}" is discouraged. Use '
'-logevents "{1}" instead.'.format(
- arg, ','.join((mode, user or '',
str(total)))))
+ arg,
+ ','.join((mode, user or '',
str(total)))))
gen = self._parse_log_events(mode, user, total)
if gen:
@@ -1950,7 +1951,7 @@
if site is None:
site = pywikibot.Site()
return site.exturlusage(link, namespaces=namespaces, step=step,
- total=total, content=False)
+ total=total, content=False)
def SearchPageGenerator(query, step=None, total=None, namespaces=None,
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 873cc6b..ddde38f 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -454,7 +454,7 @@
result = [NotImplemented if isinstance(ns, bool) else
Namespace.lookup_name(ns, namespaces)
if isinstance(ns, basestring)
- and not ns.lstrip('-').isdigit() else
+ and not ns.lstrip('-').isdigit() else
namespaces[int(ns)] if int(ns) in namespaces
else None
for ns in identifiers]
@@ -1192,7 +1192,7 @@
else:
pywikibot.log(u"Unable to get siteinfo, because at least "
u"one property is unknown: '{0}'".format(
- u"', '".join(props)))
+ u"', '".join(props)))
results = {}
for prop in props:
results.update(self._get_siteinfo(prop, expiry))
@@ -2096,7 +2096,7 @@
if not hasattr(self, "_magicwords"):
magicwords = self.siteinfo.get("magicwords", cache=False)
self._magicwords = dict((item["name"], item["aliases"])
- for item in magicwords)
+ for item in magicwords)
if word in self._magicwords:
return self._magicwords[word]
@@ -2329,7 +2329,7 @@
page.title(withSection=False)):
pywikibot.warning(
u"{0}: Query on {1} returned data on '{2}'".format(
- method_name, page, pageitem['title']))
+ method_name, page, pageitem['title']))
continue
api.update_page(page, pageitem, query.props)
@@ -2714,13 +2714,13 @@
if all is not False:
types.extend(self.TOKENS_1)
req = api.Request(site=self, action='tokens',
- type='|'.join(self.validate_tokens(types)))
+ type='|'.join(self.validate_tokens(types)))
else:
if all is not False:
types.extend(self.TOKENS_2)
req = api.Request(site=self, action='query', meta='tokens',
- type='|'.join(self.validate_tokens(types)))
+ type='|'.join(self.validate_tokens(types)))
req._warning_handler = warn_handler
data = req.submit()
@@ -2730,8 +2730,8 @@
if 'tokens' in data and data['tokens']:
user_tokens = dict((key[:-5], val)
- for key, val in data['tokens'].items()
- if val != '+\\')
+ for key, val in data['tokens'].items()
+ if val != '+\\')
return user_tokens
@@ -4124,24 +4124,29 @@
_mv_errors = {
"noapiwrite": "API editing not enabled on %(site)s wiki",
"writeapidenied":
-"User %(user)s is not authorized to edit on %(site)s wiki",
+ "User %(user)s is not authorized to edit on %(site)s wiki",
"nosuppress":
-"User %(user)s is not authorized to move pages without creating redirects",
+ "User %(user)s is not authorized to move pages without "
+ "creating redirects",
"cantmove-anon":
-"""Bot is not logged in, and anon users are not authorized to move pages on
-%(site)s wiki""",
+ "Bot is not logged in, and anon users are not authorized to "
+ "move pages on %(site)s wiki",
"cantmove":
-"User %(user)s is not authorized to move pages on %(site)s wiki",
+ "User %(user)s is not authorized to move pages on %(site)s wiki",
"immobilenamespace":
-"Pages in %(oldnamespace)s namespace cannot be moved on %(site)s wiki",
- "articleexists": OnErrorExc(exception=ArticleExistsConflict,
on_new_page=True),
+ "Pages in %(oldnamespace)s namespace cannot be moved on "
+ "%(site)s wiki",
+ "articleexists":
+ OnErrorExc(exception=ArticleExistsConflict, on_new_page=True),
# "protectedpage" can happen in both directions.
"protectedpage": OnErrorExc(exception=LockedPage, on_new_page=None),
"protectedtitle": OnErrorExc(exception=LockedNoPage, on_new_page=True),
"nonfilenamespace":
-"Cannot move a file to %(newnamespace)s namespace on %(site)s wiki",
+ "Cannot move a file to %(newnamespace)s namespace on "
+ "%(site)s wiki",
"filetypemismatch":
-"[[%(newtitle)s]] file extension does not match content of [[%(oldtitle)s]]",
+ "[[%(newtitle)s]] file extension does not match content of "
+ "[[%(oldtitle)s]]",
}
@must_be(group='user')
@@ -5275,8 +5280,8 @@
def _get_propertyitem(self, props, source, **params):
"""Generic method to get the data for multiple Wikibase items."""
wbdata = self.get_item(source, props=props, **params)
- assert props in wbdata, \
- "API wbgetentities response lacks %s key" % props
+ assert props in wbdata, "API wbgetentities response lacks %s key"
+ % props
return wbdata[props]
@deprecated("pywikibot.WikibasePage")
@@ -5289,12 +5294,12 @@
**params)
wbdata = wbrequest.submit()
assert 'success' in wbdata, \
- "API wbgetentities response lacks 'success' key"
+ "API wbgetentities response lacks 'success' key"
assert wbdata['success'] == 1, "API 'success' key is not 1"
assert 'entities' in wbdata, \
- "API wbgetentities response lacks 'entities' key"
+ "API wbgetentities response lacks 'entities' key"
assert ids in wbdata['entities'], \
- "API wbgetentities response lacks %s key" % ids
+ "API wbgetentities response lacks %s key" % ids
return wbdata['entities'][ids]
else:
# not implemented yet
--
To view, visit https://gerrit.wikimedia.org/r/186341
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I064d67bd7f85fc0c47e07ae5d30f61dbbd3be92b
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits