jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1009637?usp=email )
Change subject: sort imports ......................................................................
sort imports
plus minor syntax upgrades
Change-Id: I9216361424ef5339454f94e372ad2be372feffca --- M ROADMAP.rst M docs/conf.py M pywikibot/__init__.py M pywikibot/__metadata__.py M pywikibot/site/_generators.py M pywikibot/time.py M pywikibot/tools/__init__.py M setup.py M tests/setup_tests.py 9 files changed, 26 insertions(+), 18 deletions(-)
Approvals: JJMC89: Looks good to me, approved jenkins-bot: Verified
diff --git a/ROADMAP.rst b/ROADMAP.rst index a7e5b9e..23ce3ae 100644 --- a/ROADMAP.rst +++ b/ROADMAP.rst @@ -103,7 +103,7 @@ * 9.0.0: ``filter`` parameter of :func:`date.dh` was renamed to ``filter_func`` * 9.0.0: ``dict`` parameter of :class:`data.api.OptionSet` was renamed to ``data`` * 9.0.0: ``pywikibot.version.get_toolforge_hostname()`` is deprecated without replacement -* 9.0.0: ``allrevisions`` parameter of :class:`xmlreader.XmpDump` is deprecated, use ``revisions`` instead +* 9.0.0: ``allrevisions`` parameter of :class:`xmlreader.XmpDump` is deprecated, use ``revisions`` instead (:phab:`T340804`) * 9.0.0: ``iteritems`` method of :class:`data.api.Request` will be removed in favour of ``items`` * 9.0.0: ``SequenceOutputter.output()`` is deprecated in favour of :attr:`tools.formatter.SequenceOutputter.out` diff --git a/docs/conf.py b/docs/conf.py index 050b0ad..2ccabf7 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -24,10 +24,11 @@ import os import re import sys -import tomli import warnings from pathlib import Path
+import tomli +
# Deprecated classes will generate warnings as Sphinx processes them. # Ignoring them. diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py index 0639acd..f03fef5 100644 --- a/pywikibot/__init__.py +++ b/pywikibot/__init__.py @@ -14,7 +14,7 @@ from contextlib import suppress from queue import Queue from time import sleep as time_sleep -from typing import Any, TYPE_CHECKING, cast +from typing import TYPE_CHECKING, Any, cast from urllib.parse import urlparse from warnings import warn
diff --git a/pywikibot/__metadata__.py b/pywikibot/__metadata__.py index 9460e54..8f92c6c 100644 --- a/pywikibot/__metadata__.py +++ b/pywikibot/__metadata__.py @@ -7,6 +7,8 @@ # # Distributed under the terms of the MIT license. # +from __future__ import annotations + from time import strftime
diff --git a/pywikibot/site/_generators.py b/pywikibot/site/_generators.py index 50cf999..457ae3c 100644 --- a/pywikibot/site/_generators.py +++ b/pywikibot/site/_generators.py @@ -35,6 +35,7 @@
if TYPE_CHECKING: from data.api import ParamInfo, Request + from pywikibot.site._apisite import _RequestWrapperT from pywikibot.site._namespace import NamespacesDict, SingleNamespaceType from pywikibot.site._tokenwallet import TokenWallet diff --git a/pywikibot/time.py b/pywikibot/time.py index c26082b..002ce51 100644 --- a/pywikibot/time.py +++ b/pywikibot/time.py @@ -19,10 +19,10 @@
import pywikibot from pywikibot.tools import ( - classproperty, - deprecated, PYTHON_VERSION, SPHINX_RUNNING, + classproperty, + deprecated, )
@@ -361,7 +361,7 @@ return self.isoformat()
@classmethod - def nowutc(cls, *, with_tz: bool = True) -> 'Timestamp': + def nowutc(cls, *, with_tz: bool = True) -> Timestamp: """Return the current UTC date and time.
If *with_tz* is True it returns an aware :class:`Timestamp` @@ -403,7 +403,7 @@ return cls(*gmt[:6], us)
@classmethod - def utcnow(cls) -> 'Timestamp': + def utcnow(cls) -> Timestamp: """Return the current UTC date and time, with `tzinfo` ``None``.
This is like :meth:`Timestamp.now`, but returns the current UTC diff --git a/pywikibot/tools/__init__.py b/pywikibot/tools/__init__.py index a5ddcd6..586684e 100644 --- a/pywikibot/tools/__init__.py +++ b/pywikibot/tools/__init__.py @@ -42,10 +42,10 @@
import pywikibot # T306760 from pywikibot.backports import ( - Callable, - importlib_metadata, PYTHON_VERSION, SPHINX_RUNNING, + Callable, + importlib_metadata, ) from pywikibot.tools._deprecate import ( ModuleDeprecationWrapper, diff --git a/setup.py b/setup.py index e37e1f1..5428b45 100755 --- a/setup.py +++ b/setup.py @@ -34,12 +34,6 @@ from pathlib import Path
-if sys.version_info[:3] >= (3, 9): - List = list -else: - from typing import List - - # ------- setup extra_requires ------- # extra_deps = { # Core library dependencies @@ -168,7 +162,7 @@
try: tags = run(['git', 'tag'], check=True, stdout=PIPE, - universal_newlines=True).stdout.splitlines() + text=True).stdout.splitlines() except Exception as e: print(e) sys.exit('Creating source distribution canceled.') @@ -223,7 +217,7 @@ return ''.join(desc)
-def get_packages(name: str) -> List[str]: +def get_packages(name: str) -> list[str]: """Find framework packages.""" try: from setuptools import find_namespace_packages diff --git a/tests/setup_tests.py b/tests/setup_tests.py old mode 100644 new mode 100755 index b2cbe24..174aed5 --- a/tests/setup_tests.py +++ b/tests/setup_tests.py @@ -14,7 +14,6 @@
import pywikibot import setup - from tests.aspects import TestCase
pywikibot-commits@lists.wikimedia.org