jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/824851 )
Change subject: [doc] Add site methods to sphinx index ......................................................................
[doc] Add site methods to sphinx index
- add site, time and logging methods to sphinx index - add synopsis informations to the module index - fix some doc strings - add some type hints
Bug: T315722 Change-Id: Ia05b1d926dd8c4bcfc6994a197ed464acd78c57e --- M docs/api_ref/pywikibot.comms.rst M docs/api_ref/pywikibot.config.rst M docs/api_ref/pywikibot.data.rst M docs/api_ref/pywikibot.families.rst M docs/api_ref/pywikibot.page.rst M docs/api_ref/pywikibot.pagegenerators.rst M docs/api_ref/pywikibot.rst M docs/api_ref/pywikibot.site.rst M docs/api_ref/pywikibot.specialbots.rst M docs/api_ref/pywikibot.tools.rst M docs/api_ref/pywikibot.userinterfaces.rst M docs/utilities/scripts_ref.rst M pywikibot/data/api/_requests.py M pywikibot/families/wikihow_family.py M pywikibot/families/wowwiki_family.py M pywikibot/scripts/__init__.py M pywikibot/site/_datasite.py M pywikibot/site/_decorators.py M pywikibot/site/_extensions.py M pywikibot/userinterfaces/__init__.py 20 files changed, 173 insertions(+), 53 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/docs/api_ref/pywikibot.comms.rst b/docs/api_ref/pywikibot.comms.rst index 0198120..16f2c32 100644 --- a/docs/api_ref/pywikibot.comms.rst +++ b/docs/api_ref/pywikibot.comms.rst @@ -2,6 +2,7 @@ ====================
.. automodule:: comms + :synopsis: Communication layer
Submodules ---------- @@ -10,10 +11,10 @@ --------------------------------
.. automodule:: comms.eventstreams + :synopsis: Server-Sent Events client
:mod:`comms.http` module ------------------------
.. automodule:: comms.http - - + :synopsis: Basic HTTP access interface diff --git a/docs/api_ref/pywikibot.config.rst b/docs/api_ref/pywikibot.config.rst index 68c6f02..2197a12 100644 --- a/docs/api_ref/pywikibot.config.rst +++ b/docs/api_ref/pywikibot.config.rst @@ -5,6 +5,7 @@ ^^^^^^^^^^^^^
.. automodule:: config + :synopsis: Module to define and load pywikibot configuration default and user preferences
Option setting ^^^^^^^^^^^^^^ diff --git a/docs/api_ref/pywikibot.data.rst b/docs/api_ref/pywikibot.data.rst index 16d02fa..7eb2c10 100644 --- a/docs/api_ref/pywikibot.data.rst +++ b/docs/api_ref/pywikibot.data.rst @@ -2,6 +2,7 @@ ===================
.. automodule:: data + :synopsis:
Submodules ---------- @@ -10,25 +11,28 @@ ----------------------
.. automodule:: data.api + :synopsis: Module providing several layers of data access to the wiki
:mod:`data.memento` module --------------------------
.. automodule:: data.memento + :synopsis: Fix ups for memento-client package version 0.6.1
:mod:`data.mysql` module ------------------------
.. automodule:: data.mysql + :synopsis: Miscellaneous helper functions for mysql queries
:mod:`data.sparql` module -------------------------
.. automodule:: data.sparql + :synopsis: SPARQL Query interface
:mod:`data.wikistats` module ----------------------------
.. automodule:: data.wikistats - - + :synopsis: Objects representing WikiStats API diff --git a/docs/api_ref/pywikibot.families.rst b/docs/api_ref/pywikibot.families.rst index ce5f8f0..8a8245f 100644 --- a/docs/api_ref/pywikibot.families.rst +++ b/docs/api_ref/pywikibot.families.rst @@ -2,6 +2,7 @@ =======================
.. automodule:: families + :synopsis: Families package
Submodules ---------- @@ -10,133 +11,160 @@ --------------------------------------
.. automodule:: families.commons_family + :synopsis: Family module for Wikimedia Commons
:mod:`families.foundation_family` module -----------------------------------------
.. automodule:: families.foundation_family + :synopsis: Family module for Foundation wiki
:mod:`families.i18n_family` module -----------------------------------
.. automodule:: families.i18n_family + :synopsis: Family module for Translate Wiki
:mod:`families.incubator_family` module ----------------------------------------
.. automodule:: families.incubator_family + :synopsis: Family module for Incubator Wiki
:mod:`families.lingualibre_family` module ------------------------------------------
.. automodule:: families.lingualibre_family + :synopsis: Family module for Lingua Libre
:mod:`families.mediawiki_family` module ----------------------------------------
.. automodule:: families.mediawiki_family + :synopsis: Family module for MediaWiki wiki
:mod:`families.meta_family` module -----------------------------------
.. automodule:: families.meta_family + :synopsis: Family module for Meta Wiki
:mod:`families.omegawiki_family` module ----------------------------------------
.. automodule:: families.omegawiki_family + :synopsis: Family module for Omega Wiki
:mod:`families.osm_family` module ----------------------------------
.. automodule:: families.osm_family + :synopsis: Family module for OpenStreetMap wiki
:mod:`families.outreach_family` module ---------------------------------------
.. automodule:: families.outreach_family + :synopsis: Family module for Wikimedia outreach wiki
:mod:`families.species_family` module --------------------------------------
.. automodule:: families.species_family + :synopsis: Family module for Wikimedia species wiki
:mod:`families.vikidia_family` module --------------------------------------
.. automodule:: families.vikidia_family + :synopsis: Family module for Vikidia
:mod:`families.wikibooks_family` module ----------------------------------------
.. automodule:: families.wikibooks_family + :synopsis: Family module for Wikibooks
:mod:`families.wikidata_family` module ---------------------------------------
.. automodule:: families.wikidata_family + :synopsis: Family module for Wikidata
:mod:`families.wikihow_family` module --------------------------------------
.. automodule:: families.wikihow_family + :synopsis: Family module for Wikihow wiki
:mod:`families.wikimania_family` module ----------------------------------------
.. automodule:: families.wikimania_family + :synopsis: Family module for Wikimania wikis
:mod:`families.wikimediachapter_family` module -----------------------------------------------
.. automodule:: families.wikimediachapter_family + :synopsis: Family module for Wikimedia chapter, thematic organisation and WUG wikis
:mod:`families.wikinews_family` module ---------------------------------------
.. automodule:: families.wikinews_family + :synopsis: Family module for Wikinews
:mod:`families.wikipedia_family` module ----------------------------------------
.. automodule:: families.wikipedia_family + :synopsis: Family module for Wikipedia
:mod:`families.wikiquote_family` module ----------------------------------------
.. automodule:: families.wikiquote_family + :synopsis: Family module for Wikiquote
:mod:`families.wikisource_family` module -----------------------------------------
.. automodule:: families.wikisource_family + :synopsis:Family module for Wikisource
:mod:`families.wikisopore_family` module -----------------------------------------
.. automodule:: families.wikispore_family + :synopsis: Family module for Wikispore
:mod:`families.wikitech_family` module ---------------------------------------
.. automodule:: families.wikitech_family + :synopsis: Family module for Wikitech
:mod:`families.wikiversity_family` module ------------------------------------------
.. automodule:: families.wikiversity_family + :synopsis: Family module for Wikiversity
:mod:`families.wikivoyage_family` module -----------------------------------------
.. automodule:: families.wikivoyage_family + :synopsis: Family module for Wikivoyage
:mod:`families.wiktionary_family` module -----------------------------------------
.. automodule:: families.wiktionary_family + :synopsis: Family module for Wiktionary
:mod:`families.wowwiki_family` module --------------------------------------
.. automodule:: families.wowwiki_family + :synopsis: Family module for WOW wiki diff --git a/docs/api_ref/pywikibot.page.rst b/docs/api_ref/pywikibot.page.rst index a990fb5..18e7eb7 100644 --- a/docs/api_ref/pywikibot.page.rst +++ b/docs/api_ref/pywikibot.page.rst @@ -2,6 +2,7 @@ ===================
.. automodule:: page + :synopsis: Interface of various types of MediaWiki pages
Submodules ---------- @@ -10,13 +11,16 @@ --------------------------------
.. automodule:: page._collections + :synopsis: Structures holding data for Wikibase entities
:mod:`page._decorators` module -------------------------------
.. automodule:: page._decorators + :synopsis: Decorators for Page objects
:mod:`page._revision` module -----------------------------
.. automodule:: page._revision + :synopsis: Object representing page revision diff --git a/docs/api_ref/pywikibot.pagegenerators.rst b/docs/api_ref/pywikibot.pagegenerators.rst index 6d5dc64..72aef9c 100644 --- a/docs/api_ref/pywikibot.pagegenerators.rst +++ b/docs/api_ref/pywikibot.pagegenerators.rst @@ -2,18 +2,22 @@ =============================
.. automodule:: pagegenerators + :synopsis: This module offers a wide variety of page generators
:mod:`pagegenerators._factory` module --------------------------------------
.. automodule:: pagegenerators._factory + :synopsis: GeneratorFactory module wich handles pagegenerators options
:mod:`pagegenerators._filters` module --------------------------------------
.. automodule:: pagegenerators._filters + :synopsis: Page filter generators provided by the pagegenerators module
:mod:`pagegenerators._generators` module -----------------------------------------
.. automodule:: pagegenerators._generators + :synopsis: Page filter generators provided by the pagegenerators module diff --git a/docs/api_ref/pywikibot.rst b/docs/api_ref/pywikibot.rst index fc8e54b..53aebe5 100644 --- a/docs/api_ref/pywikibot.rst +++ b/docs/api_ref/pywikibot.rst @@ -25,17 +25,20 @@ -----------------------
.. automodule:: backports + :synopsis: This module contains backports to support older Python versions
:mod:`bot` module -----------------
.. automodule:: bot - :member-order: bysource + :synopsis: User-interface related functions for building bots + :member-order: bysource
:mod:`bot_choice` module -------------------------
.. automodule:: bot_choice + :synopsis: Options and Choices for :func:`pywikibot.input_choice`
.. include:: pywikibot.config.rst
@@ -43,125 +46,147 @@ -------------------------------
.. automodule:: cosmetic_changes + :synopsis: This module can do slight modifications to tidy a wiki page's source code
:mod:`daemonize` module -----------------------
.. automodule:: daemonize + :synopsis: Module to daemonize the current process on Unix.
:mod:`date` module ------------------
.. automodule:: date + :synopsis: Date data and manipulation module
:mod:`diff` module ------------------
.. automodule:: diff + :synopsis: Diff module
:mod:`echo` module ------------------
.. automodule:: echo + :synopsis: Classes and functions for working with the Echo extension
:mod:`editor` module --------------------
.. automodule:: editor + :synopsis: Text editor class for your favourite editor
:mod:`exceptions` module ------------------------
.. automodule:: exceptions + :synopsis: Pywikibot exceptions and warning classes
:mod:`family` module --------------------
.. automodule:: family + :synopsis: Objects representing MediaWiki families
:mod:`fixes` module -------------------
.. automodule:: fixes + :synopsis: File containing all standard fixes
:mod:`flow` module ------------------
.. automodule:: flow + :synopsis: Objects representing Flow entities, like boards, topics, and posts
:mod:`i18n` module ------------------
.. automodule:: i18n + :synopsis: Various i18n functions
:mod:`interwiki_graph` module ------------------------------
.. automodule:: interwiki_graph + :synopsis: Module with the Graphviz drawing calls
:mod:`logentries` module ------------------------
.. automodule:: logentries + :synopsis: Objects representing Mediawiki log entries
.. module:: logging + :synopsis: User output/logging functions
:mod:`logging` module ---------------------
.. automodule:: pywikibot.logging :member-order: bysource - :noindex:
:mod:`login` module -------------------
.. automodule:: login + :synopsis: Library to log the bot in to a wiki account
:mod:`plural` module --------------------
.. automodule:: plural + :synopsis: Module containing plural rules of various languages
:mod:`proofreadpage` module ---------------------------
.. automodule:: proofreadpage + :synopsis: Objects used with ProofreadPage Extension
:mod:`site_detect` module --------------------------
.. automodule:: site_detect + :synopsis: Classes for detecting a MediaWiki site
:mod:`textlib` module ---------------------
.. automodule:: textlib + :synopsis: Functions for manipulating wiki-text
:mod:`throttle` module ----------------------
.. automodule:: throttle + :synopsis: Mechanics to slow down wiki read and/or write rate
.. module:: time + :synopsis: Time handling module
:mod:`time` module ------------------
.. automodule:: pywikibot.time - :noindex:
:mod:`titletranslate` module ----------------------------
.. automodule:: titletranslate + :synopsis: Title translate module
:mod:`version` module ---------------------
.. automodule:: version + :synopsis: Module to determine the pywikibot version (tag, revision and date)
:mod:`xmlreader` module -----------------------
.. automodule:: xmlreader + :synopsis: XML reading module diff --git a/docs/api_ref/pywikibot.site.rst b/docs/api_ref/pywikibot.site.rst index 8fe9b46..77093b3 100644 --- a/docs/api_ref/pywikibot.site.rst +++ b/docs/api_ref/pywikibot.site.rst @@ -2,6 +2,8 @@ ===================
.. py:module:: site + :synopsis: Library module representing MediaWiki sites (wikis) + .. automodule:: pywikibot.site :no-members: :noindex: @@ -10,61 +12,68 @@ -------------------------------------------------
.. py:module:: site._basesite + :synopsis: Objects with site methods independent of the communication interface + .. automodule:: pywikibot.site._basesite - :noindex:
.. py:module:: site._apisite + :synopsis: Objects representing API interface to MediaWiki site
:mod:`APISite<pywikibot.site._apisite>` Package ------------------------------------------------
.. automodule:: pywikibot.site._apisite - :noindex:
.. automodule:: pywikibot.site._extensions - :noindex: + :synopsis: Objects representing API interface to MediaWiki site extenstions
.. automodule:: pywikibot.site._generators - :noindex: + :synopsis: Objects representing API generators to MediaWiki site
:mod:`DataSite<pywikibot.site._datasite>` Package --------------------------------------------------
.. py:module:: site._datasite + :synopsis: Objects representing API interface to Wikibase site + .. automodule:: pywikibot.site._datasite - :noindex:
:mod:`Obsolete Sites<pywikibot.site._obsoletesites>` Package ------------------------------------------------------------
.. py:module:: site._obsoletesites + :synopsis: Objects representing obsolete MediaWiki sites + .. automodule:: pywikibot.site._obsoletesites - :noindex:
:mod:`Siteinfo<pywikibot.site._siteinfo>` Package -------------------------------------------------
.. py:module:: site._siteinfo + :synopsis: Objects representing site info data contents + .. automodule:: pywikibot.site._siteinfo - :noindex:
:mod:`Namespace<pywikibot.site._namespace>` Package ---------------------------------------------------
.. py:module:: site._namespace + :synopsis: Objects representing Namespaces of MediaWiki site + .. automodule:: pywikibot.site._namespace - :noindex:
:mod:`TokenWallet<pywikibot.site._tokenwallet>` Package -------------------------------------------------------
.. py:module:: site._tokenwallet + :synopsis: Objects representing api tokens + .. automodule:: pywikibot.site._tokenwallet - :noindex:
:mod:`Uploader<pywikibot.site._upload>` Package -----------------------------------------------
.. py:module:: site._upload + :synopsis: Objects representing API upload to MediaWiki site + .. automodule:: pywikibot.site._upload - :noindex: diff --git a/docs/api_ref/pywikibot.specialbots.rst b/docs/api_ref/pywikibot.specialbots.rst index 7a84fe0..ee34884 100644 --- a/docs/api_ref/pywikibot.specialbots.rst +++ b/docs/api_ref/pywikibot.specialbots.rst @@ -2,3 +2,4 @@ ==========================
.. automodule:: specialbots + :synopsis: Module containing special bots reusable by scripts \ No newline at end of file diff --git a/docs/api_ref/pywikibot.tools.rst b/docs/api_ref/pywikibot.tools.rst index caff513..5b46ea8 100644 --- a/docs/api_ref/pywikibot.tools.rst +++ b/docs/api_ref/pywikibot.tools.rst @@ -2,38 +2,46 @@ ====================
.. automodule:: tools + :synopsis: Miscellaneous helper functions (not wiki-dependent)
:mod:`tools.chars` module -------------------------
.. automodule:: tools.chars + :synopsis: Character based helper functions (not wiki-dependent)
:mod:`tools.collections` module -------------------------------
.. automodule:: tools.collections + :synopsis: Collections datatypes
:mod:`tools.deprecate` module -----------------------------
.. automodule:: tools._deprecate + :synopsis: Module providing deprecation decorators
:mod:`tools.djvu` module ------------------------
.. automodule:: tools.djvu + :synopsis: Wrapper around djvulibre to access djvu files properties and content
:mod:`tools.formatter` module -----------------------------
.. automodule:: tools.formatter + :synopsis: Module containing various formatting related utilities
:mod:`tools.itertools` module -----------------------------
.. automodule:: tools.itertools + :synopsis: Iterator functions
:mod:`tools._logging` module -----------------------------
.. automodule:: tools._logging + :synopsis: Logging tools diff --git a/docs/api_ref/pywikibot.userinterfaces.rst b/docs/api_ref/pywikibot.userinterfaces.rst index 0885943..bf08f20 100644 --- a/docs/api_ref/pywikibot.userinterfaces.rst +++ b/docs/api_ref/pywikibot.userinterfaces.rst @@ -2,48 +2,58 @@ =============================
.. automodule:: userinterfaces + :synopsis: User interfaces module
:mod:`_interface_base` module -------------------------------
.. automodule:: userinterfaces._interface_base + :synopsis: Abstract base user interface module
:mod:`terminal_interface` module ---------------------------------
.. automodule:: userinterfaces.terminal_interface + :synopsis: Platform independent terminal interface module
:mod:`terminal_interface_base` module ---------------------------------------
.. automodule:: userinterfaces.terminal_interface_base + :synopsis: Base for terminal user interfaces
:mod:`terminal_interface_unix` module ---------------------------------------
.. automodule:: userinterfaces.terminal_interface_unix + :synopsis: User interface for Unix terminals
:mod:`terminal_interface_win32` module ----------------------------------------
.. automodule:: userinterfaces.terminal_interface_win32 + :synopsis: User interface for Win32 terminals
:mod:`buffer_interface` module -------------------------------
.. automodule:: userinterfaces.buffer_interface + :synopsis: Non-interactive interface that stores output
:mod:`gui` module -----------------
.. automodule:: userinterfaces.gui + :synopsis: A window with a textfield where the user can edit
:mod:`transliteration` module -----------------------------
.. automodule:: userinterfaces.transliteration + :synopsis: Module to transliterate text
:mod:`win32_unicode` module ----------------------------
.. automodule:: userinterfaces.win32_unicode + :synopsis: Unicode support for stdout, stderr and argv with Python 3.5. diff --git a/docs/utilities/scripts_ref.rst b/docs/utilities/scripts_ref.rst index 4720fbf..890aef8 100644 --- a/docs/utilities/scripts_ref.rst +++ b/docs/utilities/scripts_ref.rst @@ -2,39 +2,47 @@ ===============
.. automodule:: pywikibot.scripts + :synopsis: Folder which holds framework scripts :private-members:
pwb wrapper script ------------------
.. automodule:: pwb + :synopsis: Wrapper script to invoke pywikibot-based scripts
generate_family_file script -----------------------------
.. automodule:: pywikibot.scripts.generate_family_file + :synopsis: This script generates a family file from a given URL
generate_user_files script ----------------------------
.. automodule:: pywikibot.scripts.generate_user_files + :synopsis: Script to create user-config.py
login script ------------
.. automodule:: pywikibot.scripts.login + :synopsis: Script to log the bot in to a wiki account
preload_sites script --------------------
.. automodule:: pywikibot.scripts.preload_sites + :synopsis: Script that preloads site and user info for all sites of given family
shell script ------------
.. automodule:: pywikibot.scripts.shell + :synopsis: Spawns an interactive Python shell and imports the pywikibot library
version script --------------
.. automodule:: pywikibot.scripts.version + :synopsis: Script to determine the Pywikibot version (tag, revision and date) diff --git a/pywikibot/data/api/_requests.py b/pywikibot/data/api/_requests.py index e48c102..4d26391 100644 --- a/pywikibot/data/api/_requests.py +++ b/pywikibot/data/api/_requests.py @@ -859,7 +859,7 @@ return False
def _internal_api_error(self, code, error, result) -> bool: - """Check for internal_api_error_ or readonly and retry. + """Check for ``internal_api_error_`` or readonly and retry.
:raises pywikibot.exceptions.APIMWError: internal_api_error or readonly """ diff --git a/pywikibot/families/wikihow_family.py b/pywikibot/families/wikihow_family.py index 943137a..c3b3650 100644 --- a/pywikibot/families/wikihow_family.py +++ b/pywikibot/families/wikihow_family.py @@ -1,4 +1,4 @@ -"""Family module for Wikihow Wiki. +"""Family module for Wikihow wiki.
.. versionadded:: 3.0 """ diff --git a/pywikibot/families/wowwiki_family.py b/pywikibot/families/wowwiki_family.py index ad6c901..64e6854 100644 --- a/pywikibot/families/wowwiki_family.py +++ b/pywikibot/families/wowwiki_family.py @@ -1,4 +1,4 @@ -"""Family module for WOW Wiki.""" +"""Family module for WOW wiki.""" # # (C) Pywikibot team, 2009-2021 # diff --git a/pywikibot/scripts/__init__.py b/pywikibot/scripts/__init__.py index fca31b6..a75744f 100644 --- a/pywikibot/scripts/__init__.py +++ b/pywikibot/scripts/__init__.py @@ -5,11 +5,16 @@
.. versionadded:: 7.0 """ +# +# (C) Pywikibot team, 2021-2022 +# +# Distributed under the terms of the MIT license +# from os import environ, getenv
def _import_with_no_user_config(*import_args): - """Return __import__(*import_args) without loading user-config.py. + """Return ``__import__(*import_args)`` without loading user-config.py.
.. versionadded:: 3.0 .. versionchanged:: 7.0 diff --git a/pywikibot/site/_datasite.py b/pywikibot/site/_datasite.py index 3b16ac1..a13e8a1 100644 --- a/pywikibot/site/_datasite.py +++ b/pywikibot/site/_datasite.py @@ -299,17 +299,18 @@ return req.submit()
@need_right('edit') - def addClaim(self, entity, claim, bot: bool = True, summary=None) -> None: + def addClaim(self, + entity: 'pywikibot.page.WikibaseEntity', + claim: 'pywikibot.page.Claim', + bot: bool = True, + summary: Optional[str] = None) -> None: """ Add a claim.
:param entity: Entity to modify - :type entity: WikibaseEntity :param claim: Claim to be added - :type claim: pywikibot.Claim :param bot: Whether to mark the edit as a bot edit :param summary: Edit summary - :type summary: str """ claim.snak = entity.getID() + '$' + str(uuid.uuid4()) params = {'action': 'wbsetclaim', @@ -359,15 +360,15 @@ return req.submit()
@need_right('edit') - def save_claim(self, claim, summary=None, bot: bool = True): + def save_claim(self, claim: 'pywikibot.page.Claim', + summary: Optional[str] = None, + bot: bool = True): """ Save the whole claim to the wikibase site.
:param claim: The claim to save - :type claim: pywikibot.Claim :param bot: Whether to mark the edit as a bot edit :param summary: Edit summary - :type summary: str """ if claim.isReference or claim.isQualifier: raise NotImplementedError @@ -776,31 +777,39 @@ Supported actions are: wbsetaliases, wbsetdescription, wbsetlabel and wbsetsitelink
+ wbsetaliases: + dict shall have the following structure: + + .. code-block:: + + { + 'language': value (str), + 'add': list of language codes (str), + 'remove': list of language codes (str), + 'set' list of language codes (str) + } + + 'add' and 'remove' are alternative to 'set' + + wbsetdescription and wbsetlabel: + dict shall have keys 'language', 'value' + + wbsetsitelink: + dict shall have keys 'linksite', 'linktitle' and + optionally 'badges' + :param itemdef: Entity to modify or create :type itemdef: str, WikibaseEntity or Page connected to such item :param action: wbset{action} to perform: 'wbsetaliases', 'wbsetdescription', 'wbsetlabel', 'wbsetsitelink' :param action_data: data to be used in API request, see API help :type action_data: SiteLink or dict - wbsetaliases: - dict shall have the following structure: - {'language': value (str), - 'add': list of language codes (str), - 'remove': list of language codes (str), - 'set' list of language codes (str) - } - 'add' and 'remove' are alternative to 'set' - wbsetdescription and wbsetlabel: - dict shall have keys 'language', 'value' - wbsetsitelink: - dict shall have keys 'linksite', 'linktitle' and - optionally 'badges' :keyword bot: Whether to mark the edit as a bot edit, default is True :type bot: bool :keyword tags: Change tags to apply with the edit :type tags: list of str :return: query result - :raises AssertionError, TypeError + :raises: AssertionError, TypeError """ def format_sitelink(sitelink): """Convert SiteLink to a dict accepted by wbsetsitelink API.""" diff --git a/pywikibot/site/_decorators.py b/pywikibot/site/_decorators.py index abed42e..d8fc123 100644 --- a/pywikibot/site/_decorators.py +++ b/pywikibot/site/_decorators.py @@ -1,20 +1,21 @@ """Decorators used by site models.""" # -# (C) Pywikibot team, 2008-2021 +# (C) Pywikibot team, 2008-2022 # # Distributed under the terms of the MIT license. # +from typing import Optional + from pywikibot.exceptions import UnknownExtensionError, UserRightsError from pywikibot.tools import MediaWikiVersion, manage_wrapping
-def must_be(group=None): +def must_be(group: Optional[str] = None): """Decorator to require a certain user status when method is called.
:param group: The group the logged in user should belong to. This parameter can be overridden by keyword argument 'as_group'. - :type group: str or None :return: method decorator :raises UserRightsError: user is not part of the required user group. """ @@ -68,11 +69,10 @@ return decorator
-def need_right(right=None): +def need_right(right: Optional[str] = None): """Decorator to require a certain user right when method is called.
:param right: The right the logged in user should have. - :type right: str or None :return: method decorator :raises UserRightsError: user has insufficient rights. """ diff --git a/pywikibot/site/_extensions.py b/pywikibot/site/_extensions.py index cafa212..1290db8 100644 --- a/pywikibot/site/_extensions.py +++ b/pywikibot/site/_extensions.py @@ -86,12 +86,15 @@ The following info is returned by the query and cached: - self._proofread_index_ns: Index Namespace - self._proofread_page_ns: Page Namespace - - self._proofread_levels: a dictionary with: - keys: int in the range [0, 1, ..., 4] - values: category name corresponding to the 'key' quality level + - self._proofread_levels: a dictionary with:: + + keys: int in the range [0, 1, ..., 4] + values: category name corresponding to the 'key' quality level e.g. on en.wikisource: - {0: 'Without text', 1: 'Not proofread', 2: 'Problematic', - 3: 'Proofread', 4: 'Validated'} + + .. code-block:: + {0: 'Without text', 1: 'Not proofread', 2: 'Problematic', + 3: 'Proofread', 4: 'Validated'}
:param expiry: either a number of days or a datetime.timedelta object :type expiry: int (days), :py:obj:`datetime.timedelta`, False (config) diff --git a/pywikibot/userinterfaces/__init__.py b/pywikibot/userinterfaces/__init__.py index 5c20a19..0487523 100644 --- a/pywikibot/userinterfaces/__init__.py +++ b/pywikibot/userinterfaces/__init__.py @@ -1,4 +1,4 @@ -"""User interfaces Module. +"""User interfaces module.
The user interface object must define its own `init_handlers()` method which takes the root logger as its only argument, and which adds to that