jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/684280 )
Change subject: [doc] Additional version hints to doc strings
......................................................................
[doc] Additional version hints to doc strings
Change-Id: I236af66aa35dd8587fc3c88bb8f90d611daf9e9a
---
M pywikibot/__init__.py
M pywikibot/__metadata__.py
M pywikibot/backports.py
M pywikibot/bot.py
M pywikibot/bot_choice.py
M pywikibot/comms/eventstreams.py
M pywikibot/families/foundation_family.py
M pywikibot/families/wikihow_family.py
M pywikibot/families/wikimania_family.py
M pywikibot/families/wikispore_family.py
M pywikibot/family.py
M pywikibot/page/__init__.py
M pywikibot/plural.py
M pywikibot/site/_apisite.py
M pywikibot/site_detect.py
M pywikibot/textlib.py
M pywikibot/tools/__init__.py
M pywikibot/version.py
18 files changed, 138 insertions(+), 32 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index 57d147c..4e1204e 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -1022,6 +1022,8 @@
is introduced.
This data type is just a json container
+
+ *New in version 3.0.*
"""
_items = ('json',)
diff --git a/pywikibot/__metadata__.py b/pywikibot/__metadata__.py
index 2c135db..f136648 100644
--- a/pywikibot/__metadata__.py
+++ b/pywikibot/__metadata__.py
@@ -1,4 +1,7 @@
-"""Pywikibot metadata file."""
+"""Pywikibot metadata file.
+
+*New in version 4.0.*
+"""
#
# (C) Pywikibot team, 2020-2021
#
diff --git a/pywikibot/backports.py b/pywikibot/backports.py
index 219a231..69e4057 100644
--- a/pywikibot/backports.py
+++ b/pywikibot/backports.py
@@ -1,6 +1,6 @@
"""This module contains backports to support older Python versions."""
#
-# (C) Pywikibot team, 2020-2021
+# (C) Pywikibot team, 2014-2021
#
# Distributed under the terms of the MIT license.
#
@@ -68,13 +68,19 @@
removesuffix = str.removesuffix
else:
def removeprefix(string: str, prefix: str) -> str:
- """Remove prefix from a string or return a copy otherwise."""
+ """Remove prefix from a string or return a copy otherwise.
+
+ *New in version 5.4.*
+ """
if string.startswith(prefix):
return string[len(prefix):]
return string[:]
def removesuffix(string: str, suffix: str) -> str:
- """Remove prefix from a string or return a copy otherwise."""
+ """Remove prefix from a string or return a copy otherwise.
+
+ *New in version 5.4.*
+ """
if string.endswith(suffix):
return string[:-len(suffix)]
return string[:]
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 3d6a7e2..08fbdc3 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -887,7 +887,10 @@
def show_help(module_name=None, show_global=False):
- """Show help for the Bot."""
+ """Show help for the Bot.
+
+ *Renamed in version 4.0.*
+ """
if not module_name:
module_name = calledModuleName()
if not module_name:
@@ -1008,7 +1011,10 @@
class _OptionDict(dict):
- """The option dict which holds the options of OptionHandler."""
+ """The option dict which holds the options of OptionHandler.
+
+ *New in version 4.1.*
+ """
def __init__(self, classname, options):
self._classname = classname
@@ -1378,7 +1384,7 @@
@deprecated('generator.close()', since='20200804')
def stop(self): # pragma: no cover
- """Stop iterating."""
+ """DEPRECATED. Stop iterating."""
pywikibot.output('Generator has been stopped.')
self.generator.close()
@@ -1454,6 +1460,8 @@
def skip_page(self, page):
"""Return whether treat should be skipped for the page.
+ *New in version 3.0.*
+
@param page: Page object to be processed
@type page: pywikibot.Page
"""
@@ -1474,10 +1482,15 @@
This can be used for reading huge parts from life wiki or file
operation which is more than just initialize the instance.
Invoked by run() before running through generator loop.
+
+ *New in version 3.0.*
"""
def teardown(self):
- """Some cleanups after run operation. Invoked by exit()."""
+ """Some cleanups after run operation. Invoked by exit().
+
+ *New in version 3.0.*
+ """
def run(self):
"""Process all pages in generator.
@@ -1743,6 +1756,8 @@
- available_options default setting
- script.ini options settings
- command line arguments
+
+ *New in version 3.0.*
"""
INI = 'scripts.ini'
diff --git a/pywikibot/bot_choice.py b/pywikibot/bot_choice.py
index b043c1d..433acc1 100755
--- a/pywikibot/bot_choice.py
+++ b/pywikibot/bot_choice.py
@@ -424,7 +424,10 @@
class ShowingListOption(ListOption, OutputOption):
- """An option to show a list and select an item."""
+ """An option to show a list and select an item.
+
+ *New in version 3.0.*
+ """
before_question = True
@@ -457,7 +460,10 @@
class MultipleChoiceList(ListOption):
- """An option to select multiple items from a list."""
+ """An option to select multiple items from a list.
+
+ *New in version 3.0.*
+ """
def test(self, value) -> bool:
"""Return whether the values are int and in the specified range."""
@@ -485,7 +491,10 @@
class ShowingMultipleChoiceList(ShowingListOption, MultipleChoiceList):
- """An option to show a list and select multiple items."""
+ """An option to show a list and select multiple items.
+
+ *New in version 3.0.*
+ """
class HighlightContextOption(ContextOption):
diff --git a/pywikibot/comms/eventstreams.py b/pywikibot/comms/eventstreams.py
index ec36b79..053ce0e 100644
--- a/pywikibot/comms/eventstreams.py
+++ b/pywikibot/comms/eventstreams.py
@@ -6,6 +6,8 @@
This module requires sseclient to be installed::
pip install sseclient
+
+*New in version 3.0.*
"""
#
# (C) Pywikibot team, 2017-2020
diff --git a/pywikibot/families/foundation_family.py b/pywikibot/families/foundation_family.py
index 2311f6a..cc9d7b2 100644
--- a/pywikibot/families/foundation_family.py
+++ b/pywikibot/families/foundation_family.py
@@ -1,4 +1,7 @@
-"""Family module for Foundation wiki."""
+"""Family module for Foundation wiki.
+
+*New in version 3.0.*
+"""
#
# (C) Pywikibot team, 2019-2020
#
diff --git a/pywikibot/families/wikihow_family.py b/pywikibot/families/wikihow_family.py
index 957beec..afe6f85 100644
--- a/pywikibot/families/wikihow_family.py
+++ b/pywikibot/families/wikihow_family.py
@@ -1,4 +1,7 @@
-"""Family module for Wikihow Wiki."""
+"""Family module for Wikihow Wiki.
+
+*New in version 3.0.*
+"""
#
# (C) Pywikibot team, 2020
#
diff --git a/pywikibot/families/wikimania_family.py b/pywikibot/families/wikimania_family.py
index 99e69cc..3ba5ba1 100644
--- a/pywikibot/families/wikimania_family.py
+++ b/pywikibot/families/wikimania_family.py
@@ -1,4 +1,7 @@
-"""Family module for Wikimania wikis."""
+"""Family module for Wikimania wikis.
+
+*New in version 3.0.*
+"""
#
# (C) Pywikibot team, 2017-2020
#
diff --git a/pywikibot/families/wikispore_family.py b/pywikibot/families/wikispore_family.py
index 3d9c60c..1dd3037 100644
--- a/pywikibot/families/wikispore_family.py
+++ b/pywikibot/families/wikispore_family.py
@@ -1,4 +1,7 @@
-"""Family module for Wikispore."""
+"""Family module for Wikispore.
+
+*New in version 4.1.*
+"""
#
# (C) Pywikibot team, 2020
#
diff --git a/pywikibot/family.py b/pywikibot/family.py
index aba6289..ec3a41e 100644
--- a/pywikibot/family.py
+++ b/pywikibot/family.py
@@ -656,11 +656,17 @@
self._get_cr_templates(code, fallback)
def get_edit_restricted_templates(self, code):
- """Return tuple of edit restricted templates."""
+ """Return tuple of edit restricted templates.
+
+ *New in version 3.0.*
+ """
return self.edit_restricted_templates.get(code, ())
def get_archived_page_templates(self, code):
- """Return tuple of archived page templates."""
+ """Return tuple of archived page templates.
+
+ *New in version 3.0.*
+ """
return self.archived_page_templates.get(code, ())
def disambig(self, code, fallback='_default'):
@@ -691,6 +697,8 @@
"""
Return whether a HTTPS certificate should be verified.
+ *Renamed in version 5.3.*
+
@param code: language code
@return: flag to verify the SSL certificate;
set it to False to allow access if certificate has an error.
@@ -701,7 +709,7 @@
future_warning=True)
def ignore_certificate_error(self, code: str) -> bool:
"""
- Return whether a HTTPS certificate error should be ignored.
+ DEPRECATED. Return whether a HTTPS certificate error should be ignored.
@param code: language code
@return: flag to allow access if certificate has an error.
@@ -776,11 +784,17 @@
return '{}/api.php'.format(self.scriptpath(code))
def eventstreams_host(self, code):
- """Hostname for EventStreams."""
+ """Hostname for EventStreams.
+
+ *New in version 3.0.*
+ """
raise NotImplementedError('This family does not support EventStreams')
def eventstreams_path(self, code):
- """Return path for EventStreams."""
+ """Return path for EventStreams.
+
+ *New in version 3.0.*
+ """
raise NotImplementedError('This family does not support EventStreams')
@deprecated_args(name='title')
@@ -1056,7 +1070,10 @@
class FandomFamily(Family):
- """Common features of Fandom families."""
+ """Common features of Fandom families.
+
+ *Renamed in version 3.0.*
+ """
@classproperty
def langs(cls):
diff --git a/pywikibot/page/__init__.py b/pywikibot/page/__init__.py
index a0cda40..a92c111 100644
--- a/pywikibot/page/__init__.py
+++ b/pywikibot/page/__init__.py
@@ -1781,7 +1781,10 @@
self.save(summary=reason)
def has_deleted_revisions(self) -> bool:
- """Return True if the page has deleted revisions."""
+ """Return True if the page has deleted revisions.
+
+ *New in version 4.2.*
+ """
if not hasattr(self, '_has_deleted_revisions'):
gen = self.site.deletedrevs(self, total=1, prop=['ids'])
self._has_deleted_revisions = bool(list(gen))
@@ -2196,6 +2199,8 @@
Return the first 'preferred' ranked Claim specified by Wikibase
property or the first 'normal' one otherwise.
+ *New in version 3.0.*
+
@param prop: property id, "P###"
@return: Claim object given by Wikibase property number
for this page object.
@@ -3147,6 +3152,8 @@
) -> Iterable[Tuple[Page, Revision]]:
"""Yield tuples describing this user's deleted edits.
+ *New in version 5.5.*
+
@param total: Limit results to this number of pages
@keyword start: Iterate contributions starting at this Timestamp
@keyword end: Iterate contributions ending at this Timestamp
@@ -5566,6 +5573,8 @@
Extends BaseLink by the following attribute:
- badges: Any badges associated with the sitelink
+
+ *New in version 3.0.*
"""
# Components used for __repr__
diff --git a/pywikibot/plural.py b/pywikibot/plural.py
index a53f469..6cef87a 100644
--- a/pywikibot/plural.py
+++ b/pywikibot/plural.py
@@ -108,5 +108,8 @@
def plural_rule(lang: str) -> PluralRule:
- """Return the plural rule for a given lang."""
+ """Return the plural rule for a given lang.
+
+ *New in version 4.3.*
+ """
return plural_rules.get(lang, plural_rules['_default'])
diff --git a/pywikibot/site/_apisite.py b/pywikibot/site/_apisite.py
index ed6e281..b10743b 100644
--- a/pywikibot/site/_apisite.py
+++ b/pywikibot/site/_apisite.py
@@ -1438,6 +1438,8 @@
If more than one target id is provided, the same action is taken for
all of them.
+ *New in version 6.0.*
+
@param targettype: Type of target. One of "archive", "filearchive",
"logging", "oldimage", "revision".
@param ids: Identifiers for the revision, log, file version or archive.
@@ -2061,6 +2063,9 @@
To delete a specific version of an image the oldimage identifier
must be provided.
+ *Renamed in version 6.1.*
+
+ *New in version 6.1:* keyword only parameter *oldimage* was added.
@param page: Page to be deleted or its pageid.
@type page: L{pywikibot.page.BasePage} or, for pageid, int or str
@@ -2150,6 +2155,12 @@
@see: U{https://www.mediawiki.org/wiki/API:Undelete}
+ *Renamed in version 6.1.*
+
+ *New in version 6.1:* *fileids* parameter was added.
+
+ *Changed in verson 6.1:* keyword argument required for *revisions*.
+
@param page: Page to be deleted.
@type page: pywikibot.BasePage
@param reason: Undeletion reason.
@@ -2545,6 +2556,9 @@
Either source_filename or source_url, but not both, must be provided.
+ *Changed in version 6.0:* keyword arguments required for all
+ parameters except *filepage*.
+
@param filepage: a FilePage object from which the wiki-name of the
file will be obtained.
@param source_filename: path to the file to be uploaded
diff --git a/pywikibot/site_detect.py b/pywikibot/site_detect.py
index bb6dd98..9f92a37 100644
--- a/pywikibot/site_detect.py
+++ b/pywikibot/site_detect.py
@@ -273,7 +273,10 @@
def check_response(response):
- """Raise ServerError if the response indicates a server error."""
+ """Raise ServerError if the response indicates a server error.
+
+ *New in version 3.0.*
+ """
if response.status_code >= HTTPStatus.INTERNAL_SERVER_ERROR:
raise ServerError(HTTPStatus(response.status_code).phrase)
diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py
index 1bb1b71..4721c0e 100644
--- a/pywikibot/textlib.py
+++ b/pywikibot/textlib.py
@@ -897,6 +897,7 @@
('== Usage of A ==', 'Some usage...')]
result.footer = '[[Category:Things starting with A]]'
+ *New in version 3.0.*
"""
headings = _extract_headings(text, site)
sections = _extract_sections(text, headings)
diff --git a/pywikibot/tools/__init__.py b/pywikibot/tools/__init__.py
index dd5df46..aa419b5 100644
--- a/pywikibot/tools/__init__.py
+++ b/pywikibot/tools/__init__.py
@@ -77,7 +77,10 @@
def has_module(module, version=None):
- """Check if a module can be imported."""
+ """Check if a module can be imported.
+
+ *New in version 3.0.*
+ """
try:
m = import_module(module)
except ImportError:
@@ -100,7 +103,7 @@
def empty_iterator():
# http://stackoverflow.com/a/13243870/473890
- """An iterator which does nothing."""
+ """DEPRECATED. An iterator which does nothing."""
return
yield
@@ -139,6 +142,8 @@
Those suppressed warnings that do not match the parameters will be raised
shown upon exit.
+
+ *New in vesion 3.0.*
"""
def __init__(self, message='', category=Warning, filename=''):
@@ -221,7 +226,7 @@
class DotReadableDict:
- """Parent class of Revision() and FileInfo().
+ """DEPRECATED. Lecacy class of Revision() and FileInfo().
Provide: __getitem__() and __repr__().
"""
@@ -244,7 +249,7 @@
class frozenmap(Mapping): # noqa: N801
- """Frozen mapping, preventing write after initialisation."""
+ """DEPRECATED. Frozen mapping, preventing write after initialisation."""
def __init__(self, data=(), **kwargs):
"""Initialize data in same ways like a dict."""
@@ -308,6 +313,8 @@
>>> data.clear()
>>> list(data)
[]
+
+ *New in version 6.1.*
"""
def __init__(self, keyattr: str):
@@ -384,7 +391,7 @@
class LazyRegex:
"""
- Regex object that obtains and compiles the regex on usage.
+ DEPRECATED. Regex object that obtains and compiles the regex on usage.
Instances behave like the object created using L{re.compile}.
"""
@@ -447,7 +454,7 @@
def __init__(self, pattern, flags=0, name=None, instead=None, since=None):
"""
- Initializer.
+ DEPRECATED. Deprecate a give regex.
If name is None, the regex pattern will be used as part of
the deprecation warning.
@@ -919,6 +926,8 @@
>>> tuple(roundrobin_generators('ABC', range(5)))
('A', 0, 'B', 1, 'C', 2, 3, 4)
+ *New in version 3.0.*
+
@param iterables: any iterable to combine in roundrobin way
@type iterables: iterable
@return: the combined generator of iterables
diff --git a/pywikibot/version.py b/pywikibot/version.py
index dfedd51..21f3d75 100644
--- a/pywikibot/version.py
+++ b/pywikibot/version.py
@@ -37,12 +37,13 @@
return _program_dir
-def get_toolforge_hostname():
+def get_toolforge_hostname() -> Optional[str]:
"""Get hostname of the current Toolforge host.
+ *New in version 3.0.*
+
@return: The hostname of the currently running host,
if it is in Wikimedia Toolforge; otherwise return None.
- @rtype: str or None
"""
if socket.getfqdn().endswith('.tools.eqiad.wmflabs'):
return socket.gethostname()
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/684280
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I236af66aa35dd8587fc3c88bb8f90d611daf9e9a
Gerrit-Change-Number: 684280
Gerrit-PatchSet: 6
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/688282 )
Change subject: [W0107] Remove unnecessary pass statement
......................................................................
[W0107] Remove unnecessary pass statement
Change-Id: I785b6475f5d8c7e54887f72fa38eb7c3cf7ebbd4
---
M pywikibot/bot.py
M pywikibot/bot_choice.py
M pywikibot/config.py
M pywikibot/exceptions.py
M pywikibot/logentries.py
M pywikibot/login.py
M pywikibot/tools/__init__.py
M pywikibot/userinterfaces/terminal_interface_base.py
M tests/aspects.py
M tests/deprecation_tests.py
M tests/generate_family_file_tests.py
M tests/i18n_tests.py
M tests/logentries_tests.py
M tests/oauth_tests.py
M tests/replacebot_tests.py
M tests/ui_tests.py
M tests/utils.py
M tests/wikibase_tests.py
18 files changed, 5 insertions(+), 88 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index 7aaa8f8..3d6a7e2 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -1475,11 +1475,9 @@
operation which is more than just initialize the instance.
Invoked by run() before running through generator loop.
"""
- pass
def teardown(self):
"""Some cleanups after run operation. Invoked by exit()."""
- pass
def run(self):
"""Process all pages in generator.
diff --git a/pywikibot/bot_choice.py b/pywikibot/bot_choice.py
index 8f91f76..b043c1d 100755
--- a/pywikibot/bot_choice.py
+++ b/pywikibot/bot_choice.py
@@ -487,8 +487,6 @@
"""An option to show a list and select multiple items."""
- pass
-
class HighlightContextOption(ContextOption):
diff --git a/pywikibot/config.py b/pywikibot/config.py
index 82e12c7..2c5f752 100644
--- a/pywikibot/config.py
+++ b/pywikibot/config.py
@@ -89,8 +89,6 @@
"""Feature that is no longer supported."""
- pass
-
# IMPORTANT:
# Do not change any of the variables in this file. Instead, make
diff --git a/pywikibot/exceptions.py b/pywikibot/exceptions.py
index 990a8c4..c9052f7 100644
--- a/pywikibot/exceptions.py
+++ b/pywikibot/exceptions.py
@@ -176,22 +176,16 @@
"""Feature that is no longer implemented."""
- pass
-
class ArgumentDeprecationWarning(UserWarning, FutureWarning):
"""Command line argument that is no longer supported."""
- pass
-
class FamilyMaintenanceWarning(UserWarning):
"""Family class is missing definitions."""
- pass
-
class Error(Exception):
@@ -348,8 +342,6 @@
"""Username is not in user-config.py."""
- pass
-
class NoPageError(PageRelatedError):
@@ -400,29 +392,21 @@
"""Site does not exist."""
- pass
-
class UnknownSiteError(SiteDefinitionError):
"""Site does not exist in Family."""
- pass
-
class UnknownFamilyError(SiteDefinitionError):
"""Family is not registered."""
- pass
-
class UnknownExtensionError(Error, NotImplementedError):
"""Extension is not defined."""
- pass
-
class VersionParseError(Error):
@@ -491,8 +475,6 @@
"""Invalid page title."""
- pass
-
class LockedPageError(PageSaveRelatedError):
@@ -596,36 +578,26 @@
"""Got unexpected server response."""
- pass
-
class FatalServerError(ServerError):
"""A fatal server error will not be corrected by resending the request."""
- pass
-
class Server504Error(ServerError):
"""Server timed out with HTTP 504 code."""
- pass
-
class Server414Error(ServerError):
"""Server returned with HTTP 414 code."""
- pass
-
class CaptchaError(Error):
"""Captcha is asked and config.solve_captcha == False."""
- pass
-
class AutoblockUserError(Error):
@@ -636,8 +608,6 @@
for him (i.e. roughly everything except unblock).
"""
- pass
-
class UnhandledAnswerError(Error):
@@ -650,28 +620,23 @@
class TranslationError(Error, ImportError):
- """Raised when no correct translation could be found."""
+ """Raised when no correct translation could be found.
- # Inherits from ImportError, as this exception is now used
- # where previously an ImportError would have been raised,
- # and may have been caught by scripts as such.
-
- pass
+ Inherits from ImportError, as this exception is now used
+ where previously an ImportError would have been raised,
+ and may have been caught by scripts as such.
+ """
class UserRightsError(Error):
"""Insufficient user rights to perform an action."""
- pass
-
class HiddenKeyError(UserRightsError, KeyError):
"""Insufficient user rights to view the hidden key."""
- pass
-
class NotEmailableError(PageRelatedError):
@@ -689,8 +654,6 @@
"""Wikibase related error."""
- pass
-
class NoWikibaseEntityError(WikiBaseError):
@@ -712,29 +675,21 @@
"""This globe is not implemented yet in either WikiBase or pywikibot."""
- pass
-
class EntityTypeUnknownError(WikiBaseError):
"""The requested entity type is not recognised on this site."""
- pass
-
class TimeoutError(Error):
"""Request failed with a timeout error."""
- pass
-
class MaxlagTimeoutError(TimeoutError):
"""Request failed with a maxlag timeout error."""
- pass
-
DEPRECATED_EXCEPTIONS = {
'NoUsername': 'NoUsernameError',
diff --git a/pywikibot/logentries.py b/pywikibot/logentries.py
index 2c58829..106448d 100644
--- a/pywikibot/logentries.py
+++ b/pywikibot/logentries.py
@@ -135,8 +135,6 @@
"""A log entry class for unspecified log events."""
- pass
-
class UserTargetLogEntry(LogEntry):
diff --git a/pywikibot/login.py b/pywikibot/login.py
index 4ec3893..a74042c 100644
--- a/pywikibot/login.py
+++ b/pywikibot/login.py
@@ -36,8 +36,6 @@
"""The format of password file is incorrect."""
- pass
-
_logger = 'wiki.login'
diff --git a/pywikibot/tools/__init__.py b/pywikibot/tools/__init__.py
index 733a656..dd5df46 100644
--- a/pywikibot/tools/__init__.py
+++ b/pywikibot/tools/__init__.py
@@ -61,8 +61,6 @@
"""Feature that is no longer implemented."""
- pass
-
def is_IP(IP: str) -> bool: # noqa N802, N803
"""Verify the IP address provided is valid.
@@ -1049,15 +1047,11 @@
"""Dict with SelfCallMixin."""
- pass
-
class SelfCallString(SelfCallMixin, str):
"""String with SelfCallMixin."""
- pass
-
class DequeGenerator(Iterator, collections.deque):
diff --git a/pywikibot/userinterfaces/terminal_interface_base.py b/pywikibot/userinterfaces/terminal_interface_base.py
index 6dc7c2a..dfbb0ac 100755
--- a/pywikibot/userinterfaces/terminal_interface_base.py
+++ b/pywikibot/userinterfaces/terminal_interface_base.py
@@ -502,8 +502,6 @@
"""Terminal logging formatter."""
- pass
-
class MaxLevelFilter(logging.Filter):
diff --git a/tests/aspects.py b/tests/aspects.py
index c0e2e36..4ad3c4b 100644
--- a/tests/aspects.py
+++ b/tests/aspects.py
@@ -1031,7 +1031,6 @@
def after_assert(self, assertion, *args, **kwargs):
"""Handle after the assertion."""
- pass
def patch_assert(self, assertion):
"""Execute process_assert when the assertion is called."""
@@ -1283,8 +1282,6 @@
"""Run tests against any site connected to a Wikibase."""
- pass
-
class WikidataTestCase(WikibaseTestCase):
diff --git a/tests/deprecation_tests.py b/tests/deprecation_tests.py
index 80df7ca..8a010ed 100644
--- a/tests/deprecation_tests.py
+++ b/tests/deprecation_tests.py
@@ -40,19 +40,16 @@
@noop()
def decorated_func():
"""Test dummy decorator."""
- pass
@noop(foo='bar')
def decorated_func2():
"""Test dummy decorator."""
- pass
@noop('baz')
def decorated_func3():
"""Test dummy decorator."""
- pass
class DecoratorFullNameTestCase(DeprecationTestCase):
@@ -247,8 +244,6 @@
"""Deprecated class."""
- pass
-
@deprecated()
class DeprecatedClass:
diff --git a/tests/generate_family_file_tests.py b/tests/generate_family_file_tests.py
index 8248aa6..f89341c 100644
--- a/tests/generate_family_file_tests.py
+++ b/tests/generate_family_file_tests.py
@@ -28,7 +28,6 @@
def writefile(self, verify):
"""Pass writing."""
- pass
class TestGenerateFamilyFiles(DefaultSiteTestCase):
diff --git a/tests/i18n_tests.py b/tests/i18n_tests.py
index f37dd06..e67e0d4 100644
--- a/tests/i18n_tests.py
+++ b/tests/i18n_tests.py
@@ -26,8 +26,6 @@
"""Nested class to hold the family name attribute."""
- pass
-
def __init__(self, code, family='wikipedia'):
"""Initializer."""
self.code = code
diff --git a/tests/logentries_tests.py b/tests/logentries_tests.py
index 1be0e70..f4d5653 100644
--- a/tests/logentries_tests.py
+++ b/tests/logentries_tests.py
@@ -162,8 +162,6 @@
"""Test general LogEntry properties."""
- pass
-
class TestSimpleLogentries(TestLogentriesBase):
diff --git a/tests/oauth_tests.py b/tests/oauth_tests.py
index e1c924e..e33821e 100644
--- a/tests/oauth_tests.py
+++ b/tests/oauth_tests.py
@@ -48,8 +48,6 @@
"""Default OAuth site test."""
- pass
-
class TestOauthLoginManger(DefaultOAuthSiteTestCase):
diff --git a/tests/replacebot_tests.py b/tests/replacebot_tests.py
index b73c9e0..e9ebb5b 100644
--- a/tests/replacebot_tests.py
+++ b/tests/replacebot_tests.py
@@ -54,7 +54,6 @@
def patched_login():
"""Do nothing."""
- pass
def patched_site(*args, **kwargs):
"""Patching a Site instance replacing it's login."""
diff --git a/tests/ui_tests.py b/tests/ui_tests.py
index 35e716c..762a0ee 100644
--- a/tests/ui_tests.py
+++ b/tests/ui_tests.py
@@ -136,8 +136,6 @@
"""pywikibot manager class."""
- pass
-
pywikibotManager.register('pywikibot', pywikibotWrapper)
_manager = pywikibotManager(
address=('127.0.0.1', 47228),
diff --git a/tests/utils.py b/tests/utils.py
index d140270..71f8bfe 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -434,7 +434,6 @@
@password.setter
def password(self, value):
"""Ignore password changes."""
- pass
def execute(command, data_in=None, timeout=None, error=None):
diff --git a/tests/wikibase_tests.py b/tests/wikibase_tests.py
index a22e299..a8d9a16 100644
--- a/tests/wikibase_tests.py
+++ b/tests/wikibase_tests.py
@@ -851,7 +851,6 @@
"""Dummy ItemPage subclass."""
- pass
page = pywikibot.Page(self.site, 'foo')
self.assertIsInstance(MyItemPage.fromPage(page, lazy_load=True),
MyItemPage)
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/688282
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I785b6475f5d8c7e54887f72fa38eb7c3cf7ebbd4
Gerrit-Change-Number: 688282
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Isaacandy <isaac(a)iznd.xyz>
Gerrit-Reviewer: Siebrand <siebrand(a)kitano.nl>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/684095 )
Change subject: [doc] Fix conf.pywikibot_epytext_to_sphinx() function
......................................................................
[doc] Fix conf.pywikibot_epytext_to_sphinx() function
Also add some more documentation to pywikibot.Site()
Change-Id: Ia35683f3023e2dadd64dfb6c0802e54aeb34d50e
---
M docs/conf.py
M pywikibot/__init__.py
2 files changed, 39 insertions(+), 2 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/docs/conf.py b/docs/conf.py
index d88005d..4be6958 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -388,7 +388,7 @@
r'\1:\2:', line) # short token
line = re.sub(r'(\A *)@(?:kwarg|kwparam) ',
r'\1:keyword ', line) # keyword
- line = re.sub(r'(\A| )C\{([^}]*)\}', r'\1:py:obj:`\2`', line) # Link
+ line = re.sub(r'(\A| )L\{([^}]*)\}', r'\1:py:obj:`\2`', line) # Link
line = re.sub(r'(\A| )B\{([^}]*)\}', r'\1**\2**', line) # Bold
line = re.sub(r'(\A| )I\{([^}]*)\}', r'\1*\2*', line) # Italic
line = re.sub(r'(\A| )C\{([^}]*)\}', r'\1``\2``', line) # Code
diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index 15b0b0d..3a24dc2 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -1095,12 +1095,49 @@
By default rely on config settings. These defaults may all be overridden
using the method parameters.
+ Creating the default site using config.mylang and config.family::
+
+ site = pywikibot.Site()
+
+ Override default site code::
+
+ site = pywikibot.Site('fr')
+
+ Override default family::
+
+ site = pywikibot.Site(family='wikisource')
+
+ Setting a specific site::
+
+ site = pywikibot.Site('fr', 'wikisource')
+
+ which is equal to::
+
+ site = pywikibot.Site('wikisource:fr')
+
+ :Note: An already created site is cached an a new variable points to
+ the same object if interface, family, code and user are equal:
+
+ >>> import pywikibot
+ >>> site_1 = pywikibot.Site('wikisource:fr')
+ >>> site_2 = pywikibot.Site('fr', 'wikisource')
+ >>> site_1 is site_2
+ True
+ >>> site_1
+ APISite("fr", "wikisource")
+
+ C{APISite} is the default interface. Refer L{pywikibot.site} for
+ other interface types.
+
+ **Never create a site object via interface class directly.**
+ Always use this factory method.
+
@param code: language code (override config.mylang)
code may also be a sitename like 'wikipedia:test'
@param fam: family name or object (override config.family)
@type fam: str or pywikibot.family.Family
@param user: bot user name to use on this site (override config.usernames)
- @param interface: site class or name of class in pywikibot.site
+ @param interface: site class or name of class in L{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
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/684095
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ia35683f3023e2dadd64dfb6c0802e54aeb34d50e
Gerrit-Change-Number: 684095
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-CC: Rubin <rubin.happy(a)gmail.com>
Gerrit-MessageType: merged
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/687414 )
Change subject: Do not use sphinx 4.0
......................................................................
Do not use sphinx 4.0
Change-Id: I71596ac7216fae04c58ca45295cf8b25b5446f38
Signed-off-by: Xqt <info(a)gno.de>
---
M docs/requirements-py3.txt
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/docs/requirements-py3.txt b/docs/requirements-py3.txt
index 4d9bfe4..d455bf2 100644
--- a/docs/requirements-py3.txt
+++ b/docs/requirements-py3.txt
@@ -1,4 +1,4 @@
# This is a PIP requirements file for building Sphinx documentation of pywikibot
# requirements.txt is also needed
-sphinx >= 1.8, != 3.1.0, != 3.5.0
\ No newline at end of file
+sphinx >= 1.8, != 3.1.0, != 3.5.0, != 4.0.0
\ No newline at end of file
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/687414
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I71596ac7216fae04c58ca45295cf8b25b5446f38
Gerrit-Change-Number: 687414
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-CC: Rubin <rubin.happy(a)gmail.com>
Gerrit-MessageType: merged