jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/498728 )
Change subject: [IMPR] Fix typos in docs
......................................................................
[IMPR] Fix typos in docs
Change-Id: If8a21838e6949ff5c8673d079547d093d32c77e4
---
M pywikibot/i18n.py
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
JJMC89: Looks good to me, but someone else must approve
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/i18n.py b/pywikibot/i18n.py
index cae0b61..ca6168d 100644
--- a/pywikibot/i18n.py
+++ b/pywikibot/i18n.py
@@ -455,7 +455,7 @@
"""Check for the plural variants in message and replace them.
@param message: the message to be replaced
- @type message: str string
+ @type message: str
@param parameters: plural parameters passed from other methods
@type parameters: Mapping of str to int
@return: The message with the plural instances replaced
@@ -854,7 +854,7 @@
@param parameters: The values which will be applied to the translated text
@param password: Hides the user's input (for password entry)
@param fallback_prompt: The English prompt if i18n is not available.
- @rtype: str string
+ @rtype: str
"""
if not messages_available():
if not fallback_prompt:
--
To view, visit https://gerrit.wikimedia.org/r/498728
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: If8a21838e6949ff5c8673d079547d093d32c77e4
Gerrit-Change-Number: 498728
Gerrit-PatchSet: 2
Gerrit-Owner: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: D3r1ck01 <alangiderick(a)gmail.com>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: JJMC89 <JJMC89.Wikimedia(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Siebrand <siebrand(a)kitano.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zhuyifei1999 <zhuyifei1999(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/498727 )
Change subject: [bugfix] Fix basestring/StringTypes across scripts
......................................................................
[bugfix] Fix basestring/StringTypes across scripts
- basestring = StringTypes = (str, unicode) in PY2, but several scripts
use `basestring = (str,)`, for PY3, which is incorrect and produces
different behavior between PY2 and PY3
- so all occurences of `basestring = (str,)` or `unicode = str` in scripts
are replaced by `UnicodeType` from pywikibot.tools
Bug: T219095
Change-Id: Ib7d1b649576dfb58e8b971b53c96b75961267fb7
---
M pywikibot/__init__.py
M pywikibot/bot.py
M pywikibot/data/api.py
M pywikibot/data/wikistats.py
M pywikibot/date.py
M pywikibot/flow.py
M pywikibot/logentries.py
M pywikibot/login.py
M pywikibot/page.py
M pywikibot/pagegenerators.py
M pywikibot/site.py
M pywikibot/specialbots.py
M pywikibot/textlib.py
M pywikibot/tools/__init__.py
M pywikibot/tools/chars.py
M pywikibot/userinterfaces/win32_unicode.py
M pywikibot/version.py
M scripts/category.py
M scripts/imageharvest.py
M scripts/interwiki.py
M scripts/misspelling.py
M scripts/redirect.py
M scripts/replace.py
M scripts/weblinkchecker.py
M tests/djvu_tests.py
25 files changed, 150 insertions(+), 203 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index e674046..7fa267f 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -67,6 +67,7 @@
ModuleDeprecationWrapper as _ModuleDeprecationWrapper,
PY2,
UnicodeMixin,
+ UnicodeType
)
from pywikibot.tools.formatter import color_format
@@ -74,7 +75,6 @@
if not PY2:
from queue import Queue
long = int
- basestring = str
else:
from Queue import Queue
@@ -791,7 +791,7 @@
self.site = site or Site().data_repository()
# also allow entity URIs to be provided via unit parameter
- if isinstance(unit, basestring) and \
+ if isinstance(unit, UnicodeType) and \
unit.partition('://')[0] not in ('http', 'https'):
raise ValueError("'unit' must be an ItemPage or entity uri.")
@@ -833,7 +833,7 @@
@type lazy_load: bool
@return: pywikibot.ItemPage
"""
- if not isinstance(self._unit, basestring):
+ if not isinstance(self._unit, UnicodeType):
return self._unit
repo = repo or self.site
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 0a93d5e..2c98fc6 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -127,9 +127,6 @@
# Note: all output goes through python std library "logging" module
_logger = 'bot'
-if not PY2:
- unicode = str
-
# User interface initialization
# search for user interface module in the 'userinterfaces' subdirectory
uiModule = __import__('pywikibot.userinterfaces.%s_interface'
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index 9f2843a..c111fd0 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -49,9 +49,7 @@
# The following solution might be removed if/once the bug is fixed,
# unless the fix is not backported to py3.x versions that should
# instead support PWB.
- basestring = (str, )
from urllib.parse import urlencode, unquote
- unicode = str
from io import BytesIO
@@ -105,7 +103,7 @@
self.code = code
self.info = info
self.other = kwargs
- self.unicode = unicode(self.__str__())
+ self.unicode = UnicodeType(self.__str__())
def __repr__(self):
"""Return internal representation."""
@@ -309,7 +307,7 @@
assert('mime' in result['help'])
assert(result['help']['mime'] == 'text/plain')
assert('help' in result['help'])
- assert(isinstance(result['help']['help'], basestring))
+ assert(isinstance(result['help']['help'], UnicodeType))
help_text = result['help']['help']
@@ -353,7 +351,7 @@
@type modules: iterable or basestring
@rtype: set
"""
- if isinstance(modules, basestring):
+ if isinstance(modules, UnicodeType):
return set(modules.split('|'))
return set(modules)
@@ -1374,7 +1372,7 @@
assert(value.site == self.site)
return value.title(with_section=False)
else:
- return unicode(value)
+ return UnicodeType(value)
def __getitem__(self, key):
"""Implement dict interface."""
@@ -1399,7 +1397,7 @@
if isinstance(value, bytes):
value = value.decode(self.site.encoding())
- if isinstance(value, unicode):
+ if isinstance(value, UnicodeType):
value = value.split('|')
if hasattr(value, 'api_iter'):
@@ -1778,7 +1776,7 @@
@raises APIError: unknown action found
@raises APIError: unknown query result type
"""
- if not isinstance(data, unicode):
+ if not isinstance(data, UnicodeType):
data = data.decode(self.site.encoding())
pywikibot.debug(('API response received from {}:\n'
.format(self.site)) + data, _logger)
@@ -2005,7 +2003,7 @@
if key in ('error', 'warnings'):
continue
assert key not in error
- assert isinstance(result[key], basestring), \
+ assert isinstance(result[key], UnicodeType), \
'Unexpected %s: %r' % (key, result[key])
error[key] = result[key]
@@ -2658,7 +2656,7 @@
return False
- if isinstance(namespaces, basestring):
+ if isinstance(namespaces, UnicodeType):
namespaces = namespaces.split('|')
# Use Namespace id (int) here; Request will cast int to str
@@ -2832,7 +2830,7 @@
if 'query' not in self.data:
pywikibot.log("%s: 'query' not found in api response." %
self.__class__.__name__)
- pywikibot.log(unicode(self.data))
+ pywikibot.log(UnicodeType(self.data))
# if (query-)continue is present, self.resultkey might not have
# been fetched yet
if self.continue_name not in self.data:
diff --git a/pywikibot/data/wikistats.py b/pywikibot/data/wikistats.py
index 309e549..14175d8 100644
--- a/pywikibot/data/wikistats.py
+++ b/pywikibot/data/wikistats.py
@@ -10,11 +10,10 @@
import pywikibot
from pywikibot.comms import http
-from pywikibot.tools import PY2
+from pywikibot.tools import PY2, UnicodeType
if not PY2:
import csv
- unicode = str
else:
try:
import unicodecsv as csv
@@ -185,8 +184,8 @@
site = {}
for field in row.findall('field'):
- name = unicode(field.get('name'))
- site[name] = unicode(field.text)
+ name = UnicodeType(field.get('name'))
+ site[name] = UnicodeType(field.text)
data.append(site)
diff --git a/pywikibot/date.py b/pywikibot/date.py
index 34e38b1..fb761cb 100644
--- a/pywikibot/date.py
+++ b/pywikibot/date.py
@@ -19,11 +19,7 @@
from string import digits as _decimalDigits # noqa: N812
from pywikibot.textlib import NON_LATIN_DIGITS
-from pywikibot.tools import first_lower, first_upper, deprecated, PY2
-
-if not PY2:
- unicode = str
- basestring = (str,)
+from pywikibot.tools import first_lower, first_upper, deprecated, UnicodeType
#
# Different collections of well known formats
@@ -59,7 +55,7 @@
When the 2nd function evaluates to true, the 1st function is used.
"""
- if isinstance(value, basestring):
+ if isinstance(value, UnicodeType):
# Try all functions, and test result against predicates
for func, pred in tuplst:
try:
@@ -214,7 +210,7 @@
formats['MonthName']['en']('anything else') => raise ValueError
"""
- if isinstance(value, basestring):
+ if isinstance(value, UnicodeType):
return lst.index(value) + 1
else:
return lst[value - 1]
@@ -232,7 +228,7 @@
formats['CurrEvents']['en']('Current Events') => ind
"""
- if isinstance(value, basestring):
+ if isinstance(value, UnicodeType):
if value == match:
return ind
else:
@@ -264,33 +260,33 @@
# Helper for KN: digits representation
_knDigits = NON_LATIN_DIGITS['kn']
-_knDigitsToLocal = {ord(unicode(i)): _knDigits[i] for i in range(10)}
-_knLocalToDigits = {ord(_knDigits[i]): unicode(i) for i in range(10)}
+_knDigitsToLocal = {ord(UnicodeType(i)): _knDigits[i] for i in range(10)}
+_knLocalToDigits = {ord(_knDigits[i]): UnicodeType(i) for i in range(10)}
# Helper for Urdu/Persian languages
_faDigits = NON_LATIN_DIGITS['fa']
-_faDigitsToLocal = {ord(unicode(i)): _faDigits[i] for i in range(10)}
-_faLocalToDigits = {ord(_faDigits[i]): unicode(i) for i in range(10)}
+_faDigitsToLocal = {ord(UnicodeType(i)): _faDigits[i] for i in range(10)}
+_faLocalToDigits = {ord(_faDigits[i]): UnicodeType(i) for i in range(10)}
# Helper for HI:, MR:
_hiDigits = NON_LATIN_DIGITS['hi']
-_hiDigitsToLocal = {ord(unicode(i)): _hiDigits[i] for i in range(10)}
-_hiLocalToDigits = {ord(_hiDigits[i]): unicode(i) for i in range(10)}
+_hiDigitsToLocal = {ord(UnicodeType(i)): _hiDigits[i] for i in range(10)}
+_hiLocalToDigits = {ord(_hiDigits[i]): UnicodeType(i) for i in range(10)}
# Helper for BN:
_bnDigits = NON_LATIN_DIGITS['bn']
-_bnDigitsToLocal = {ord(unicode(i)): _bnDigits[i] for i in range(10)}
-_bnLocalToDigits = {ord(_bnDigits[i]): unicode(i) for i in range(10)}
+_bnDigitsToLocal = {ord(UnicodeType(i)): _bnDigits[i] for i in range(10)}
+_bnLocalToDigits = {ord(_bnDigits[i]): UnicodeType(i) for i in range(10)}
# Helper for GU:
_guDigits = NON_LATIN_DIGITS['gu']
-_guDigitsToLocal = {ord(unicode(i)): _guDigits[i] for i in range(10)}
-_guLocalToDigits = {ord(_guDigits[i]): unicode(i) for i in range(10)}
+_guDigitsToLocal = {ord(UnicodeType(i)): _guDigits[i] for i in range(10)}
+_guLocalToDigits = {ord(_guDigits[i]): UnicodeType(i) for i in range(10)}
def intToLocalDigitsStr(value, digitsToLocalDict):
"""Encode an integer value into a textual form."""
- return unicode(value).translate(digitsToLocalDict)
+ return UnicodeType(value).translate(digitsToLocalDict)
def localDigitsStrToInt(value, digitsToLocalDict, localToDigitsDict):
@@ -328,7 +324,7 @@
# %% is a %
'%': '%',
# %d is a decimal
- 'd': (_decimalDigits, unicode, int),
+ 'd': (_decimalDigits, UnicodeType, int),
# %R is a roman numeral. This allows for only the simplest linear
# conversions based on a list of numbers
'R': ('IVX', intToRomanNum, romanNumToInt),
@@ -353,7 +349,8 @@
lambda v: localDigitsStrToInt(v, _guDigitsToLocal,
_guLocalToDigits)),
# %T is a year in TH: -- all years are shifted: 2005 => 'พ.ศ. 2548'
- 'T': (_decimalDigits, lambda v: unicode(v + 543), lambda v: int(v) - 543),
+ 'T': (_decimalDigits, lambda v: UnicodeType(v + 543),
+ lambda v: int(v) - 543),
}
# Allows to search for '(%%)|(%d)|(%R)|...", and allows one digit 1-9 to set
@@ -386,7 +383,7 @@
and(len(s) == 2 or s[1] in _decimalDigits)):
# Must match a "%2d" or "%d" style
dec = _digitDecoders[s[-1]]
- if isinstance(dec, basestring):
+ if isinstance(dec, UnicodeType):
# Special case for strings that are replaced instead of
# decoded
assert len(s) < 3, (
@@ -447,7 +444,7 @@
"""
compPattern, strPattern, decoders = escapePattern2(pattern)
- if isinstance(value, basestring):
+ if isinstance(value, UnicodeType):
m = compPattern.match(value)
if m:
# decode each found value using provided decoder
@@ -455,7 +452,7 @@
for i, decoder in enumerate(decoders)]
decValue = decf(values)
- assert not isinstance(decValue, basestring), \
+ assert not isinstance(decValue, UnicodeType), \
'Decoder must not return a string!'
# recursive call to re-encode and see if we get the original
diff --git a/pywikibot/flow.py b/pywikibot/flow.py
index ab32dea..d37b3b1 100644
--- a/pywikibot/flow.py
+++ b/pywikibot/flow.py
@@ -11,11 +11,9 @@
from pywikibot.exceptions import NoPage, UnknownExtension, LockedPage
from pywikibot.page import BasePage, User
-from pywikibot.tools import PY2
+from pywikibot.tools import PY2, UnicodeType
if not PY2:
- unicode = str
- basestring = (str,)
from urllib.parse import urlparse, parse_qs
else:
from urlparse import urlparse, parse_qs
@@ -201,7 +199,7 @@
"""
if not isinstance(board, Board):
raise TypeError('board must be a pywikibot.flow.Board object.')
- if not isinstance(root_uuid, basestring):
+ if not isinstance(root_uuid, UnicodeType):
raise TypeError('Topic/root UUID must be a string.')
topic = cls(board.site, 'Topic:' + root_uuid)
@@ -326,7 +324,7 @@
raise TypeError('Page must be a Topic object')
if not page.exists():
raise NoPage(page, 'Topic must exist: %s')
- if not isinstance(uuid, basestring):
+ if not isinstance(uuid, UnicodeType):
raise TypeError('Post UUID must be a string')
self._page = page
@@ -379,7 +377,7 @@
if 'content' in self._current_revision:
content = self._current_revision.pop('content')
assert isinstance(content, dict)
- assert isinstance(content['content'], unicode)
+ assert isinstance(content['content'], UnicodeType)
self._content[content['format']] = content['content']
def _load(self, format='wikitext', load_from_topic=False):
diff --git a/pywikibot/logentries.py b/pywikibot/logentries.py
index 1248334..3daf72c 100644
--- a/pywikibot/logentries.py
+++ b/pywikibot/logentries.py
@@ -9,10 +9,7 @@
import pywikibot
from pywikibot.exceptions import Error, HiddenKeyError
-from pywikibot.tools import deprecated, classproperty, PY2
-
-if not PY2:
- basestring = (str, )
+from pywikibot.tools import deprecated, classproperty, UnicodeType
_logger = 'wiki'
@@ -231,7 +228,7 @@
if not hasattr(self, '_flags'):
self._flags = self._params['flags']
# pre mw 1.19 returned a delimited string.
- if isinstance(self._flags, basestring):
+ if isinstance(self._flags, UnicodeType):
if self._flags:
self._flags = self._flags.split(',')
else:
diff --git a/pywikibot/login.py b/pywikibot/login.py
index 3c6e5bb..935ef19 100644
--- a/pywikibot/login.py
+++ b/pywikibot/login.py
@@ -27,10 +27,7 @@
from pywikibot import config, __url__
from pywikibot.exceptions import NoUsername
from pywikibot.tools import (deprecated_args, remove_last_args,
- normalize_username, PY2)
-
-if not PY2:
- unicode = basestring = str
+ normalize_username, UnicodeType)
class OAuthImpossible(ImportError):
@@ -270,7 +267,7 @@
if (normalize_username(username) == self.username
and family == self.site.family.name
and code == self.site.code):
- if isinstance(password, basestring):
+ if isinstance(password, UnicodeType):
self.password = password
break
elif isinstance(password, BotPassword):
diff --git a/pywikibot/page.py b/pywikibot/page.py
index a07bf9c..2b94ee8 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -47,12 +47,11 @@
deprecated, deprecate_arg, deprecated_args, issue_deprecation_warning,
add_full_name, manage_wrapping,
ModuleDeprecationWrapper as _ModuleDeprecationWrapper, PY2,
- first_upper, redirect_func, remove_last_args,
+ first_upper, redirect_func, remove_last_args, UnicodeType
)
from pywikibot.tools.ip import is_IP, ip_regexp
if not PY2:
- unicode = basestring = str
long = int
from html import entities as htmlentitydefs
from urllib.parse import quote_from_bytes, unquote_to_bytes
@@ -637,7 +636,7 @@
@param value: New value or None
@type value: basestring
"""
- self._text = None if value is None else unicode(value)
+ self._text = None if value is None else UnicodeType(value)
if hasattr(self, '_raw_extracted_templates'):
del self._raw_extracted_templates
@@ -1821,7 +1820,7 @@
@rtype: tuple(username, Timestamp)
"""
result = self.oldest_revision
- return result.user, unicode(result.timestamp.isoformat())
+ return result.user, UnicodeType(result.timestamp.isoformat())
@deprecated('contributors() or revisions()', since='20150206')
@deprecated_args(limit='total')
@@ -1836,7 +1835,8 @@
@rtype: list
"""
return [
- {'user': rev.user, 'timestamp': unicode(rev.timestamp.isoformat())}
+ {'user': rev.user,
+ 'timestamp': UnicodeType(rev.timestamp.isoformat())}
for rev in self.revisions(total=total)]
def merge_history(self, dest, timestamp=None, reason=None):
@@ -2373,7 +2373,7 @@
@param kwargs: Arguments which are used for saving the page directly
afterwards, like 'summary' for edit summary.
"""
- if isinstance(target_page, basestring):
+ if isinstance(target_page, UnicodeType):
target_page = pywikibot.Page(self.site, target_page)
elif self.site != target_page.site:
raise pywikibot.InterwikiRedirectPage(self, target_page)
@@ -2571,7 +2571,7 @@
For compatibility with compat only.
"""
return [self.oldest_file_info.user,
- unicode(self.oldest_file_info.timestamp.isoformat())]
+ UnicodeType(self.oldest_file_info.timestamp.isoformat())]
@deprecated('FilePage.latest_file_info.user', since='20141106')
def getLatestUploader(self):
@@ -2581,7 +2581,7 @@
For compatibility with compat only.
"""
return [self.latest_file_info.user,
- unicode(self.latest_file_info.timestamp.isoformat())]
+ UnicodeType(self.latest_file_info.timestamp.isoformat())]
@deprecated('FilePage.get_file_history()', since='20141106')
def getFileVersionHistory(self):
@@ -3629,7 +3629,7 @@
return
for item in self.logevents(logtype='upload', total=total):
yield (item.page(),
- unicode(item.timestamp()),
+ UnicodeType(item.timestamp()),
item.comment(),
item.pageid() > 0
)
@@ -4124,7 +4124,7 @@
continue
data[prop] = cls._normalizeLanguages(data[prop])
for key, value in data[prop].items():
- if isinstance(value, basestring):
+ if isinstance(value, UnicodeType):
data[prop][key] = {'language': key, 'value': value}
if 'aliases' in data:
@@ -4133,7 +4133,7 @@
if isinstance(values, list):
strings = []
for value in values:
- if isinstance(value, basestring):
+ if isinstance(value, UnicodeType):
strings.append({'language': key, 'value': value})
else:
strings.append(value)
@@ -4621,7 +4621,7 @@
is not redirect.
@type force: bool
"""
- if isinstance(target_page, basestring):
+ if isinstance(target_page, UnicodeType):
target_page = pywikibot.ItemPage(self.repo, target_page)
elif self.repo != target_page.repo:
raise pywikibot.InterwikiRedirectPage(self, target_page)
@@ -4665,15 +4665,15 @@
types = {'wikibase-item': ItemPage,
# 'wikibase-property': PropertyPage, must be declared first
- 'string': basestring,
+ 'string': UnicodeType,
'commonsMedia': FilePage,
'globe-coordinate': pywikibot.Coordinate,
- 'url': basestring,
+ 'url': UnicodeType,
'time': pywikibot.WbTime,
'quantity': pywikibot.WbQuantity,
'monolingualtext': pywikibot.WbMonolingualText,
- 'math': basestring,
- 'external-id': basestring,
+ 'math': UnicodeType,
+ 'external-id': UnicodeType,
'geo-shape': pywikibot.WbGeoShape,
'tabular-data': pywikibot.WbTabularData,
}
@@ -5228,7 +5228,7 @@
@rtype: bool
"""
if (isinstance(self.target, WikibasePage)
- and isinstance(value, basestring)):
+ and isinstance(value, UnicodeType)):
return self.target.id == value
if (isinstance(self.target, pywikibot.WbTime)
@@ -5236,7 +5236,7 @@
return self.target.year == int(value)
if (isinstance(self.target, pywikibot.Coordinate)
- and isinstance(value, basestring)):
+ and isinstance(value, UnicodeType)):
coord_args = [float(x) for x in value.split(',')]
if len(coord_args) >= 3:
precision = coord_args[2]
@@ -5252,7 +5252,7 @@
and abs(self.target.lon - coord_args[1]) <= precision)
if (isinstance(self.target, pywikibot.WbMonolingualText)
- and isinstance(value, basestring)):
+ and isinstance(value, UnicodeType)):
return self.target.text == value
return self.target == value
@@ -6129,7 +6129,7 @@
@raise UnicodeError: Could not convert using any encoding.
"""
- if isinstance(encodings, basestring):
+ if isinstance(encodings, UnicodeType):
encodings = [encodings]
elif isinstance(encodings, pywikibot.site.BaseSite):
# create a list of all possible encodings for both hint sites
diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py
index b2e9ab3..356e80c 100644
--- a/pywikibot/pagegenerators.py
+++ b/pywikibot/pagegenerators.py
@@ -56,10 +56,9 @@
UnknownExtension,
)
from pywikibot.proofreadpage import ProofreadPage
-from pywikibot.tools import PY2
+from pywikibot.tools import PY2, UnicodeType
if not PY2:
- basestring = (str, )
from itertools import zip_longest
else:
from itertools import izip_longest as zip_longest
@@ -676,7 +675,7 @@
# 'start or None', because start might be an empty string
total = None
start = start or None
- if isinstance(start, basestring) and len(start) == 8:
+ if isinstance(start, UnicodeType) and len(start) == 8:
start = pywikibot.Timestamp.strptime(start, '%Y%m%d')
elif start is not None:
try:
@@ -1646,7 +1645,7 @@
if site is None:
site = pywikibot.Site()
for title in iterable:
- if not isinstance(title, basestring):
+ if not isinstance(title, UnicodeType):
break
yield pywikibot.Page(pywikibot.Link(title, site))
@@ -1908,7 +1907,7 @@
regex = [regex]
# Test if regex is already compiled.
# We assume that all list components have the same type
- if isinstance(regex[0], basestring):
+ if isinstance(regex[0], UnicodeType):
regex = [re.compile(r, flag) for r in regex]
return regex
@@ -2099,7 +2098,7 @@
@type show_filtered: bool
"""
if timestamp:
- if isinstance(timestamp, basestring):
+ if isinstance(timestamp, UnicodeType):
ts = pywikibot.Timestamp.fromtimestampformat(timestamp)
else:
ts = timestamp
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 99af4e7..cf560f3 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -77,15 +77,13 @@
merge_unique_dicts,
PY2,
filter_unique,
+ UnicodeType
)
from pywikibot.tools.ip import is_IP
if not PY2:
from itertools import zip_longest
from urllib.parse import urlencode, urlparse
-
- basestring = (str,)
- unicode = str
else:
from itertools import izip_longest as zip_longest
from urllib import urlencode
@@ -344,7 +342,7 @@
return self.id == other
elif isinstance(other, Namespace):
return self.id == other.id
- elif isinstance(other, basestring):
+ elif isinstance(other, UnicodeType):
return other in self
def __ne__(self, other):
@@ -605,7 +603,7 @@
# Temporary until Namespace.resolve can be removed
@staticmethod
def _resolve(identifiers, namespaces):
- if isinstance(identifiers, (basestring, Namespace)):
+ if isinstance(identifiers, (UnicodeType, Namespace)):
identifiers = [identifiers]
else:
# convert non-iterators to single item list
@@ -618,7 +616,7 @@
# int(None) raises TypeError; however, bool needs special handling.
result = [NotImplemented if isinstance(ns, bool) else
NamespacesDict._lookup_name(ns, namespaces)
- if isinstance(ns, basestring)
+ if isinstance(ns, UnicodeType)
and not ns.lstrip('-').isdigit() else
namespaces[int(ns)] if int(ns) in namespaces
else None
@@ -744,7 +742,7 @@
pywikibot.log('BaseSite: code "%s" contains invalid characters'
% code)
self.__code = code
- if isinstance(fam, basestring) or fam is None:
+ if isinstance(fam, UnicodeType) or fam is None:
self.__family = pywikibot.family.Family.load(fam)
else:
self.__family = fam
@@ -1275,7 +1273,7 @@
UserWarning)
from pywikibot.comms import http
if data:
- if not isinstance(data, basestring):
+ if not isinstance(data, UnicodeType):
data = urlencode(data)
return http.request(self, path, method='PUT', body=data)
else:
@@ -1518,7 +1516,7 @@
else:
return False
- if isinstance(prop, basestring):
+ if isinstance(prop, UnicodeType):
props = [prop]
else:
props = prop
@@ -2492,7 +2490,7 @@
issue_deprecation_warning('arg of type str', 'type unicode', 2,
since='20151014')
- args = [unicode(e) for e in args]
+ args = [UnicodeType(e) for e in args]
try:
msgs = self.mediawiki_messages(needed_mw_messages)
except KeyError:
@@ -2505,7 +2503,7 @@
# v1.14 defined and as ', and'; fixed in v1.15
msgs['and'] = ' and'
else:
- msgs[key] = pywikibot.html2unicode(value)
+ msgs[key] = pywikibot.html2UnicodeType(value)
concat = msgs['and'] + msgs['word-separator']
return msgs['comma-separator'].join(
@@ -2528,7 +2526,7 @@
@type includecomments: bool
@rtype: unicode
"""
- if not isinstance(text, basestring):
+ if not isinstance(text, UnicodeType):
raise ValueError('text must be a string')
if not text:
return ''
@@ -3289,7 +3287,7 @@
"""
if not pageids:
return
- if isinstance(pageids, basestring):
+ if isinstance(pageids, UnicodeType):
pageids = pageids.replace('|', ',')
pageids = pageids.split(',')
pageids = [p.strip() for p in pageids]
@@ -3533,7 +3531,7 @@
query.request._warning_handler = warn_handler
for item in query:
- pywikibot.debug(unicode(item), _logger)
+ pywikibot.debug(UnicodeType(item), _logger)
for tokentype in valid_tokens:
if (tokentype + 'token') in item:
user_tokens[tokentype] = item[tokentype + 'token']
@@ -3556,7 +3554,7 @@
data = data['query']
if 'recentchanges' in data:
item = data['recentchanges'][0]
- pywikibot.debug(unicode(item), _logger)
+ pywikibot.debug(UnicodeType(item), _logger)
if 'patroltoken' in item:
user_tokens['patrol'] = item['patroltoken']
else:
@@ -3933,7 +3931,7 @@
raise ValueError(
'categorymembers: startsort must be less than endsort')
- if isinstance(member_type, basestring):
+ if isinstance(member_type, UnicodeType):
member_type = {member_type}
if member_type and sortby == 'timestamp':
@@ -4106,7 +4104,7 @@
if content:
rvargs['rvprop'].append('content')
if section is not None:
- rvargs['rvsection'] = unicode(section)
+ rvargs['rvsection'] = UnicodeType(section)
if rollback:
self.login(sysop=sysop)
rvargs['rvtoken'] = 'rollback'
@@ -4114,10 +4112,10 @@
rvtitle = page.title(with_section=False).encode(self.encoding())
rvargs['titles'] = rvtitle
else:
- if isinstance(revids, (int, basestring)):
- ids = unicode(revids)
+ if isinstance(revids, (int, UnicodeType)):
+ ids = UnicodeType(revids)
else:
- ids = '|'.join(unicode(r) for r in revids)
+ ids = '|'.join(UnicodeType(r) for r in revids)
rvargs['revids'] = ids
if rvdir:
@@ -4301,9 +4299,9 @@
apgen.request['gapminsize'] = str(minsize)
if isinstance(maxsize, int):
apgen.request['gapmaxsize'] = str(maxsize)
- if isinstance(protect_type, basestring):
+ if isinstance(protect_type, UnicodeType):
apgen.request['gapprtype'] = protect_type
- if isinstance(protect_level, basestring):
+ if isinstance(protect_level, UnicodeType):
apgen.request['gapprlevel'] = protect_level
if reverse:
apgen.request['gapdir'] = 'descending'
@@ -4547,7 +4545,7 @@
if blockids:
bkgen.request['bkids'] = blockids
if users:
- if isinstance(users, basestring):
+ if isinstance(users, UnicodeType):
users = users.split('|')
# actual IPv6 addresses (anonymous users) are uppercase, but they
# have never a :: in the username (so those are registered users)
@@ -5275,7 +5273,7 @@
'logged in' % err.code,
_logger)
if err.code in self._ep_errors:
- if isinstance(self._ep_errors[err.code], basestring):
+ if isinstance(self._ep_errors[err.code], UnicodeType):
errdata = {
'site': self,
'title': page.title(with_section=False),
@@ -5876,9 +5874,9 @@
if all(_ is None for _ in [rcid, revid, revision]):
raise Error('No rcid, revid or revision provided.')
- if isinstance(rcid, (int, basestring)):
+ if isinstance(rcid, (int, UnicodeType)):
rcid = {rcid}
- if isinstance(revid, (int, basestring)):
+ if isinstance(revid, (int, UnicodeType)):
revid = {revid}
if isinstance(revision, pywikibot.page.Revision):
revision = {revision}
@@ -6972,7 +6970,7 @@
"""
# check old and diff types
def get_param(item):
- if isinstance(item, basestring):
+ if isinstance(item, UnicodeType):
return 'title', item
elif isinstance(item, pywikibot.Page):
return 'title', item.title()
@@ -7033,13 +7031,13 @@
namespaces=namespaces)
if lint_categories:
- if isinstance(lint_categories, basestring):
+ if isinstance(lint_categories, UnicodeType):
lint_categories = lint_categories.split('|')
lint_categories = [p.strip() for p in lint_categories]
query.request['lntcategories'] = '|'.join(lint_categories)
if pageids:
- if isinstance(pageids, basestring):
+ if isinstance(pageids, UnicodeType):
pageids = pageids.split('|')
pageids = [p.strip() for p in pageids]
# Validate pageids.
@@ -7640,7 +7638,7 @@
'Only "props" is a valid kwarg, not {0}'.format(set(params)
- {'props'})
if isinstance(source, int) or \
- isinstance(source, basestring) and source.isdigit():
+ isinstance(source, UnicodeType) and source.isdigit():
ids = 'q' + str(source)
params = merge_unique_dicts(params, action='wbgetentities',
ids=ids)
diff --git a/pywikibot/specialbots.py b/pywikibot/specialbots.py
index 7ac5315..0576f89 100644
--- a/pywikibot/specialbots.py
+++ b/pywikibot/specialbots.py
@@ -24,14 +24,12 @@
)
from pywikibot.editor import TextEditor
from pywikibot.textlib import replace_links
-from pywikibot.tools import PY2, deprecated, deprecated_args
+from pywikibot.tools import PY2, deprecated, deprecated_args, UnicodeType
from pywikibot.tools.formatter import color_format
if not PY2:
from urllib.parse import urlparse
from urllib.request import URLopener
-
- basestring = (str,)
else:
from urllib import URLopener
from urlparse import urlparse
@@ -101,7 +99,7 @@
raise ValueError('When always is set to True, the description '
'must be set.')
self.url = url
- if isinstance(self.url, basestring):
+ if isinstance(self.url, UnicodeType):
pywikibot.warning('url as string is deprecated. '
'Use an iterable instead.')
self.urlEncoding = urlEncoding
@@ -474,7 +472,7 @@
return
try:
- if isinstance(self.url, basestring):
+ if isinstance(self.url, UnicodeType):
self._treat_counter = 1
return self.upload_file(self.url)
for file_url in self.url:
diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py
index 3335d1d..b0da390 100644
--- a/pywikibot/textlib.py
+++ b/pywikibot/textlib.py
@@ -37,8 +37,6 @@
if not PY2:
from html.parser import HTMLParser
- basestring = (str,)
- unicode = str
else:
from HTMLParser import HTMLParser
from itertools import izip as zip
@@ -318,7 +316,7 @@
dontTouchRegexes = result
for exc in keys:
- if isinstance(exc, basestring):
+ if isinstance(exc, UnicodeType):
# assume the string is a reference to a standard regex above,
# which may not yet have a site specific re compiled.
if exc in _regex_cache:
@@ -380,7 +378,7 @@
@type count: int
"""
# if we got a string, compile it as a regular expression
- if isinstance(old, basestring):
+ if isinstance(old, UnicodeType):
if caseInsensitive:
old = re.compile(old, re.IGNORECASE | re.UNICODE)
else:
@@ -652,7 +650,7 @@
"""Return the link from source when it's a Page otherwise itself."""
if isinstance(source, pywikibot.Page):
return source._link
- elif isinstance(source, basestring):
+ elif isinstance(source, UnicodeType):
return pywikibot.Link(source, site)
else:
return source
@@ -686,7 +684,7 @@
'The original value must be either basestring, Link or Page '
'but is "{0}"'.format(type(replace_list[0])))
if replace_list[1] is not False and replace_list[1] is not None:
- if isinstance(replace_list[1], basestring):
+ if isinstance(replace_list[1], UnicodeType):
replace_list[1] = pywikibot.Page(site, replace_list[1])
check_classes(replace_list[0])
replace = replace_callable
@@ -770,9 +768,10 @@
if new_link is False:
# unlink - we remove the section if there's any
- assert isinstance(new_label, unicode), 'link text must be unicode.'
+ assert isinstance(new_label, UnicodeType), \
+ 'link text must be unicode.'
new_link = new_label
- if isinstance(new_link, unicode):
+ if isinstance(new_link, UnicodeType):
# Nothing good can come out of the fact that bytes is returned so
# force unicode
text = text[:start] + new_link + text[end:]
@@ -1522,7 +1521,7 @@
catLinks = []
for category in categories:
- if isinstance(category, basestring):
+ if isinstance(category, UnicodeType):
category, separator, sortKey = category.strip('[]').partition('|')
sortKey = sortKey if separator else None
# whole word if no ":" is present
@@ -1683,7 +1682,7 @@
params[key] = value
- result.append((unicode(template.name.strip()), params))
+ result.append((UnicodeType(template.name.strip()), params))
return result
@@ -1809,7 +1808,7 @@
param_name, param_val = param.split('=', 1)
implicit_parameter = False
else:
- param_name = unicode(numbered_param)
+ param_name = UnicodeType(numbered_param)
param_val = param
numbered_param += 1
implicit_parameter = True
diff --git a/pywikibot/tools/__init__.py b/pywikibot/tools/__init__.py
index 159395a..b3eca69 100644
--- a/pywikibot/tools/__init__.py
+++ b/pywikibot/tools/__init__.py
@@ -39,8 +39,8 @@
if not PY2:
from itertools import zip_longest
import queue
- StringTypes = basestring = (str,)
- UnicodeType = unicode = str
+ StringTypes = (str, bytes)
+ UnicodeType = str
else:
from itertools import izip_longest as zip_longest
import Queue as queue # noqa: N813
@@ -776,7 +776,7 @@
return '.'.join(str(v) for v in self.version) + self.suffix
def _cmp(self, other):
- if isinstance(other, basestring):
+ if isinstance(other, StringTypes):
other = MediaWikiVersion(other)
if self.version > other.version:
@@ -1369,7 +1369,7 @@
result.update(arg)
if conflicts:
raise ValueError('Multiple dicts contain the same keys: {0}'
- .format(', '.join(sorted(unicode(key)
+ .format(', '.join(sorted(UnicodeType(key)
for key in conflicts))))
return result
@@ -1895,7 +1895,7 @@
@param module: The module name or instance
@type module: str or module
"""
- if isinstance(module, basestring):
+ if isinstance(module, StringTypes):
module = sys.modules[module]
super(ModuleDeprecationWrapper, self).__setattr__('_deprecated', {})
super(ModuleDeprecationWrapper, self).__setattr__('_module', module)
diff --git a/pywikibot/tools/chars.py b/pywikibot/tools/chars.py
index 7b09075..c2422a3 100644
--- a/pywikibot/tools/chars.py
+++ b/pywikibot/tools/chars.py
@@ -9,11 +9,7 @@
import sys
-from pywikibot.tools import LazyRegex, PY2
-
-
-if not PY2:
- unicode = str
+from pywikibot.tools import LazyRegex
# All characters in the Cf category in a static list. When testing each Unicode
diff --git a/pywikibot/userinterfaces/win32_unicode.py b/pywikibot/userinterfaces/win32_unicode.py
index 103c1fa..39002e6 100755
--- a/pywikibot/userinterfaces/win32_unicode.py
+++ b/pywikibot/userinterfaces/win32_unicode.py
@@ -34,13 +34,9 @@
from ctypes import c_void_p as LPVOID
from io import IOBase, UnsupportedOperation
-OSWIN32 = (sys.platform == 'win32')
+from pywikibot.tools import PY2, UnicodeType
-if sys.version_info[0] > 2:
- unicode = str
- PY3 = True
-else:
- PY3 = False
+OSWIN32 = (sys.platform == 'win32')
stdin = sys.stdin
stdout = sys.stdout
@@ -84,7 +80,7 @@
if not result:
raise Exception('stdin failure')
data = self.buffer.value[:numrecv.value]
- if not PY3:
+ if PY2:
return data.encode(self.encoding)
else:
return data
@@ -123,11 +119,11 @@
"""Write the text to the output."""
try:
if self._hConsole is None:
- if not PY3 and isinstance(text, unicode):
+ if PY2 and isinstance(text, UnicodeType):
text = text.encode('utf-8')
self._stream.write(text)
else:
- if not isinstance(text, unicode):
+ if not isinstance(text, UnicodeType):
text = bytes(text).decode('utf-8')
remaining = len(text)
while remaining > 0:
@@ -338,7 +334,7 @@
_complain('exception {!r} while fixing up sys.stdout and sys.stderr'
.format(e))
- if PY3:
+ if not PY2:
# no need to work around issue2128 since it's a Python 2 only issue
return stdin, stdout, stderr, argv
diff --git a/pywikibot/version.py b/pywikibot/version.py
index 426ae08..f1e8437 100644
--- a/pywikibot/version.py
+++ b/pywikibot/version.py
@@ -44,10 +44,7 @@
import pywikibot
from pywikibot import config2 as config
-from pywikibot.tools import deprecated, PY2, PYTHON_VERSION
-
-if not PY2:
- basestring = (str, )
+from pywikibot.tools import deprecated, PY2, PYTHON_VERSION, UnicodeType
cache = None
_logger = 'version'
@@ -140,7 +137,7 @@
pywikibot.debug('version algorithm exceptions:\n%r'
% exceptions, _logger)
- if isinstance(date, basestring):
+ if isinstance(date, UnicodeType):
datestring = date
elif isinstance(date, time.struct_time):
datestring = time.strftime('%Y/%m/%d, %H:%M:%S', date)
diff --git a/scripts/category.py b/scripts/category.py
index 3c0985a..9e7e161 100755
--- a/scripts/category.py
+++ b/scripts/category.py
@@ -143,13 +143,11 @@
)
from pywikibot.cosmetic_changes import moved_links
from pywikibot.tools import (
- deprecated_args, deprecated, ModuleDeprecationWrapper, open_archive, PY2
+ deprecated_args, deprecated, ModuleDeprecationWrapper, open_archive,
+ UnicodeType
)
from pywikibot.tools.formatter import color_format
-if not PY2:
- basestring = (str, )
-
# This is required for the text that is shown when you run this script
# with the parameter -help.
docuReplacements = {'¶ms;': pagegenerators.parameterHelp} # noqa: N816
@@ -627,7 +625,7 @@
'category-removing',
template_vars)
# Set deletion reason for category page and talkpage.
- if isinstance(deletion_comment, basestring):
+ if isinstance(deletion_comment, UnicodeType):
# Deletion comment is set to given string.
self.deletion_comment = deletion_comment
elif deletion_comment == self.DELETION_COMMENT_SAME_AS_EDIT_COMMENT:
diff --git a/scripts/imageharvest.py b/scripts/imageharvest.py
index 196b60d..c437253 100644
--- a/scripts/imageharvest.py
+++ b/scripts/imageharvest.py
@@ -38,8 +38,6 @@
if not PY2:
import urllib
from urllib.request import URLopener
-
- basestring = (str,)
else:
from urllib import URLopener
diff --git a/scripts/interwiki.py b/scripts/interwiki.py
index f5f5f7e..b17d4a2 100755
--- a/scripts/interwiki.py
+++ b/scripts/interwiki.py
@@ -363,12 +363,9 @@
from pywikibot.bot import ListOption, StandardOption
from pywikibot.cosmetic_changes import moved_links
-from pywikibot.tools import first_upper
+from pywikibot.tools import first_upper, UnicodeType
from pywikibot.tools.formatter import color_format
-if sys.version_info[0] > 2:
- unicode = str
-
docuReplacements = {
'¶ms;': pagegenerators.parameterHelp
}
@@ -1249,7 +1246,7 @@
# todo list.
if not page.exists():
- self.conf.remove.append(unicode(page))
+ self.conf.remove.append(UnicodeType(page))
self.conf.note('{} does not exist. Skipping.'.format(page))
if page == self.originPage:
# The page we are working on is the page that does not
@@ -1310,7 +1307,7 @@
# must be behind the page.isRedirectPage() part
# otherwise a redirect error would be raised
elif page_empty_check(page):
- self.conf.remove.append(unicode(page))
+ self.conf.remove.append(UnicodeType(page))
self.conf.note('{} is empty. Skipping.'.format(page))
if page == self.originPage:
for site, count in self.todo.siteCounts():
@@ -1455,7 +1452,7 @@
if page2 is None:
pywikibot.output(' ' * indent + 'Given as a hint.')
else:
- pywikibot.output(' ' * indent + unicode(page2))
+ pywikibot.output(' ' * indent + UnicodeType(page2))
def assemble(self):
"""Assemble language links."""
@@ -1811,7 +1808,7 @@
# put it to new means don't delete it
if (
not self.conf.cleanup
- or unicode(rmPage) not in self.conf.remove
+ or UnicodeType(rmPage) not in self.conf.remove
):
new[rmsite] = rmPage
pywikibot.warning(
@@ -2286,7 +2283,7 @@
if not summary and \
len(adding) + len(removing) + len(modifying) <= 3:
# Use an extended format for the string linking to all added pages.
- fmt = lambda d, site: unicode(d[site]) # noqa: E731
+ fmt = lambda d, site: UnicodeType(d[site]) # noqa: E731
else:
# Use short format, just the language code
fmt = lambda d, site: site.code # noqa: E731
@@ -2488,7 +2485,7 @@
elif len(namespaces) == 1:
ns = namespaces[0]
if ns != 'all':
- if isinstance(ns, unicode) or isinstance(ns, str):
+ if isinstance(ns, UnicodeType) or isinstance(ns, str):
index = site.namespaces.lookup_name(ns)
if index is None:
raise ValueError('Unknown namespace: ' + ns)
diff --git a/scripts/misspelling.py b/scripts/misspelling.py
index 4eafcaa..75bec4e 100755
--- a/scripts/misspelling.py
+++ b/scripts/misspelling.py
@@ -34,13 +34,10 @@
from pywikibot import i18n, pagegenerators
-from pywikibot.tools import PY2
+from pywikibot.tools import UnicodeType
from scripts.solve_disambiguation import DisambiguationRobot
-if not PY2:
- basestring = (str, )
-
HELP_MSG = """\n
misspelling.py does not support site {site}.
@@ -86,7 +83,7 @@
mycode = self.site.code
if mycode in self.misspellingCategory:
categories = self.misspellingCategory[mycode]
- if isinstance(categories, basestring):
+ if isinstance(categories, UnicodeType):
categories = (categories, )
generators = (
pagegenerators.CategorizedPageGenerator(
@@ -95,7 +92,7 @@
for misspellingCategoryTitle in categories)
elif mycode in self.misspellingTemplate:
templates = self.misspellingTemplate[mycode]
- if isinstance(templates, basestring):
+ if isinstance(templates, UnicodeType):
templates = (templates, )
generators = (
pagegenerators.ReferringPageGenerator(
@@ -129,7 +126,7 @@
return True
if self.misspellingTemplate.get(disambPage.site.code) is not None:
templates = self.misspellingTemplate[disambPage.site.code]
- if isinstance(templates, basestring):
+ if isinstance(templates, UnicodeType):
templates = (templates, )
for template, params in disambPage.templatesWithParams():
if template.title(with_ns=False) in templates:
diff --git a/scripts/redirect.py b/scripts/redirect.py
index 8d93480..3109db1 100755
--- a/scripts/redirect.py
+++ b/scripts/redirect.py
@@ -88,10 +88,7 @@
RedirectPageBot)
from pywikibot.exceptions import ArgumentDeprecationWarning
from pywikibot.textlib import extract_templates_and_params_regex_simple
-from pywikibot.tools import issue_deprecation_warning, PY2
-
-if not PY2:
- basestring = (str, )
+from pywikibot.tools import issue_deprecation_warning, UnicodeType
def space_to_underscore(link):
@@ -455,7 +452,7 @@
def init_page(self, item):
"""Ensure that we process page objects."""
- if isinstance(item, basestring):
+ if isinstance(item, UnicodeType):
item = pywikibot.Page(self.site, item)
elif isinstance(item, tuple):
redir_name, code, target, final = item
diff --git a/scripts/replace.py b/scripts/replace.py
index b6a7d63..abdb0d7 100755
--- a/scripts/replace.py
+++ b/scripts/replace.py
@@ -164,13 +164,13 @@
deprecated_args,
issue_deprecation_warning,
PY2,
+ UnicodeType
)
from pywikibot.tools.formatter import color_format
if not PY2:
from queue import Queue
long = int
- basestring = (str, )
else:
from Queue import Queue
@@ -1073,7 +1073,7 @@
'"{0}"'.format(fix_name))
continue
if 'msg' in fix:
- if isinstance(fix['msg'], basestring):
+ if isinstance(fix['msg'], UnicodeType):
set_summary = i18n.twtranslate(site, str(fix['msg']))
else:
set_summary = i18n.translate(site, fix['msg'], fallback=True)
@@ -1081,7 +1081,7 @@
set_summary = None
if not generators_given and 'generator' in fix:
gen_args = fix['generator']
- if isinstance(gen_args, basestring):
+ if isinstance(gen_args, UnicodeType):
gen_args = [gen_args]
for gen_arg in gen_args:
genFactory.handleArg(gen_arg)
diff --git a/scripts/weblinkchecker.py b/scripts/weblinkchecker.py
index f47af6c..b89ecee 100755
--- a/scripts/weblinkchecker.py
+++ b/scripts/weblinkchecker.py
@@ -133,7 +133,7 @@
from pywikibot.pagegenerators import (
XMLDumpPageGenerator as _XMLDumpPageGenerator,
)
-from pywikibot.tools import deprecated, PY2
+from pywikibot.tools import deprecated, PY2, UnicodeType
from pywikibot.tools.formatter import color_format
import requests
@@ -142,9 +142,6 @@
import http.client as httplib
import urllib.parse as urlparse
import urllib.request as urllib
-
- basestring = (str, )
- unicode = str
else:
import httplib
import urllib
@@ -398,9 +395,9 @@
self.query.encode('ascii')
except UnicodeEncodeError:
encoding = self.getEncodingUsedByServer()
- self.path = unicode(urllib.quote(self.path.encode(encoding)))
- self.query = unicode(urllib.quote(self.query.encode(encoding),
- '=&'))
+ self.path = UnicodeType(urllib.quote(self.path.encode(encoding)))
+ self.query = UnicodeType(urllib.quote(self.query.encode(encoding),
+ '=&'))
def resolveRedirect(self, useHEAD=False):
"""
@@ -487,7 +484,7 @@
# wrong or a pair (errno, string) representing an error
# returned by a system call, similar to the value
# accompanying os.error
- if isinstance(error, basestring):
+ if isinstance(error, UnicodeType):
msg = error
else:
try:
diff --git a/tests/djvu_tests.py b/tests/djvu_tests.py
index f4d833a..b2e375f 100644
--- a/tests/djvu_tests.py
+++ b/tests/djvu_tests.py
@@ -14,16 +14,13 @@
import subprocess
from pywikibot.tools.djvu import DjVuFile
-from pywikibot.tools import PY2
+from pywikibot.tools import PY2, UnicodeType
from tests import join_data_path, create_path_func
from tests.aspects import unittest, TestCase
join_djvu_data_path = create_path_func(join_data_path, 'djvu')
-if not PY2:
- unicode = str
-
class TestDjVuFile(TestCase):
@@ -69,7 +66,7 @@
djvu = DjVuFile(self.file_djvu)
expected = "DjVuFile('{}')".format(self.file_djvu)
if PY2:
- self.assertEqual(unicode(djvu), expected)
+ self.assertEqual(UnicodeType(djvu), expected)
else:
self.assertEqual(djvu.__unicode__(), expected)
--
To view, visit https://gerrit.wikimedia.org/r/498727
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib7d1b649576dfb58e8b971b53c96b75961267fb7
Gerrit-Change-Number: 498727
Gerrit-PatchSet: 5
Gerrit-Owner: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: D3r1ck01 <alangiderick(a)gmail.com>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: JJMC89 <JJMC89.Wikimedia(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zhuyifei1999 <zhuyifei1999(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/498722 )
Change subject: [IMPR] Replace PY2 unicode with string in docs and unify across files
......................................................................
[IMPR] Replace PY2 unicode with string in docs and unify across files
Change-Id: Ia66664a2a78425ed6131f8ebe470567257ab1a12
---
M generate_user_files.py
M pywikibot/__init__.py
M pywikibot/bot.py
M pywikibot/comms/http.py
M pywikibot/config2.py
M pywikibot/data/api.py
M pywikibot/data/sparql.py
M pywikibot/echo.py
M pywikibot/editor.py
M pywikibot/family.py
M pywikibot/flow.py
M pywikibot/i18n.py
M pywikibot/page.py
M pywikibot/pagegenerators.py
M pywikibot/proofreadpage.py
M pywikibot/site.py
M pywikibot/specialbots.py
M pywikibot/textlib.py
M pywikibot/tools/__init__.py
M pywikibot/tools/djvu.py
M pywikibot/tools/formatter.py
M pywikibot/tools/ip.py
M pywikibot/userinterfaces/gui.py
M pywikibot/userinterfaces/terminal_interface_base.py
M pywikibot/version.py
M scripts/add_text.py
M scripts/archive/featured.py
M scripts/archivebot.py
M scripts/basic.py
M scripts/blockpageschecker.py
M scripts/capitalize_redirects.py
M scripts/catall.py
M scripts/category.py
M scripts/category_redirect.py
M scripts/cfd.py
M scripts/checkimages.py
M scripts/claimit.py
M scripts/clean_sandbox.py
M scripts/commons_link.py
M scripts/commonscat.py
M scripts/coordinate_import.py
M scripts/cosmetic_changes.py
M scripts/create_categories.py
M scripts/data_ingestion.py
M scripts/delete.py
M scripts/disambredir.py
M scripts/djvutext.py
M scripts/editarticle.py
M scripts/fixing_redirects.py
M scripts/flickrripper.py
M scripts/followlive.py
M scripts/freebasemappingupload.py
M scripts/harvest_template.py
M scripts/illustrate_wikidata.py
M scripts/image.py
M scripts/imagerecat.py
M scripts/imagetransfer.py
M scripts/imageuncat.py
M scripts/interwiki.py
M scripts/interwikidata.py
M scripts/isbn.py
M scripts/listpages.py
M scripts/login.py
M scripts/lonelypages.py
M scripts/maintenance/download_dump.py
M scripts/makecat.py
M scripts/misspelling.py
M scripts/movepages.py
M scripts/ndashredir.py
M scripts/newitem.py
M scripts/noreferences.py
M scripts/nowcommons.py
M scripts/pagefromfile.py
M scripts/piper.py
M scripts/protect.py
M scripts/redirect.py
M scripts/reflinks.py
M scripts/replace.py
M scripts/replicate_wiki.py
M scripts/revertbot.py
M scripts/script_wui.py
M scripts/selflink.py
M scripts/solve_disambiguation.py
M scripts/spamremove.py
M scripts/states_redirect.py
M scripts/surnames_redirects.py
M scripts/table2wiki.py
M scripts/template.py
M scripts/templatecount.py
M scripts/touch.py
M scripts/transferbot.py
M scripts/unlink.py
M scripts/unusedfiles.py
M scripts/upload.py
M scripts/watchlist.py
M scripts/weblinkchecker.py
M scripts/welcome.py
M scripts/wikisourcetext.py
M tests/aspects.py
99 files changed, 267 insertions(+), 265 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/generate_user_files.py b/generate_user_files.py
index 1a40c99..87562fb 100755
--- a/generate_user_files.py
+++ b/generate_user_files.py
@@ -428,7 +428,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
# set the config family and mylang values to an invalid state so that
# the script can detect that the command line arguments -family & -lang
diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index e674046..6918e6f 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -182,7 +182,7 @@
"""Convert an ISO 8601 timestamp to a Timestamp object.
@param ts: ISO 8601 timestamp or a Timestamp object already
- @type ts: str ot Timestamp
+ @type ts: str or Timestamp
@param sep: one-character separator, placed between the date and time
@type sep: str
@return: Timestamp object
@@ -772,7 +772,7 @@
Create a new WbQuantity object.
@param amount: number representing this quantity
- @type amount: string or Decimal. Other types are accepted, and
+ @type amount: str or Decimal. Other types are accepted, and
converted via str to Decimal.
@param unit: the Wikibase item for the unit or the entity URI of this
Wikibase item.
@@ -1164,7 +1164,7 @@
Site helper method.
@param url: The site URL to get code and family
- @type url: string
+ @type url: str
@raises SiteDefinitionError: Unknown URL
"""
if url not in _url_cache:
@@ -1197,19 +1197,19 @@
using the method parameters.
@param code: language code (override config.mylang)
- @type code: string
+ @type code: str
@param fam: family name or object (override config.family)
- @type fam: string or Family
+ @type fam: str or Family
@param user: bot user name to use on this site (override config.usernames)
- @type user: unicode
+ @type user: str
@param sysop: sysop user to use on this site (override config.sysopnames)
- @type sysop: unicode
+ @type sysop: str
@param interface: site class or name of class in pywikibot.site
(override config.site_interface)
@type interface: subclass of L{pywikibot.site.BaseSite} or string
@param url: Instead of code and fam, does try to get a Site based on the
URL. Still requires that the family supporting that URL exists.
- @type url: string
+ @type url: str
@rtype: pywikibot.site.APISite
@raises ValueError: URL and pair of code and family given
@raises ValueError: Invalid interface name
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 0a93d5e..714b842 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -451,7 +451,7 @@
@param question: a string that will be shown to the user. Don't add a
space after the question mark/colon, this method will do this for you.
- @type question: unicode
+ @type question: str
@param password: if True, hides the user's input (for password entry).
@type password: bool
@param default: The default answer if none was entered. None to require
@@ -459,7 +459,7 @@
@type default: basestring
@param force: Automatically use the default
@type force: bool
- @rtype: unicode
+ @rtype: str
"""
# make sure logging system has been initialized
if not _handlers_initialized:
@@ -875,7 +875,7 @@
This is required because the -help option loads the module's docstring
and because the module name will be used for the filename of the log.
- @rtype: unicode
+ @rtype: str
"""
# get commandline arguments
called = pywikibot.argvu[0].strip()
diff --git a/pywikibot/comms/http.py b/pywikibot/comms/http.py
index 569e0b6..fc1a990 100644
--- a/pywikibot/comms/http.py
+++ b/pywikibot/comms/http.py
@@ -191,7 +191,7 @@
str.format. Is using config.user_agent_format when it is None.
@type format_string: basestring
@return: The formatted user agent
- @rtype: unicode
+ @rtype: str
"""
values = USER_AGENT_PRODUCTS.copy()
diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index 2c0b5c6..78afa27 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -313,7 +313,7 @@
directory. Used to test whether placing a user config file in this
directory will cause it to be selected as the base directory.
@type test_directory: str or None
- @rtype: unicode
+ @rtype: str
"""
def exists(directory):
directory = os.path.abspath(directory)
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py
index 9f2843a..8f02ad1 100644
--- a/pywikibot/data/api.py
+++ b/pywikibot/data/api.py
@@ -877,10 +877,10 @@
@type site: APISite
@param module: The module name which is used by paraminfo. (Ignored
when site is None)
- @type module: string
+ @type module: str
@param param: The parameter name inside the module. That parameter must
have a 'type' entry. (Ignored when site is None)
- @type param: string
+ @type param: str
@param dict: The initializing dict which is used for L{from_dict}.
@type dict: dict
"""
@@ -901,10 +901,10 @@
@param site: The associated site
@type site: APISite
@param module: The module name which is used by paraminfo.
- @type module: string
+ @type module: str
@param param: The parameter name inside the module. That parameter must
have a 'type' entry.
- @type param: string
+ @type param: str
@param clear_invalid: Instead of throwing a KeyError, invalid names are
silently removed from the options (disabled by default).
@type clear_invalid: bool
@@ -1389,7 +1389,7 @@
@param value: param value(s)
- @type value: unicode or str in site encoding
+ @type value: str in site encoding
(string types may be a `|`-separated list)
iterable, where items are converted to unicode
with special handling for datetime.datetime to convert it to a
@@ -2159,7 +2159,7 @@
scripts/maintenance/cache.py to support
the new key and all previous keys.
- @rtype: unicode
+ @rtype: str
"""
login_status = self.site._loginstatus
diff --git a/pywikibot/data/sparql.py b/pywikibot/data/sparql.py
index 813987c..11df7c8 100644
--- a/pywikibot/data/sparql.py
+++ b/pywikibot/data/sparql.py
@@ -39,9 +39,9 @@
Create endpoint.
@param endpoint: SPARQL endpoint URL
- @type endpoint: string
+ @type endpoint: str
@param entity_url: URL prefix for any entities returned in a query.
- @type entity_url: string
+ @type entity_url: str
@param repo: The Wikibase site which we want to run queries on. If
provided this overrides any value in endpoint and entity_url.
Defaults to Wikidata.
@@ -105,7 +105,7 @@
https://www.w3.org/TR/2013/REC-sparql11-results-json-20130321/
@param query: Query text
- @type query: string
+ @type query: str
@param full_data: Whether return full data objects or only values
@type full_data: bool
@return: List of query results or None if query failed
@@ -138,7 +138,7 @@
Run SPARQL query and return parsed JSON result.
@param query: Query text
- @type query: string
+ @type query: str
"""
url = '{0}?query={1}'.format(self.endpoint, quote(query))
while True:
@@ -169,7 +169,7 @@
Run SPARQL ASK query and return boolean result.
@param query: Query text
- @type query: string
+ @type query: str
@rtype: bool
"""
data = self.query(query, headers=headers)
diff --git a/pywikibot/echo.py b/pywikibot/echo.py
index 0b4604a..9fb0d33 100644
--- a/pywikibot/echo.py
+++ b/pywikibot/echo.py
@@ -61,7 +61,7 @@
"""
DEPRECATED: Return notification id as unicode.
- @rtype: unicode
+ @rtype: str
"""
return str(self.event_id)
diff --git a/pywikibot/editor.py b/pywikibot/editor.py
index 6bc1b58..51e58d6 100644
--- a/pywikibot/editor.py
+++ b/pywikibot/editor.py
@@ -83,14 +83,14 @@
Halts the thread's operation until the editor is closed.
@param text: the text to be edited
- @type text: unicode
+ @type text: str
@param jumpIndex: position at which to put the caret
@type jumpIndex: int
@param highlight: each occurrence of this substring will be highlighted
- @type highlight: unicode
+ @type highlight: str
@return: the modified text, or None if the user didn't save the text
file in his text editor
- @rtype: unicode or None
+ @rtype: str or None
"""
if config.editor:
handle, tempFilename = tempfile.mkstemp()
diff --git a/pywikibot/family.py b/pywikibot/family.py
index 1b82b8c..5f5c932 100644
--- a/pywikibot/family.py
+++ b/pywikibot/family.py
@@ -1103,9 +1103,9 @@
May be overridden to return 'https'. Other protocols are not supported.
@param code: language code
- @type code: string
+ @type code: str
@return: protocol that this family uses
- @rtype: string
+ @rtype: str
"""
return 'http'
@@ -1114,7 +1114,7 @@
Return whether a HTTPS certificate error should be ignored.
@param code: language code
- @type code: string
+ @type code: str
@return: flag to allow access if certificate has an error.
@rtype: bool
"""
diff --git a/pywikibot/flow.py b/pywikibot/flow.py
index ab32dea..ed2b819 100644
--- a/pywikibot/flow.py
+++ b/pywikibot/flow.py
@@ -42,7 +42,7 @@
@param source: A Flow-enabled site or a Link or Page on such a site
@type source: Site, Link, or Page
@param title: normalized title of the page
- @type title: unicode
+ @type title: str
@raises TypeError: incorrect use of parameters
@raises ValueError: use of non-Flow-enabled Site
@@ -61,7 +61,7 @@
"""Return the UUID of the page.
@return: UUID of the page
- @rtype: unicode
+ @rtype: str
"""
if not hasattr(self, '_uuid'):
self._load_uuid()
@@ -141,11 +141,11 @@
"""Create and return a Topic object for a new topic on this Board.
@param title: The title of the new topic (must be in plaintext)
- @type title: unicode
+ @type title: str
@param content: The content of the topic's initial post
- @type content: unicode
+ @type content: str
@param format: The content format of the value supplied for content
- @type format: unicode (either 'wikitext' or 'html')
+ @type format: str (either 'wikitext' or 'html')
@return: The new topic
@rtype: Topic
"""
@@ -173,11 +173,11 @@
@param board: The topic's parent board
@type board: Board
@param title: The title of the new topic (must be in plaintext)
- @type title: unicode
+ @type title: str
@param content: The content of the topic's initial post
- @type content: unicode
+ @type content: str
@param format: The content format of the value supplied for content
- @type format: unicode (either 'wikitext' or 'html')
+ @type format: str (either 'wikitext' or 'html')
@return: The new topic
@rtype: Topic
"""
@@ -191,7 +191,7 @@
@param board: The topic's parent Flow board
@type board: Board
@param root_uuid: The UUID of the topic and its root post
- @type root_uuid: unicode
+ @type root_uuid: str
@param topiclist_data: The data returned by view-topiclist
@type topiclist_data: dict
@return: A Topic object derived from the supplied data
@@ -242,7 +242,7 @@
"""A convenience method to reply to this topic's root post.
@param content: The content of the new post
- @type content: unicode
+ @type content: str
@param format: The format of the given content
@type format: str ('wikitext' or 'html')
@return: The new reply to this topic's root post
@@ -255,7 +255,7 @@
"""Lock this topic.
@param reason: The reason for locking this topic
- @type reason: unicode
+ @type reason: str
"""
self.site.lock_topic(self, True, reason)
self._reload()
@@ -264,7 +264,7 @@
"""Unlock this topic.
@param reason: The reason for unlocking this topic
- @type reason: unicode
+ @type reason: str
"""
self.site.lock_topic(self, False, reason)
self._reload()
@@ -273,7 +273,7 @@
"""Delete this topic through the Flow moderation system.
@param reason: The reason for deleting this topic.
- @type reason: unicode
+ @type reason: str
"""
self.site.delete_topic(self, reason)
self._reload()
@@ -282,7 +282,7 @@
"""Hide this topic.
@param reason: The reason for hiding this topic.
- @type reason: unicode
+ @type reason: str
"""
self.site.hide_topic(self, reason)
self._reload()
@@ -291,7 +291,7 @@
"""Suppress this topic.
@param reason: The reason for suppressing this topic.
- @type reason: unicode
+ @type reason: str
"""
self.site.suppress_topic(self, reason)
self._reload()
@@ -300,7 +300,7 @@
"""Restore this topic.
@param reason: The reason for restoring this topic.
- @type reason: unicode
+ @type reason: str
"""
self.site.restore_topic(self, reason)
self._reload()
@@ -318,7 +318,7 @@
@param page: Flow topic
@type page: Topic
@param uuid: UUID of a Flow post
- @type uuid: unicode
+ @type uuid: str
@raises TypeError: incorrect types of parameters
"""
@@ -342,7 +342,7 @@
@param page: A Flow topic
@type page: Topic
@param post_uuid: The UUID of the post
- @type post_uuid: unicode
+ @type post_uuid: str
@param data: The JSON data returned from the API
@type data: dict
@@ -397,7 +397,7 @@
"""Return the UUID of the post.
@return: UUID of the post
- @rtype: unicode
+ @rtype: str
"""
return self._uuid
@@ -444,9 +444,9 @@
@param sysop: Whether to load using sysop rights. Implies force.
@type sysop: bool
@param format: Content format to return contents in
- @type format: unicode
+ @type format: str
@return: The contents of the post in the given content format
- @rtype: unicode
+ @rtype: str
@raises NotImplementedError: use of 'sysop'
"""
if sysop:
@@ -486,7 +486,7 @@
"""Reply to this post.
@param content: The content of the new post
- @type content: unicode
+ @type content: str
@param format: The format of the given content
@type format: str ('wikitext' or 'html')
@return: The new reply post
@@ -512,7 +512,7 @@
"""Delete this post through the Flow moderation system.
@param reason: The reason for deleting this post.
- @type reason: unicode
+ @type reason: str
"""
self.site.delete_post(self, reason)
self._load()
@@ -521,7 +521,7 @@
"""Hide this post.
@param reason: The reason for hiding this post.
- @type reason: unicode
+ @type reason: str
"""
self.site.hide_post(self, reason)
self._load()
@@ -530,7 +530,7 @@
"""Suppress this post.
@param reason: The reason for suppressing this post.
- @type reason: unicode
+ @type reason: str
"""
self.site.suppress_post(self, reason)
self._load()
@@ -539,7 +539,7 @@
"""Restore this post.
@param reason: The reason for restoring this post.
- @type reason: unicode
+ @type reason: str
"""
self.site.restore_post(self, reason)
self._load()
diff --git a/pywikibot/i18n.py b/pywikibot/i18n.py
index 4000a51..cae0b61 100644
--- a/pywikibot/i18n.py
+++ b/pywikibot/i18n.py
@@ -408,7 +408,7 @@
This code is used by other translating methods below.
@param lang: The language code
- @type lang: string
+ @type lang: str
@return: language codes
@rtype: list of str
"""
@@ -455,7 +455,7 @@
"""Check for the plural variants in message and replace them.
@param message: the message to be replaced
- @type message: unicode string
+ @type message: str string
@param parameters: plural parameters passed from other methods
@type parameters: Mapping of str to int
@return: The message with the plural instances replaced
@@ -574,7 +574,7 @@
For PLURAL support have a look at the twtranslate method.
@param code: The language code
- @type code: string or Site object
+ @type code: str or Site object
@param xdict: dictionary with language codes as keys or extended dictionary
with family names as keys containing language dictionaries or
a single (unicode) string. May contain PLURAL tags as
@@ -854,7 +854,7 @@
@param parameters: The values which will be applied to the translated text
@param password: Hides the user's input (for password entry)
@param fallback_prompt: The English prompt if i18n is not available.
- @rtype: unicode string
+ @rtype: str string
"""
if not messages_available():
if not fallback_prompt:
diff --git a/pywikibot/page.py b/pywikibot/page.py
index a07bf9c..84470f4 100644
--- a/pywikibot/page.py
+++ b/pywikibot/page.py
@@ -183,7 +183,7 @@
@type source: Link, Page (or subclass), or Site
@param title: normalized title of the page; required if source is a
Site, ignored otherwise
- @type title: unicode
+ @type title: str
@param ns: namespace number; required if source is a Site, ignored
otherwise
@type ns: int
@@ -319,7 +319,7 @@
-family and -lang option i.e. config.family and config.mylang
@param without_brackets: (cannot be used with as_link) if true, remove
the last pair of brackets(usually removes disambiguation brackets).
- @rtype: unicode
+ @rtype: str
"""
title = self._link.canonical_title()
label = self._link.title
@@ -382,7 +382,7 @@
The section is the part of the title following a '#' character, if
any. If no section is present, return None.
- @rtype: unicode
+ @rtype: str
"""
return self._link.section
@@ -473,7 +473,7 @@
@param sysop: if the user has a sysop account, use it to
retrieve this page
- @rtype: unicode
+ @rtype: str
"""
if force:
del self.latest_revision_id
@@ -525,7 +525,7 @@
Return text of an old revision of this page; same options as get().
@param oldid: The revid of the revision desired.
- @rtype: unicode
+ @rtype: str
"""
if force or oldid not in self._revisions \
or self._revisions[oldid].text is None:
@@ -544,7 +544,7 @@
without title uncoded.
@param with_protocol: if true, http or https prefixes will be
included before the double slash.
- @rtype: unicode
+ @rtype: str
"""
if percent_encoded:
title = self.title(as_url=True)
@@ -619,7 +619,7 @@
Return the current (edited) wikitext, loading it if necessary.
@return: text of the page
- @rtype: unicode
+ @rtype: str
"""
if not hasattr(self, '_text') or self._text is None:
try:
@@ -660,7 +660,7 @@
Application: on Wikisource wikis, text can be preloaded even if
a page does not exist, if an Index page is present.
- @rtype: unicode
+ @rtype: str
"""
self.site.loadpageinfo(self, preload=True)
return self._preloadedtext
@@ -691,7 +691,7 @@
@param force: force updating from the live site
- @rtype: unicode or None
+ @rtype: str or None
"""
return self.properties(force=force).get('defaultsort')
@@ -721,7 +721,7 @@
"""
Return name or IP address of last user to edit page.
- @rtype: unicode
+ @rtype: str
"""
return self.latest_revision.user
@@ -744,7 +744,7 @@
i.e. which is not returned by Site.botusers(), it will be returned
as a non-bot edit.
- @rtype: unicode
+ @rtype: str
"""
if hasattr(self, '_lastNonBotUser'):
return self._lastNonBotUser
@@ -1232,7 +1232,7 @@
@param summary: The edit summary for the modification (optional, but
most wikis strongly encourage its use)
- @type summary: unicode
+ @type summary: str
@param watch: Specify how the watchlist is affected by this edit, set
to one of "watch", "unwatch", "preferences", "nochange":
* watch: add the page to the watchlist
@@ -1244,7 +1244,7 @@
For backward compatibility watch parameter may also be boolean:
if True, add or if False, remove this Page to/from bot
user's watchlist.
- @type watch: string, bool (deprecated) or None
+ @type watch: str, bool (deprecated) or None
@param minor: if True, mark this edit as minor
@type minor: bool
@param botflag: if True, mark this edit as made by a bot (default:
@@ -1353,7 +1353,7 @@
docs for all parameters not listed here.
@param newtext: The complete text of the revised page.
- @type newtext: unicode
+ @type newtext: str
"""
self.text = newtext
self.save(summary=summary, watch=watch, minor=minor, botflag=botflag,
@@ -2511,7 +2511,7 @@
@param url_height: see iiurlheigth in [1]
@param url_param: see iiurlparam in [1]
@return: latest file url or thumburl
- @rtype: unicode
+ @rtype: str
"""
# Plain url is requested.
if url_width is None and url_height is None and url_param is None:
@@ -2976,11 +2976,11 @@
Copy text of category page to a new page. Does not move contents.
@param cat: New category title (without namespace) or Category object
- @type cat: unicode or Category
+ @type cat: str or Category
@param message: message to use for category creation message
If two %s are provided in message, will be replaced
by (self.title, authorsList)
- @type message: unicode
+ @type message: str
@return: True if copying was successful, False if target page
already existed.
@rtype: bool
@@ -3203,7 +3203,7 @@
DEPRECATED: use username instead.
- @rtype: unicode
+ @rtype: str
"""
return self.username
@@ -3215,7 +3215,7 @@
Convenience method that returns the title of the page with
namespace prefix omitted, which is the username.
- @rtype: unicode
+ @rtype: str
"""
if self._isAutoblock:
return '#' + self.title(with_ns=False)
@@ -3376,7 +3376,7 @@
@param subpage: subpage part to be appended to the main
page title (optional)
- @type subpage: unicode
+ @type subpage: str
@return: Page object of user page or user subpage
@rtype: Page
"""
@@ -3395,7 +3395,7 @@
@param subpage: subpage part to be appended to the main
talk page title (optional)
- @type subpage: unicode
+ @type subpage: str
@return: Page object of user talk page or user talk subpage
@rtype: Page
"""
@@ -3414,9 +3414,9 @@
Send an email to this user via MediaWiki's email interface.
@param subject: the subject header of the mail
- @type subject: unicode
+ @type subject: str
@param text: mail body
- @type text: unicode
+ @type text: str
@param ccme: if True, sends a copy of this email to the bot
@type ccme: bool
@raises NotEmailableError: the user of this User is not emailable
@@ -3455,9 +3455,9 @@
Outputs 'Email sent' if the email was sent.
@param subject: the subject header of the mail
- @type subject: unicode
+ @type subject: str
@param text: mail body
- @type text: unicode
+ @type text: str
@param ccme: if True, sends a copy of this email to the bot
@type ccme: bool
@raises NotEmailableError: the user of this User is not emailable
@@ -3672,7 +3672,7 @@
@param site: Wikibase data site
@type site: DataSite
@param title: normalized title of the page
- @type title: unicode
+ @type title: str
@kwarg ns: namespace
@type ns: Namespace instance, or int
@kwarg entity_type: Wikibase entity type
@@ -4532,7 +4532,7 @@
@type site: pywikibot.Site or database name
@param force: override caching
- @rtype: unicode
+ @rtype: str
"""
if force or not hasattr(self, '_content'):
self.get(force=force)
@@ -5076,7 +5076,7 @@
Return the type of snak.
@return: str ('value', 'somevalue' or 'novalue')
- @rtype: unicode
+ @rtype: str
"""
return self.snaktype
@@ -5339,25 +5339,25 @@
@param revid: Revision id number
@type revid: int
@param text: Revision wikitext.
- @type text: unicode, or None if text not yet retrieved
+ @type text: str, or None if text not yet retrieved
@param timestamp: Revision time stamp
@type timestamp: pywikibot.Timestamp
@param user: user who edited this revision
- @type user: unicode
+ @type user: str
@param anon: user is unregistered
@type anon: bool
@param comment: edit comment text
- @type comment: unicode
+ @type comment: str
@param minor: edit flagged as minor
@type minor: bool
@param rollbacktoken: rollback token
- @type rollbacktoken: unicode
+ @type rollbacktoken: str
@param parentid: id of parent Revision (v1.16+)
@type parentid: long
@param contentmodel: content model label (v1.21+)
- @type contentmodel: unicode
+ @type contentmodel: str
@param sha1: sha1 of revision text (v1.19+)
- @type sha1: unicode
+ @type sha1: str
"""
self.revid = revid
self.text = text
@@ -5512,7 +5512,7 @@
@param text: the link text (everything appearing between [[ and ]]
on a wiki page)
- @type text: unicode
+ @type text: str
@param source: the Site on which the link was found (not necessarily
the site to which the link refers)
@type source: Site or BasePage
@@ -5771,7 +5771,7 @@
"""
Return the title of the link.
- @rtype: unicode
+ @rtype: str
"""
if not hasattr(self, '_title'):
self.parse()
@@ -5782,7 +5782,7 @@
"""
Return the section of the link.
- @rtype: unicode
+ @rtype: str
"""
if not hasattr(self, '_section'):
self.parse()
@@ -5793,7 +5793,7 @@
"""
Return the anchor of the link.
- @rtype: unicode
+ @rtype: str
"""
if not hasattr(self, '_anchor'):
self.parse()
@@ -5887,7 +5887,7 @@
"""
Return a unicode string representation.
- @rtype: unicode
+ @rtype: str
"""
return self.astext()
@@ -5929,7 +5929,7 @@
@param lang: target site code (language)
@type lang: str
@param title: target Page
- @type title: unicode
+ @type title: str
@param source: Link from site source
@param source: Site
@@ -6039,7 +6039,7 @@
@param ignore: HTML entities to ignore
@param ignore: list of int
- @rtype: unicode
+ @rtype: str
"""
if ignore is None:
ignore = []
@@ -6101,7 +6101,7 @@
into HTML &#; entities. If it does work, return it unchanged.
@param x: String to update
- @type x: unicode
+ @type x: str
@param encoding: Encoding to use
@type encoding: str
@@ -6125,7 +6125,7 @@
@type title: str
@param encodings: Encodings to attempt to use during conversion.
@type encodings: str, list or Site
- @rtype: unicode
+ @rtype: str
@raise UnicodeError: Could not convert using any encoding.
"""
diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py
index b2e9ab3..3a13383 100644
--- a/pywikibot/pagegenerators.py
+++ b/pywikibot/pagegenerators.py
@@ -1607,7 +1607,7 @@
@param filename: the name of the file that should be read. If no name is
given, the generator prompts the user.
- @type filename: unicode
+ @type filename: str
@param site: Site for generator results.
@type site: L{pywikibot.site.BaseSite}
@@ -1933,7 +1933,7 @@
'all' - yields page if title is matched by all regexes
'any' - yields page if title is matched by any regexes
'none' - yields page if title is NOT matched by any regexes
- @type quantifier: string of ('all', 'any', 'none')
+ @type quantifier: str of ('all', 'any', 'none')
@param ignore_namespace: ignore the namespace when matching the title
@type ignore_namespace: bool
@return: return a page depending on the matching parameters
@@ -2951,9 +2951,9 @@
@param site: Site for generator results.
@type site: L{pywikibot.site.BaseSite}
@param endpoint: SPARQL endpoint URL
- @type endpoint: string
+ @type endpoint: str
@param entity_url: URL prefix for any entities returned in a query.
- @type entity_url: string
+ @type entity_url: str
@param result_type: type of the iterable in which
SPARQL results are stored (default set)
@type result_type: iterable
diff --git a/pywikibot/proofreadpage.py b/pywikibot/proofreadpage.py
index f3719d0..d05f932 100644
--- a/pywikibot/proofreadpage.py
+++ b/pywikibot/proofreadpage.py
@@ -988,7 +988,7 @@
@param page: Page instance
@return: page label
- @rtype: unicode string
+ @rtype: str string
"""
try:
return self._labels_from_page[page]
@@ -1003,7 +1003,7 @@
@param page_number: int
@return: page label
- @rtype: unicode string
+ @rtype: str string
"""
try:
return self._labels_from_page_number[page_number]
diff --git a/pywikibot/site.py b/pywikibot/site.py
index 99af4e7..61a151d 100644
--- a/pywikibot/site.py
+++ b/pywikibot/site.py
@@ -214,7 +214,7 @@
"""Initializer.
@param custom_name: Name defined in server LocalSettings.php
- @type custom_name: unicode
+ @type custom_name: str
@param canonical_name: Canonical name
@type canonical_name: str
@param aliases: Aliases
@@ -1000,7 +1000,7 @@
Return the Namespace for a given namespace name.
@param namespace: name
- @type namespace: unicode
+ @type namespace: str
@return: The matching Namespace object on this Site
@rtype: Namespace, or None if invalid
"""
@@ -1027,7 +1027,7 @@
Return canonical local form of namespace name.
@param value: A namespace name
- @type value: unicode
+ @type value: str
"""
index = self.namespaces.lookup_name(value)
@@ -1126,11 +1126,11 @@
"""DEPRECATED. Return a wikilink to a page.
@param title: Title of the page to link to
- @type title: unicode
+ @type title: str
@param othersite: Generate a interwiki link for use on this site.
@type othersite: BaseSite or None
- @rtype: unicode
+ @rtype: str
"""
return pywikibot.Link(title, self).astext(othersite)
@@ -1361,7 +1361,7 @@
"""Decorator to require a certain MediaWiki extension.
@param extension: the MediaWiki extension required
- @type extension: unicode
+ @type extension: str
@return: a decorator to make sure the requirement is satisfied when
the decorated function is called.
"""
@@ -2483,7 +2483,7 @@
@param args: text to be expanded
@type args: typing.Iterable[unicode]
- @rtype: unicode
+ @rtype: str
"""
needed_mw_messages = ('and', 'comma-separator', 'word-separator')
if not args:
@@ -2521,12 +2521,12 @@
magic parser words like {{CURRENTTIMESTAMP}}.
@param text: text to be expanded
- @type text: unicode
+ @type text: str
@param title: page title without section
- @type title: unicode
+ @type title: str
@param includecomments: if True do not strip comments
@type includecomments: bool
- @rtype: unicode
+ @rtype: str
"""
if not isinstance(text, basestring):
raise ValueError('text must be a string')
@@ -3902,7 +3902,8 @@
@param member_type: member type; if member_type includes 'page' and is
used in conjunction with sortby="timestamp", the API may limit
results to only pages in the first 50 namespaces.
- @type member_type: str or iterable of str; values: page, subcat, file
+ @type member_type: str or iterable of str;
+ values: page, subcat, file
@raises KeyError: a namespace identifier was not resolved
@raises NotImplementedError: startprefix or endprefix parameters are
@@ -4823,7 +4824,7 @@
@see: U{https://www.mediawiki.org/wiki/API:Search}
@param searchstring: the text to search for
- @type searchstring: unicode
+ @type searchstring: str
@param where: Where to search; value must be "text", "title" or
"nearmatch" (many wikis do not support title or nearmatch search)
@param namespaces: search only in these namespaces (defaults to all)
@@ -5183,14 +5184,14 @@
* nochange: don't change the watchlist
@param bot: if True, mark edit with bot flag
@kwarg text: Overrides Page.text
- @type text: unicode
+ @type text: str
@kwarg section: Edit an existing numbered section or
a new section ('new')
@type section: int or str
@kwarg prependtext: Prepend text. Overrides Page.text
- @type text: unicode
+ @type text: str
@kwarg appendtext: Append text. Overrides Page.text.
- @type text: unicode
+ @type text: str
@kwarg undo: Revision id to undo. Overrides Page.text
@type undo: int
@return: True if edit succeeded, False if it failed
@@ -5501,7 +5502,7 @@
@param page: the Page to be moved (must exist)
@param newtitle: the new title for the Page
- @type newtitle: unicode
+ @type newtitle: str
@param summary: edit summary (required!)
@param movetalk: if True (default), also move the talk page if possible
@param noredirect: if True, suppress creation of a redirect from the
@@ -7178,9 +7179,9 @@
@param page: A Flow topic
@type page: Topic
@param post_id: The UUID of the Post
- @type post_id: unicode
+ @type post_id: str
@param format: The content format used for the returned content
- @type format: unicode (either 'wikitext', 'html', or 'fixed-html')
+ @type format: str (either 'wikitext', 'html', or 'fixed-html')
@return: A dict representing the post data for the given UUID.
@rtype: dict
"""
@@ -7199,11 +7200,11 @@
@param page: A Flow board
@type page: Board
@param title: The title of the new topic (must be in plaintext)
- @type title: unicode
+ @type title: str
@param content: The content of the topic's initial post
- @type content: unicode
+ @type content: str
@param format: The content format of the value supplied for content
- @type format: unicode (either 'wikitext' or 'html')
+ @type format: str (either 'wikitext' or 'html')
@return: The metadata of the new topic
@rtype: dict
"""
@@ -7223,11 +7224,11 @@
@param page: A Flow topic
@type page: Topic
@param reply_to_uuid: The UUID of the Post to create a reply to
- @type reply_to_uuid: unicode
+ @type reply_to_uuid: str
@param content: The content of the reply
- @type content: unicode
+ @type content: str
@param format: The content format used for the supplied content
- @type format: unicode (either 'wikitext' or 'html')
+ @type format: str (either 'wikitext' or 'html')
@return: Metadata returned by the API
@rtype: dict
"""
@@ -7250,7 +7251,7 @@
@param lock: Whether to lock or unlock the topic
@type lock: bool (True corresponds to locking the topic.)
@param reason: The reason to lock or unlock the topic
- @type reason: unicode
+ @type reason: str
@return: Metadata returned by the API
@rtype: dict
"""
@@ -7274,7 +7275,7 @@
@param state: The new moderation state
@type state: str
@param reason: The reason to moderate the topic
- @type reason: unicode
+ @type reason: str
@return: Metadata returned by the API
@rtype: dict
"""
@@ -7295,7 +7296,7 @@
@param page: A Flow topic
@type page: Topic
@param reason: The reason to delete the topic
- @type reason: unicode
+ @type reason: str
@return: Metadata returned by the API
@rtype: dict
"""
@@ -7310,7 +7311,7 @@
@param page: A Flow topic
@type page: Topic
@param reason: The reason to hide the topic
- @type reason: unicode
+ @type reason: str
@return: Metadata returned by the API
@rtype: dict
"""
@@ -7325,7 +7326,7 @@
@param page: A Flow topic
@type page: Topic
@param reason: The reason to suppress the topic
- @type reason: unicode
+ @type reason: str
@return: Metadata returned by the API
@rtype: dict
"""
@@ -7340,7 +7341,7 @@
@param page: A Flow topic
@type page: Topic
@param reason: The reason to restore the topic
- @type reason: unicode
+ @type reason: str
@return: Metadata returned by the API
@rtype: dict
"""
@@ -7357,7 +7358,7 @@
@param state: The new moderation state
@type state: str
@param reason: The reason to moderate the topic
- @type reason: unicode
+ @type reason: str
@return: Metadata returned by the API
@rtype: dict
"""
@@ -7380,7 +7381,7 @@
@param post: A Flow post
@type post: Post
@param reason: The reason to delete the post
- @type reason: unicode
+ @type reason: str
@return: Metadata returned by the API
@rtype: dict
"""
@@ -7395,7 +7396,7 @@
@param post: A Flow post
@type post: Post
@param reason: The reason to hide the post
- @type reason: unicode
+ @type reason: str
@return: Metadata returned by the API
@rtype: dict
"""
@@ -7410,7 +7411,7 @@
@param post: A Flow post
@type post: Post
@param reason: The reason to suppress the post
- @type reason: unicode
+ @type reason: str
@return: Metadata returned by the API
@rtype: dict
"""
@@ -7425,7 +7426,7 @@
@param post: A Flow post
@type post: Post
@param reason: The reason to restore the post
- @type reason: unicode
+ @type reason: str
@return: Metadata returned by the API
@rtype: dict
"""
diff --git a/pywikibot/specialbots.py b/pywikibot/specialbots.py
index 7ac5315..6adfcdb 100644
--- a/pywikibot/specialbots.py
+++ b/pywikibot/specialbots.py
@@ -51,19 +51,19 @@
@param url: path to url or local file (deprecated), or list of urls or
paths to local files.
- @type url: string (deprecated) or list
+ @type url: str (deprecated) or list
@param description: Description of file for its page. If multiple files
are uploading the same description is used for every file.
- @type description: string
+ @type description: str
@param useFilename: Specify title of the file's page. If multiple
files are uploading it asks to change the name for second, third,
etc. files, otherwise the last file will overwrite the other.
- @type useFilename: string
+ @type useFilename: str
@param keepFilename: Set to True to keep original names of urls and
files, otherwise it will ask to enter a name for each file.
@type keepFilename: bool
@param summary: Summary of the upload
- @type summary: string
+ @type summary: str
@param verifyDescription: Set to True to proofread the description.
@type verifyDescription: bool
@param ignoreWarning: Set this to True to upload even if another file
@@ -82,7 +82,7 @@
@type chunk_size: integer
@param filename_prefix: Specify prefix for the title of every
file's page.
- @type filename_prefix: string
+ @type filename_prefix: str
@param always: Disables any input, requires that either ignoreWarning
or aborts are set to True and that the description is also set. It
overwrites verifyDescription to False and keepFilename to True.
@@ -390,7 +390,7 @@
Determine if the warning message should be ignored.
@param warn_code: The warning message
- @type warn_code: string
+ @type warn_code: str
"""
if self.ignoreWarning is True:
return True
diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py
index 3335d1d..bc982f4 100644
--- a/pywikibot/textlib.py
+++ b/pywikibot/textlib.py
@@ -164,7 +164,7 @@
@param phrase: The phrase to convert to localized numerical
@param lang: language code
@return: The localized version
- @rtype: unicode
+ @rtype: str
"""
digits = NON_LATIN_DIGITS.get(lang)
if not digits:
@@ -364,7 +364,7 @@
regex matching. If allowoverlap is true, overlapping occurrences are all
replaced (watch out when using this, it might lead to infinite loops!).
- @type text: unicode
+ @type text: str
@param old: a compiled or uncompiled regular expression
@param new: a unicode string (which can contain regular
expression references), or a function which takes
@@ -1208,7 +1208,7 @@
@type insite: BaseSite
@return: string including wiki links formatted for inclusion
in insite
- @rtype: unicode
+ @rtype: str
"""
if insite is None:
insite = pywikibot.Site()
@@ -1362,7 +1362,7 @@
@param add_only: If add_only is True, the old category won't
be replaced and the category given will be added after it.
@return: the modified text
- @rtype: unicode
+ @rtype: str
"""
if site is None:
site = pywikibot.Site()
@@ -1616,7 +1616,7 @@
To replicate that behaviour, enable both remove_disabled_parts and strip.
@param text: The wikitext from which templates are extracted
- @type text: unicode or string
+ @type text: str
@param remove_disabled_parts: Remove disabled wikitext such as comments
and pre. If None (default), this is enabled when mwparserfromhell
is not available or is disabled in the config, and disabled if
@@ -1660,7 +1660,7 @@
config.mwparserfromhell.
@param text: The wikitext from which templates are extracted
- @type text: unicode or string
+ @type text: str
@return: list of template name and params
@rtype: list of tuple
"""
@@ -1699,7 +1699,7 @@
is not used.
@param text: The wikitext from which templates are extracted
- @type text: unicode or string
+ @type text: str
@return: list of template name and params
@rtype: list of tuple
"""
@@ -1855,7 +1855,7 @@
argument value contains a '|', such as {{template|a={{b|c}} }}.
@param text: The wikitext from which templates are extracted
- @type text: unicode or string
+ @type text: str
@return: list of template name and params
@rtype: list of tuple of name and OrderedDict
"""
@@ -2016,9 +2016,9 @@
text link e.g. for categories and files.
@param pagetext: The wikitext of a page
- @type pagetext: unicode or string
+ @type pagetext: str
@param section: a section of a page including wikitext markups
- @type section: unicode or string
+ @type section: str
"""
# match preceding colon for text links
diff --git a/pywikibot/tools/__init__.py b/pywikibot/tools/__init__.py
index 159395a..425052f 100644
--- a/pywikibot/tools/__init__.py
+++ b/pywikibot/tools/__init__.py
@@ -1272,7 +1272,7 @@
@param mode: The mode in which the file should be opened. It may either be
'r', 'rb', 'a', 'ab', 'w' or 'wb'. All modes open the file in binary
mode. It defaults to 'rb'.
- @type mode: string
+ @type mode: str
@raises ValueError: When 7za is not available or the opening mode is
unknown or it tries to write a 7z archive.
@raises FileNotFoundError: When the filename doesn't exist and it tries
@@ -1590,10 +1590,10 @@
"""Decorator to output a deprecation warning.
@kwarg instead: if provided, will be used to specify the replacement
- @type instead: string
+ @type instead: str
@kwarg since: a timestamp string of the date when the method was
deprecated (form 'YYYYMMDD') or a version string.
- @type since: string
+ @type since: str
"""
def decorator(obj):
"""Outer wrapper.
diff --git a/pywikibot/tools/djvu.py b/pywikibot/tools/djvu.py
index 8f3e48b..b0507d5 100644
--- a/pywikibot/tools/djvu.py
+++ b/pywikibot/tools/djvu.py
@@ -30,7 +30,7 @@
@type args: typing.Sequence[string]
@param library: library to be logged in logging messages
- @type library: string
+ @type library: str
@param log: log process output; errors are always logged.
@type library: bool
@@ -77,7 +77,7 @@
Initializer.
@param file: filename (including path) to djvu file
- @type file: string/unicode
+ @type file: str
"""
self._filename = file
filename = os.path.expanduser(file)
diff --git a/pywikibot/tools/formatter.py b/pywikibot/tools/formatter.py
index f896494..ec90afa 100644
--- a/pywikibot/tools/formatter.py
+++ b/pywikibot/tools/formatter.py
@@ -115,7 +115,7 @@
is no literal text around it or when the field value is not a `unicode`
already.
- @rtype: unicode
+ @rtype: str
"""
result = super(_ColorFormatter, self)._vformat(*args, **kwargs)
if isinstance(result, tuple):
@@ -142,13 +142,13 @@
Return the normal format result but verify no colors are keywords.
@param format_string: The format template string
- @type format_string: unicode
+ @type format_string: str
@param args: The positional field values
@type args: typing.Sequence
@param kwargs: The named field values
@type kwargs: dict
@return: The formatted string
- @rtype: unicode
+ @rtype: str
"""
if self.colors.intersection(kwargs): # kwargs use colors
raise ValueError('Keyword argument(s) use valid color(s): '
@@ -171,8 +171,8 @@
parameter color.
@param text: The format template string
- @type text: unicode
+ @type text: str
@return: The formatted string
- @rtype: unicode
+ @rtype: str
"""
return _ColorFormatter().format(text, *args, **kwargs)
diff --git a/pywikibot/tools/ip.py b/pywikibot/tools/ip.py
index dd9b6fb..5a9ea2f 100644
--- a/pywikibot/tools/ip.py
+++ b/pywikibot/tools/ip.py
@@ -97,7 +97,7 @@
No logging is performed. Use ip_address instead to catch errors.
@param IP: IP address
- @type IP: unicode
+ @type IP: str
@rtype: bool
"""
try:
diff --git a/pywikibot/userinterfaces/gui.py b/pywikibot/userinterfaces/gui.py
index 5ca4ff3..04c256c 100644
--- a/pywikibot/userinterfaces/gui.py
+++ b/pywikibot/userinterfaces/gui.py
@@ -364,14 +364,14 @@
Provide user with editor to modify text.
@param text: the text to be edited
- @type text: unicode
+ @type text: str
@param jumpIndex: position at which to put the caret
@type jumpIndex: int
@param highlight: each occurrence of this substring will be highlighted
- @type highlight: unicode
+ @type highlight: str
@return: the modified text, or None if the user didn't save the text
file in his text editor
- @rtype: unicode or None
+ @rtype: str or None
"""
self.text = None
# put given text into our textarea
diff --git a/pywikibot/userinterfaces/terminal_interface_base.py b/pywikibot/userinterfaces/terminal_interface_base.py
index e94cf75..98e0b5c 100755
--- a/pywikibot/userinterfaces/terminal_interface_base.py
+++ b/pywikibot/userinterfaces/terminal_interface_base.py
@@ -268,7 +268,7 @@
@type default: basestring
@param force: Automatically use the default
@type force: bool
- @rtype: unicode
+ @rtype: str
"""
assert(not password or not default)
end_marker = ':'
@@ -442,14 +442,14 @@
Uses a Tkinter edit box because we don't have a console editor
@param text: the text to be edited
- @type text: unicode
+ @type text: str
@param jumpIndex: position at which to put the caret
@type jumpIndex: int
@param highlight: each occurrence of this substring will be highlighted
- @type highlight: unicode
+ @type highlight: str
@return: the modified text, or None if the user didn't save the text
file in his text editor
- @rtype: unicode or None
+ @rtype: str or None
"""
try:
from pywikibot.userinterfaces import gui
diff --git a/pywikibot/version.py b/pywikibot/version.py
index 426ae08..e8150e9 100644
--- a/pywikibot/version.py
+++ b/pywikibot/version.py
@@ -414,7 +414,7 @@
returned. Because it doesn't import it, the version can
be retrieved from any file.
@param filename: Name of the file to get version
- @type filename: string
+ @type filename: str
"""
_program_dir = _get_program_dir()
__version__ = None
diff --git a/scripts/add_text.py b/scripts/add_text.py
index f83fa9b..61b0ff2 100755
--- a/scripts/add_text.py
+++ b/scripts/add_text.py
@@ -239,7 +239,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
# If none, the var is set only for check purpose.
summary = None
diff --git a/scripts/archive/featured.py b/scripts/archive/featured.py
index 1a4fa9a..25c8165 100755
--- a/scripts/archive/featured.py
+++ b/scripts/archive/featured.py
@@ -616,7 +616,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
options = {}
local_args = pywikibot.handle_args(args)
diff --git a/scripts/archivebot.py b/scripts/archivebot.py
index 4875cbe..a44398e 100755
--- a/scripts/archivebot.py
+++ b/scripts/archivebot.py
@@ -381,7 +381,7 @@
Check whether thread has to be archived.
@return: archiving reason i18n string or empty string.
- @rtype: string
+ @rtype: str
"""
algo = archiver.get_attr('algo')
re_t = re.search(r'^old\((.*)\)$', algo)
@@ -705,7 +705,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
filename = None
pagename = None
diff --git a/scripts/basic.py b/scripts/basic.py
index 5ca622d..73f2c2c 100755
--- a/scripts/basic.py
+++ b/scripts/basic.py
@@ -127,7 +127,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
options = {}
# Process global arguments to determine desired site
diff --git a/scripts/blockpageschecker.py b/scripts/blockpageschecker.py
index a6b0999..035fea8 100755
--- a/scripts/blockpageschecker.py
+++ b/scripts/blockpageschecker.py
@@ -221,7 +221,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
# Loading the comments
global categoryToCheck, project_inserted
diff --git a/scripts/capitalize_redirects.py b/scripts/capitalize_redirects.py
index 6291cce..b1a42ba 100755
--- a/scripts/capitalize_redirects.py
+++ b/scripts/capitalize_redirects.py
@@ -91,7 +91,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
options = {}
diff --git a/scripts/catall.py b/scripts/catall.py
index 3903edb..b019976 100755
--- a/scripts/catall.py
+++ b/scripts/catall.py
@@ -88,7 +88,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
docorrections = True
start = 'A'
diff --git a/scripts/category.py b/scripts/category.py
index 3c0985a..949dffc 100755
--- a/scripts/category.py
+++ b/scripts/category.py
@@ -1334,7 +1334,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments.
- @type args: unicode
+ @type args: str
"""
from_given = False
to_given = False
diff --git a/scripts/category_redirect.py b/scripts/category_redirect.py
index 1235bd3..6a53ba1 100755
--- a/scripts/category_redirect.py
+++ b/scripts/category_redirect.py
@@ -506,7 +506,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
options = {}
for arg in pywikibot.handle_args(args):
diff --git a/scripts/cfd.py b/scripts/cfd.py
index 6ba2ad1..ff5d6e4 100755
--- a/scripts/cfd.py
+++ b/scripts/cfd.py
@@ -82,7 +82,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
cfd_page = DEFAULT_CFD_PAGE
local_args = pywikibot.handle_args(args)
diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index 496cfed..c7da6e4 100755
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -1591,7 +1591,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
# Command line configurable parameters
repeat = True # Restart after having check all the images?
diff --git a/scripts/claimit.py b/scripts/claimit.py
index b70205e..3327f83 100755
--- a/scripts/claimit.py
+++ b/scripts/claimit.py
@@ -105,7 +105,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
@rtype: bool
"""
exists_arg = ''
diff --git a/scripts/clean_sandbox.py b/scripts/clean_sandbox.py
index 52a1d9c..aab9f0b 100755
--- a/scripts/clean_sandbox.py
+++ b/scripts/clean_sandbox.py
@@ -248,7 +248,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
opts = {}
local_args = pywikibot.handle_args(args)
diff --git a/scripts/commons_link.py b/scripts/commons_link.py
index d961deb..da7afd8 100755
--- a/scripts/commons_link.py
+++ b/scripts/commons_link.py
@@ -122,7 +122,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
options = {}
diff --git a/scripts/commonscat.py b/scripts/commonscat.py
index 9429010..032181c 100755
--- a/scripts/commonscat.py
+++ b/scripts/commonscat.py
@@ -388,7 +388,8 @@
In Pywikibot >=2.0, page.interwiki() now returns Link objects,
not Page objects
- @rtype: unicode, name of a valid commons category
+ @return: name of a valid commons category
+ @rtype: str
"""
for ipageLink in page.langlinks():
ipage = pywikibot.page.Page(ipageLink)
@@ -515,7 +516,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
options = {}
checkcurrent = False
diff --git a/scripts/coordinate_import.py b/scripts/coordinate_import.py
index d859359..e323891 100755
--- a/scripts/coordinate_import.py
+++ b/scripts/coordinate_import.py
@@ -117,7 +117,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
# Process global args and prepare generator args parser
local_args = pywikibot.handle_args(args)
diff --git a/scripts/cosmetic_changes.py b/scripts/cosmetic_changes.py
index e938806..e8c9c2d 100644
--- a/scripts/cosmetic_changes.py
+++ b/scripts/cosmetic_changes.py
@@ -84,7 +84,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
options = {}
diff --git a/scripts/create_categories.py b/scripts/create_categories.py
index 1755a72..3111b86 100755
--- a/scripts/create_categories.py
+++ b/scripts/create_categories.py
@@ -83,7 +83,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
parent = None
basename = None
diff --git a/scripts/data_ingestion.py b/scripts/data_ingestion.py
index ad1a66c..149d8f1 100755
--- a/scripts/data_ingestion.py
+++ b/scripts/data_ingestion.py
@@ -105,9 +105,9 @@
a MediaWiki page title, and cause an API exception when used.
@param fmt: format string
- @type fmt: unicode
+ @type fmt: str
@return: formatted string
- @rtype: unicode
+ @rtype: str
"""
# FIXME: normalise the title so it is usable as a MediaWiki title.
return fmt % self.metadata
@@ -246,7 +246,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
# Process global args and prepare generator args parser
local_args = pywikibot.handle_args(args)
diff --git a/scripts/delete.py b/scripts/delete.py
index 44c3324..759036b 100755
--- a/scripts/delete.py
+++ b/scripts/delete.py
@@ -135,7 +135,7 @@
@param generator: the pages to work on
@type generator: iterable
@param summary: the reason for the (un)deletion
- @type summary: unicode
+ @type summary: str
"""
self.availableOptions.update({
'undelete': False,
@@ -225,7 +225,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
page_name = ''
summary = None
diff --git a/scripts/disambredir.py b/scripts/disambredir.py
index cca775a..07148e1 100755
--- a/scripts/disambredir.py
+++ b/scripts/disambredir.py
@@ -66,7 +66,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
local_args = pywikibot.handle_args(args)
diff --git a/scripts/djvutext.py b/scripts/djvutext.py
index 2a9af85..0d0be22 100644
--- a/scripts/djvutext.py
+++ b/scripts/djvutext.py
@@ -131,7 +131,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
index = None
djvu_path = '.' # default djvu file directory
diff --git a/scripts/editarticle.py b/scripts/editarticle.py
index 4a4e3b0..f23d4e8 100755
--- a/scripts/editarticle.py
+++ b/scripts/editarticle.py
@@ -117,7 +117,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
app = ArticleEditor(*args)
app.run()
diff --git a/scripts/fixing_redirects.py b/scripts/fixing_redirects.py
index 9112449..f84e0c7 100755
--- a/scripts/fixing_redirects.py
+++ b/scripts/fixing_redirects.py
@@ -173,7 +173,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
featured = False
gen = None
diff --git a/scripts/flickrripper.py b/scripts/flickrripper.py
index 0aa2755..294f7f3 100755
--- a/scripts/flickrripper.py
+++ b/scripts/flickrripper.py
@@ -405,7 +405,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
local_args = pywikibot.handle_args(args)
diff --git a/scripts/followlive.py b/scripts/followlive.py
index 7596783..3105049 100644
--- a/scripts/followlive.py
+++ b/scripts/followlive.py
@@ -551,7 +551,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
# Generate the question text
pywikibot.handle_args(*args)
diff --git a/scripts/freebasemappingupload.py b/scripts/freebasemappingupload.py
index 6a13e42..790c795 100755
--- a/scripts/freebasemappingupload.py
+++ b/scripts/freebasemappingupload.py
@@ -111,7 +111,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
filename = 'fb2w.nt.gz' # Default filename
for arg in pywikibot.handle_args(args):
diff --git a/scripts/harvest_template.py b/scripts/harvest_template.py
index 80718d0..8b1fa45 100755
--- a/scripts/harvest_template.py
+++ b/scripts/harvest_template.py
@@ -353,7 +353,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
template_title = None
diff --git a/scripts/illustrate_wikidata.py b/scripts/illustrate_wikidata.py
index d866d69..1e97d59 100755
--- a/scripts/illustrate_wikidata.py
+++ b/scripts/illustrate_wikidata.py
@@ -90,7 +90,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
# Process global args and prepare generator args parser
local_args = pywikibot.handle_args(args)
diff --git a/scripts/image.py b/scripts/image.py
index 662b3fc..6ad29e6 100755
--- a/scripts/image.py
+++ b/scripts/image.py
@@ -64,10 +64,10 @@
@param generator: the pages to work on
@type generator: iterable
@param old_image: the title of the old image (without namespace)
- @type old_image: unicode
+ @type old_image: str
@param new_image: the title of the new image (without namespace), or
None if you want to remove the image
- @type new_image: unicode or None
+ @type new_image: str or None
"""
self.availableOptions.update({
'summary': None,
@@ -131,7 +131,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
old_image = None
new_image = None
diff --git a/scripts/imagerecat.py b/scripts/imagerecat.py
index e02da9f..2edf9d6 100755
--- a/scripts/imagerecat.py
+++ b/scripts/imagerecat.py
@@ -451,7 +451,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
generator = None
onlyFilter = False
diff --git a/scripts/imagetransfer.py b/scripts/imagetransfer.py
index ae7c4dc..56d1c58 100755
--- a/scripts/imagetransfer.py
+++ b/scripts/imagetransfer.py
@@ -289,7 +289,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
gen = None
diff --git a/scripts/imageuncat.py b/scripts/imageuncat.py
index a7f4f39..31baaa8 100755
--- a/scripts/imageuncat.py
+++ b/scripts/imageuncat.py
@@ -1318,7 +1318,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
generator = None
diff --git a/scripts/interwiki.py b/scripts/interwiki.py
index f5f5f7e..5ab8806 100755
--- a/scripts/interwiki.py
+++ b/scripts/interwiki.py
@@ -2395,7 +2395,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
singlePageTitle = ''
opthintsonly = False
diff --git a/scripts/interwikidata.py b/scripts/interwikidata.py
index 51475d8..bcc1d27 100644
--- a/scripts/interwikidata.py
+++ b/scripts/interwikidata.py
@@ -216,7 +216,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
local_args = pywikibot.handle_args(args)
gen_factory = pagegenerators.GeneratorFactory()
diff --git a/scripts/isbn.py b/scripts/isbn.py
index 33fa573..8dbb61c 100755
--- a/scripts/isbn.py
+++ b/scripts/isbn.py
@@ -1641,7 +1641,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
options = {}
diff --git a/scripts/listpages.py b/scripts/listpages.py
index c3c60f2..1ec6268 100755
--- a/scripts/listpages.py
+++ b/scripts/listpages.py
@@ -175,7 +175,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
gen = None
notitle = False
diff --git a/scripts/login.py b/scripts/login.py
index eb277cf..db88707 100755
--- a/scripts/login.py
+++ b/scripts/login.py
@@ -116,7 +116,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
password = None
sysop = False
diff --git a/scripts/lonelypages.py b/scripts/lonelypages.py
index 7002520..894e806 100755
--- a/scripts/lonelypages.py
+++ b/scripts/lonelypages.py
@@ -234,7 +234,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
options = {}
diff --git a/scripts/maintenance/download_dump.py b/scripts/maintenance/download_dump.py
index 66c96fc..ea0276f 100644
--- a/scripts/maintenance/download_dump.py
+++ b/scripts/maintenance/download_dump.py
@@ -206,7 +206,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
opts = {}
unknown_args = []
diff --git a/scripts/makecat.py b/scripts/makecat.py
index fc7db24..86f034a 100755
--- a/scripts/makecat.py
+++ b/scripts/makecat.py
@@ -225,7 +225,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
global workingcat, parentcats
global checked, tocheck
diff --git a/scripts/misspelling.py b/scripts/misspelling.py
index 4eafcaa..ad54637 100755
--- a/scripts/misspelling.py
+++ b/scripts/misspelling.py
@@ -166,7 +166,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
# the option that's always selected when the bot wonders what to do with
# a link. If it's None, the user is prompted (default behaviour).
diff --git a/scripts/movepages.py b/scripts/movepages.py
index 24b13e2..d5789d6 100755
--- a/scripts/movepages.py
+++ b/scripts/movepages.py
@@ -183,7 +183,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
oldName = None
options = {}
diff --git a/scripts/ndashredir.py b/scripts/ndashredir.py
index 8dbef31..ed5674c 100644
--- a/scripts/ndashredir.py
+++ b/scripts/ndashredir.py
@@ -126,7 +126,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
options = {}
# Process global arguments to determine desired site
diff --git a/scripts/newitem.py b/scripts/newitem.py
index bb1d350..956d287 100755
--- a/scripts/newitem.py
+++ b/scripts/newitem.py
@@ -134,7 +134,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
# Process global args and prepare generator args parser
local_args = pywikibot.handle_args(args)
diff --git a/scripts/noreferences.py b/scripts/noreferences.py
index 8287567..5c63a56 100755
--- a/scripts/noreferences.py
+++ b/scripts/noreferences.py
@@ -731,7 +731,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
options = {}
diff --git a/scripts/nowcommons.py b/scripts/nowcommons.py
index f2ba56f..ca899aa 100755
--- a/scripts/nowcommons.py
+++ b/scripts/nowcommons.py
@@ -379,7 +379,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
options = {}
diff --git a/scripts/pagefromfile.py b/scripts/pagefromfile.py
index 8c1f1ec..a28d441 100755
--- a/scripts/pagefromfile.py
+++ b/scripts/pagefromfile.py
@@ -294,7 +294,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
filename = 'dict.txt'
options = {}
diff --git a/scripts/piper.py b/scripts/piper.py
index 9686dea..1cfcd9e 100755
--- a/scripts/piper.py
+++ b/scripts/piper.py
@@ -80,7 +80,7 @@
"""Pipe a given text through a given program.
@return: processed text after piping
- @rtype: unicode
+ @rtype: str
"""
if not isinstance(text, str): # py2-py3 compatibility
text = text.encode('utf-8')
diff --git a/scripts/protect.py b/scripts/protect.py
index 60d7789..5274121 100755
--- a/scripts/protect.py
+++ b/scripts/protect.py
@@ -118,7 +118,7 @@
"""Check if the protection level is valid or ask if necessary.
@return: a valid protection level
- @rtype: string
+ @rtype: str
"""
if level not in levels:
first_char = []
@@ -151,7 +151,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
options = {}
message_properties = {}
diff --git a/scripts/redirect.py b/scripts/redirect.py
index 8d93480..9d5efa0 100755
--- a/scripts/redirect.py
+++ b/scripts/redirect.py
@@ -689,7 +689,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
options = {}
gen_options = {}
diff --git a/scripts/reflinks.py b/scripts/reflinks.py
index dfbf37f..97fdba5 100755
--- a/scripts/reflinks.py
+++ b/scripts/reflinks.py
@@ -769,7 +769,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
xml_filename = None
xml_start = None
diff --git a/scripts/replace.py b/scripts/replace.py
index b6a7d63..21167bc 100755
--- a/scripts/replace.py
+++ b/scripts/replace.py
@@ -617,7 +617,7 @@
"""
Apply all replacements to the given text.
- @rtype: unicode, set
+ @rtype: str, set
"""
if page is None:
pywikibot.warn(
@@ -871,7 +871,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
add_cat = None
gen = None
diff --git a/scripts/replicate_wiki.py b/scripts/replicate_wiki.py
index f3e4d53..07a7a45 100755
--- a/scripts/replicate_wiki.py
+++ b/scripts/replicate_wiki.py
@@ -246,7 +246,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
my_args = pywikibot.handle_args(args)
diff --git a/scripts/revertbot.py b/scripts/revertbot.py
index 8f524ad..9ae98e4 100755
--- a/scripts/revertbot.py
+++ b/scripts/revertbot.py
@@ -163,7 +163,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
options = {}
diff --git a/scripts/script_wui.py b/scripts/script_wui.py
index f49e2eb..9ab4db0 100755
--- a/scripts/script_wui.py
+++ b/scripts/script_wui.py
@@ -325,7 +325,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
global __simulate, __sys_argv
diff --git a/scripts/selflink.py b/scripts/selflink.py
index 531974c..e1c4e7d 100755
--- a/scripts/selflink.py
+++ b/scripts/selflink.py
@@ -78,7 +78,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
# Process global args and prepare generator args parser
local_args = pywikibot.handle_args(args)
diff --git a/scripts/solve_disambiguation.py b/scripts/solve_disambiguation.py
index 17dec44..a20f64f 100755
--- a/scripts/solve_disambiguation.py
+++ b/scripts/solve_disambiguation.py
@@ -1224,7 +1224,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
# the option that's always selected when the bot wonders what to do with
# a link. If it's None, the user is prompted (default behaviour).
diff --git a/scripts/spamremove.py b/scripts/spamremove.py
index c5ed4d1..1493934 100755
--- a/scripts/spamremove.py
+++ b/scripts/spamremove.py
@@ -123,7 +123,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
spam_external_url = None
protocol = 'http'
diff --git a/scripts/states_redirect.py b/scripts/states_redirect.py
index 18829e2..f78feab 100755
--- a/scripts/states_redirect.py
+++ b/scripts/states_redirect.py
@@ -116,7 +116,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
local_args = pywikibot.handle_args(args)
start = None
diff --git a/scripts/surnames_redirects.py b/scripts/surnames_redirects.py
index 97ab8a0..224727d 100755
--- a/scripts/surnames_redirects.py
+++ b/scripts/surnames_redirects.py
@@ -106,7 +106,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
options = {}
diff --git a/scripts/table2wiki.py b/scripts/table2wiki.py
index 6c27294..347537e 100644
--- a/scripts/table2wiki.py
+++ b/scripts/table2wiki.py
@@ -523,7 +523,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
options = {}
gen = None
diff --git a/scripts/template.py b/scripts/template.py
index caf02a2..ef857d0 100755
--- a/scripts/template.py
+++ b/scripts/template.py
@@ -270,7 +270,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
template_names = []
templates = {}
diff --git a/scripts/templatecount.py b/scripts/templatecount.py
index cff7f82..01159dc 100755
--- a/scripts/templatecount.py
+++ b/scripts/templatecount.py
@@ -154,7 +154,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
operation = None
args_list = []
diff --git a/scripts/touch.py b/scripts/touch.py
index 7f5cd42..cb78bb9 100755
--- a/scripts/touch.py
+++ b/scripts/touch.py
@@ -98,7 +98,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
gen = None
options = {}
diff --git a/scripts/transferbot.py b/scripts/transferbot.py
index 09262dc..ee92924 100755
--- a/scripts/transferbot.py
+++ b/scripts/transferbot.py
@@ -86,7 +86,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
local_args = pywikibot.handle_args(args)
diff --git a/scripts/unlink.py b/scripts/unlink.py
index 4597d08..908fe4f 100755
--- a/scripts/unlink.py
+++ b/scripts/unlink.py
@@ -62,7 +62,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
# This temporary string is used to read the title
# of the page that should be unlinked.
diff --git a/scripts/unusedfiles.py b/scripts/unusedfiles.py
index 0d35d55..c486bec 100755
--- a/scripts/unusedfiles.py
+++ b/scripts/unusedfiles.py
@@ -107,7 +107,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
options = {}
total = None
diff --git a/scripts/upload.py b/scripts/upload.py
index b5396b9..723ac05 100755
--- a/scripts/upload.py
+++ b/scripts/upload.py
@@ -104,7 +104,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
url = ''
description = []
diff --git a/scripts/watchlist.py b/scripts/watchlist.py
index 145b016..298de83 100755
--- a/scripts/watchlist.py
+++ b/scripts/watchlist.py
@@ -91,7 +91,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
all = False
new = False
diff --git a/scripts/weblinkchecker.py b/scripts/weblinkchecker.py
index f47af6c..a619c84 100755
--- a/scripts/weblinkchecker.py
+++ b/scripts/weblinkchecker.py
@@ -409,7 +409,7 @@
If useHEAD is true, uses the HTTP HEAD method, which saves bandwidth
by not downloading the body. Otherwise, the HTTP GET method is used.
- @rtype: unicode or None
+ @rtype: str or None
"""
conn = self.getConnection()
try:
@@ -953,7 +953,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
gen = None
xmlFilename = None
diff --git a/scripts/welcome.py b/scripts/welcome.py
index 0519c16..5ea6570 100755
--- a/scripts/welcome.py
+++ b/scripts/welcome.py
@@ -922,7 +922,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
for arg in pywikibot.handle_args(args):
arg, sep, val = arg.partition(':')
diff --git a/scripts/wikisourcetext.py b/scripts/wikisourcetext.py
index dfe3b45..d340d31 100644
--- a/scripts/wikisourcetext.py
+++ b/scripts/wikisourcetext.py
@@ -215,7 +215,7 @@
If args is an empty list, sys.argv is used.
@param args: command line arguments
- @type args: unicode
+ @type args: str
"""
index = None
pages = '1-'
diff --git a/tests/aspects.py b/tests/aspects.py
index c7d7ebf..79af4f8 100644
--- a/tests/aspects.py
+++ b/tests/aspects.py
@@ -1610,7 +1610,7 @@
@param msg: Either the specific message or None to allow any generic
message. When set to C{INSTEAD} it only counts those supplying an
alternative and when C{NO_INSTEAD} only those not supplying one.
- @type msg: string or None or INSTEAD or NO_INSTEAD
+ @type msg: str or None or INSTEAD or NO_INSTEAD
"""
if msg is None or msg is self.INSTEAD or msg is self.NO_INSTEAD:
deprecation_messages = self.deprecation_messages
--
To view, visit https://gerrit.wikimedia.org/r/498722
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia66664a2a78425ed6131f8ebe470567257ab1a12
Gerrit-Change-Number: 498722
Gerrit-PatchSet: 7
Gerrit-Owner: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: D3r1ck01 <alangiderick(a)gmail.com>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: JJMC89 <JJMC89.Wikimedia(a)gmail.com>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zhuyifei1999 <zhuyifei1999(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/498360 )
Change subject: [bugfix] Use a female user account to test gender() method
......................................................................
[bugfix] Use a female user account to test gender() method
Bug: T218988
Change-Id: I0c98bffa1b4e0ff72d98d32a42d4b761f83be36a
---
M tests/user_tests.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
D3r1ck01: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/user_tests.py b/tests/user_tests.py
index 45da6aa..cf2b32e 100644
--- a/tests/user_tests.py
+++ b/tests/user_tests.py
@@ -104,7 +104,7 @@
def test_female_user(self):
"""Test female user."""
- user = User(self.site, 'Alraunenstern')
+ user = User(self.site, 'Catrin')
self.assertTrue(user.isRegistered())
self.assertFalse(user.isAnonymous())
self.assertGreater(user.editCount(), 0)
--
To view, visit https://gerrit.wikimedia.org/r/498360
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I0c98bffa1b4e0ff72d98d32a42d4b761f83be36a
Gerrit-Change-Number: 498360
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki(a)aol.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)