jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/804761 )

Change subject: [doc] Add references within ROADMAP.rst
......................................................................

[doc] Add references within ROADMAP.rst

- Add some references within ROADMAP.rst
- fix :phab: patterns
- remove pywikibot_fix_phab_tasks function for sphinx because there is no
  remaining task without extlink pattern
- remove pywikibot_skip_members function for sphinx because sphinx
  directives should be used instead and inclusions/exclusions are
  already empty
- update pattern in setup.py to remove sphinx directives
- add sample code in _filepage.py and bot.py

Change-Id: I693000d06eaa396ffe847b2b8c77eeef572538ae
---
M ROADMAP.rst
M docs/conf.py
M pwb.py
M pywikibot/__init__.py
M pywikibot/bot.py
M pywikibot/exceptions.py
M pywikibot/page/_filepage.py
M pywikibot/proofreadpage.py
M setup.py
9 files changed, 32 insertions(+), 39 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/ROADMAP.rst b/ROADMAP.rst
index 08c641a..1bedb6a 100644
--- a/ROADMAP.rst
+++ b/ROADMAP.rst
@@ -5,17 +5,17 @@
 * Show an APIError if PetScanPageGenerator.query() fails (:phab:`T309538`)
 * `login.py` is now a utiliy script even for site-package installation 
(:phab:`T309290`)
 * `preload_sites.py` is now a utiliy script even for site-package installation 
(:phab:`T308912`)
-* `generator_completed` became a public attribute
+* :attr:`generator_completed<pywikibot.bot.BaseBot.generator_completed>` 
became a public attribute
 * Return gracefully from pwb.find_alternates if folder in user_script_paths 
does not exist (:phab:`T308910`)

 Deprecations
 ^^^^^^^^^^^^

-* 7.4.0: `FilePage.usingPages()` was renamed to `using_pages()`
-* 7.2.0: ``tb`` parameter of ``exception()`` function was renamed to 
``exc_info``
-* 7.2.0: XMLDumpOldPageGenerator is deprecated in favour of a `content` 
parameter (:phab:`T306134`)
-* 7.2.0: RedirectPageBot and NoRedirectPageBot bot classes are deprecated in 
favour of `use_redirects` attribute
-* 7.2.0: `tools.formatter.color_format` is deprecated and will be removed
+* 7.4.0: `FilePage.usingPages()` was renamed to 
:meth:`using_pages()<pywikibot.FilePage.using_pages>`
+* 7.2.0: ``tb`` parameter of :func:`exception()<pywikibot.exception>` function 
was renamed to ``exc_info``
+* 7.2.0: XMLDumpOldPageGenerator is deprecated in favour of a `content` 
parameter of `XMLDumpPageGenerator` (:phab:`T306134`)
+* 7.2.0: RedirectPageBot and NoRedirectPageBot bot classes are deprecated in 
favour of :attr:`use_redirects<pywikibot.bot.BaseBot.use_redirects>` attribute
+* 7.2.0: 
:func:`tools.formatter.color_format<pywikibot.tools.formatter.color_format>` is 
deprecated and will be removed
 * 7.1.0: Unused `get_redirect` parameter of Page.getOldVersion() will be 
removed
 * 7.1.0: APISite._simple_request() will be removed in favour of 
APISite.simple_request()
 * 7.0.0: User.isBlocked() method is renamed to is_blocked for consistency
diff --git a/docs/conf.py b/docs/conf.py
index 441a7dd..d8298d9 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -381,15 +381,6 @@
 }


-def pywikibot_fix_phab_tasks(app, what, name, obj, options, lines):
-    """Convert Phabricator tasks id to a link using sphinx.ext.extlinks."""
-    result = []
-    for line in lines:
-        line = re.sub(r'(?<!:phab:`)(T\d{5,6})', r':phab:`\1`', line)
-        result.append(line)
-    lines[:] = result[:]
-
-
 def pywikibot_docstring_fixups(app, what, name, obj, options, lines):
     """Fixup docstrings."""
     if what not in ('class', 'exception'):
@@ -445,20 +436,6 @@
             length = 0


-def pywikibot_skip_members(app, what, name, obj, skip, options):
-    """Skip certain members from documentation."""
-    inclusions = ()
-    exclusions = ()
-    if name in inclusions and len(str.splitlines(obj.__doc__ or '')) >= 3:
-        return False
-    if name.startswith('__') and name.endswith('__'):
-        return True
-    if obj.__doc__ is not None \
-       and ('DEPRECATED' in obj.__doc__ or 'Deprecated' in obj.__doc__):
-        return True
-    return skip or name in exclusions
-
-
 def pywikibot_family_classproperty_getattr(obj, name, *defargs):
     """Custom getattr() to get classproperty instances."""
     from sphinx.util.inspect import safe_getattr
@@ -485,10 +462,8 @@

 def setup(app):
     """Implicit Sphinx extension hook."""
-    app.connect('autodoc-process-docstring', pywikibot_fix_phab_tasks)
     app.connect('autodoc-process-docstring', pywikibot_docstring_fixups)
     app.connect('autodoc-process-docstring', pywikibot_script_docstring_fixups)
-    app.connect('autodoc-skip-member', pywikibot_skip_members)
     app.add_autodoc_attrgetter(type, pywikibot_family_classproperty_getattr)


diff --git a/pwb.py b/pwb.py
index 730bad8..2c9a9a6 100755
--- a/pwb.py
+++ b/pwb.py
@@ -27,7 +27,7 @@
 will fix up search paths so the package does not need to be installed, etc.

 Currently, `<pwb options>` are :ref:`global options`. This can be used
-for tests to set the default site (see T216825)::
+for tests to set the default site (see :phab:`T216825`)::

     python pwb.py -lang:de bot_tests -v

diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py
index e6231e6..3264486 100644
--- a/pywikibot/__init__.py
+++ b/pywikibot/__init__.py
@@ -846,7 +846,7 @@
     """
     A Wikibase representation for data pages.

-    A temporary implementation until T162336 has been resolved.
+    A temporary implementation until :phab:`T162336` has been resolved.

     Note that this class cannot be used directly
     """
diff --git a/pywikibot/bot.py b/pywikibot/bot.py
index ebe226b..3d6fb8b 100644
--- a/pywikibot/bot.py
+++ b/pywikibot/bot.py
@@ -1247,7 +1247,16 @@
     use_redirects = None  # type: Optional[bool]
     """Attribute to determine whether to use redirect pages. Set it to
     True to use redirects only, set it to False to skip redirects. If
-    None both are processed.
+    None both are processed. For example to create a RedirectBot you may
+    define:
+
+    .. code-block:: python
+
+       class MyRedirectBot(ExistingPageBot):
+
+           '''Bot who only works on existing redirects.'''
+
+           use_redirects = True

     .. versionadded:: 7.2
     """
diff --git a/pywikibot/exceptions.py b/pywikibot/exceptions.py
index 8fd93ab..2e2df94 100644
--- a/pywikibot/exceptions.py
+++ b/pywikibot/exceptions.py
@@ -447,7 +447,7 @@
     """
     Page is a redirect to another site.

-    This is considered invalid in Pywikibot. See bug T75184.
+    This is considered invalid in Pywikibot. See bug :phab:`T75184`.

     """

diff --git a/pywikibot/page/_filepage.py b/pywikibot/page/_filepage.py
index 7cc6b58..32fcf9f 100644
--- a/pywikibot/page/_filepage.py
+++ b/pywikibot/page/_filepage.py
@@ -182,6 +182,16 @@
         :meth:`APISite.imageusage()
         <pywikibot.site._generators.GeneratorsMixin.imageusage>`

+        Usage example:
+
+        >>> site = pywikibot.Site('wikipedia:test')
+        >>> file = pywikibot.FilePage(site, 'Pywikibot MW gear icon.svg')
+        >>> used = list(file.using_pages(total=10))
+        >>> len(used)
+        1
+        >>> used[0].title()
+        'Pywikibot'
+
         .. seealso:: :meth:`globalusage`
         .. versionchanged:: 7.2
            all parameters from :meth:`APISite.imageusage()
diff --git a/pywikibot/proofreadpage.py b/pywikibot/proofreadpage.py
index eea8edd..2f98b6c 100644
--- a/pywikibot/proofreadpage.py
+++ b/pywikibot/proofreadpage.py
@@ -771,9 +771,8 @@

     """Subclass of Request which skips the check on write rights.

-    Workaround for T128994.
-    # TODO: remove once bug is fixed.
-    """
+    Workaround for :phab:`T128994`.
+    """  # TODO: remove once bug is fixed.

     def __init__(self, **kwargs: Any) -> None:
         """Monkeypatch action in Request initializer."""
diff --git a/setup.py b/setup.py
index d5f3fcf..37d59dc 100755
--- a/setup.py
+++ b/setup.py
@@ -208,7 +208,7 @@
     Combine included restructured text files which must be done before
     uploading because the source isn't available after creating the package.
     """
-    pattern = r'\:phab\:`(T\d+)`', r'\1'
+    pattern = r'\:\w+\:`([^`]+?)(?:<.+>)?`', r'\1'
     desc = []
     with open(filename) as f:
         for line in f:

--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/804761
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: I693000d06eaa396ffe847b2b8c77eeef572538ae
Gerrit-Change-Number: 804761
Gerrit-PatchSet: 4
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to