jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1057956?usp=email )
Change subject: automatically sort imports ......................................................................
automatically sort imports
Change-Id: Id3241f339b2997d018f34cad212bef6e2136815e --- M pywikibot/bot.py M pywikibot/logging.py M pywikibot/page/_basepage.py M pywikibot/page/_toolforge.py M scripts/__init__.py M scripts/commons_information.py M tests/__init__.py M tests/archivebot_tests.py M tests/aspects.py M tests/basesite_tests.py M tests/category_bot_tests.py M tests/data/fixes.py M tests/data/set-fixes.py M tests/djvu_tests.py M tests/edit_tests.py M tests/l10n_tests.py M tests/namespace_tests.py M tests/page_tests.py M tests/pagegenerators_tests.py M tests/patrolbot_tests.py M tests/pwb_tests.py M tests/replacebot_tests.py M tests/script_tests.py M tests/site_generators_tests.py M tests/sparql_tests.py M tests/textlib_tests.py M tests/thanks_tests.py M tests/timestripper_tests.py M tests/ui_options_tests.py M tests/ui_tests.py M tests/utils.py 31 files changed, 33 insertions(+), 1 deletion(-)
Approvals: jenkins-bot: Verified JJMC89: Looks good to me, approved
diff --git a/pywikibot/bot.py b/pywikibot/bot.py index cdb9230..59780d3 100644 --- a/pywikibot/bot.py +++ b/pywikibot/bot.py @@ -169,6 +169,7 @@ VersionParseError, WikiBaseError, ) + # the constants are from pywikibot.logging import ( # noqa: F401 CRITICAL, diff --git a/pywikibot/logging.py b/pywikibot/logging.py index 225b30f..1091e45 100644 --- a/pywikibot/logging.py +++ b/pywikibot/logging.py @@ -30,6 +30,7 @@ # from __future__ import annotations
+ __all__ = ( 'CRITICAL', 'DEBUG', 'ERROR', 'INFO', 'WARNING', 'STDOUT', 'VERBOSE', 'INPUT', diff --git a/pywikibot/page/_basepage.py b/pywikibot/page/_basepage.py index 0223c20..f6b1bab 100644 --- a/pywikibot/page/_basepage.py +++ b/pywikibot/page/_basepage.py @@ -38,9 +38,9 @@ from pywikibot.tools import ( ComparableMixin, cached, + deprecate_positionals, deprecated, deprecated_args, - deprecate_positionals, first_upper, issue_deprecation_warning, remove_last_args, diff --git a/pywikibot/page/_toolforge.py b/pywikibot/page/_toolforge.py index cd41964..2d64209 100644 --- a/pywikibot/page/_toolforge.py +++ b/pywikibot/page/_toolforge.py @@ -17,6 +17,7 @@ from pywikibot import textlib from pywikibot.tools import deprecated, deprecated_args
+ try: import wikitextparser except ImportError as e: @@ -24,6 +25,7 @@
if TYPE_CHECKING: import datetime + from pywikibot import Timestamp DATETYPE = str | Timestamp | datetime.datetime | datetime.date | None
diff --git a/scripts/__init__.py b/scripts/__init__.py index 9772875..67c172f 100644 --- a/scripts/__init__.py +++ b/scripts/__init__.py @@ -31,4 +31,5 @@ # from __future__ import annotations
+ __version__ = '9.4.0' diff --git a/scripts/commons_information.py b/scripts/commons_information.py index 77eb3dc..7da3aa6 100755 --- a/scripts/commons_information.py +++ b/scripts/commons_information.py @@ -73,6 +73,7 @@ from pywikibot import config, i18n, pagegenerators from pywikibot.bot import ExistingPageBot, SingleSiteBot
+ # This is required for the text that is shown when you run this script # with the parameter -help or without parameters. docuReplacements = {'¶ms;': pagegenerators.parameterHelp} # noqa: N816 diff --git a/tests/__init__.py b/tests/__init__.py index 43aed9d..3b7db6b 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -6,6 +6,7 @@ # from __future__ import annotations
+ __all__ = ( 'create_path_func', 'join_cache_path', 'join_data_path', 'join_html_data_path', 'join_images_path', 'join_pages_path', @@ -33,6 +34,7 @@ from pywikibot.data.api import CachedRequest from pywikibot.data.api import Request as _original_Request
+ _root_dir = os.path.split(os.path.split(__file__)[0])[0]
WARN_SITE_CODE = '^Site .*:.* instantiated using different code *' # T234147 diff --git a/tests/archivebot_tests.py b/tests/archivebot_tests.py index 29361f8..479e57b 100755 --- a/tests/archivebot_tests.py +++ b/tests/archivebot_tests.py @@ -17,6 +17,7 @@ from scripts import archivebot from tests.aspects import TestCase
+ THREADS = { 'als': 4, 'ar': 1, 'bar': 0, 'bg': 0, 'bjn': 1, 'bs': 0, 'ca': 5, 'ckb': 2, 'cs': 0, 'de': 1, 'en': 25, 'eo': 2, 'es': 13, 'fa': 2, 'fr': 25, 'frr': 2, diff --git a/tests/aspects.py b/tests/aspects.py index e29fecb..769214f 100644 --- a/tests/aspects.py +++ b/tests/aspects.py @@ -56,6 +56,7 @@ skipping, )
+ OSWIN32 = (sys.platform == 'win32') pywikibot.bot.set_interface('buffer')
diff --git a/tests/basesite_tests.py b/tests/basesite_tests.py index 0e66123..4636eb1 100755 --- a/tests/basesite_tests.py +++ b/tests/basesite_tests.py @@ -13,6 +13,7 @@ from pywikibot.exceptions import Error from tests.aspects import DefaultSiteTestCase, TestCase, unittest
+ WARN_SELF_CALL = (r'Referencing this attribute like a function ' r'is deprecated .+; use it directly instead')
diff --git a/tests/category_bot_tests.py b/tests/category_bot_tests.py index c0fbc89..0ce04ce 100755 --- a/tests/category_bot_tests.py +++ b/tests/category_bot_tests.py @@ -16,6 +16,7 @@ from scripts.category import CategoryMoveRobot, CategoryPreprocess from tests.aspects import DefaultSiteTestCase, TestCase
+ MOCKED_USERNAME = Mock(return_value='FakeUsername')
diff --git a/tests/data/fixes.py b/tests/data/fixes.py index 8b625c8..9708107 100644 --- a/tests/data/fixes.py +++ b/tests/data/fixes.py @@ -6,6 +6,7 @@ # from __future__ import annotations
+ # flake8 cannot detect that fixes is defined via pywikibot.fixes if 'fixes' not in globals(): fixes = {} diff --git a/tests/data/set-fixes.py b/tests/data/set-fixes.py index 32e4cd0..0800174 100644 --- a/tests/data/set-fixes.py +++ b/tests/data/set-fixes.py @@ -6,5 +6,6 @@ # from __future__ import annotations
+ # Just kill the old value suffices fixes = {} diff --git a/tests/djvu_tests.py b/tests/djvu_tests.py index ffc5303..fc0f951 100755 --- a/tests/djvu_tests.py +++ b/tests/djvu_tests.py @@ -18,6 +18,7 @@ from tests.aspects import TestCase from tests.utils import skipping
+ join_djvu_data_path = create_path_func(join_data_path, 'djvu') file_djvu = join_djvu_data_path('myfilé.djvu') # test non-ASCII name
diff --git a/tests/edit_tests.py b/tests/edit_tests.py index 2b37caf..7fb89e9 100755 --- a/tests/edit_tests.py +++ b/tests/edit_tests.py @@ -16,6 +16,7 @@ from pywikibot.exceptions import Error from tests.aspects import TestCase, require_version
+ called_back = False
diff --git a/tests/l10n_tests.py b/tests/l10n_tests.py index 83c1958..859c6f6 100755 --- a/tests/l10n_tests.py +++ b/tests/l10n_tests.py @@ -16,6 +16,7 @@ from pywikibot.textlib import extract_templates_and_params_regex_simple from tests.aspects import MetaTestCaseClass, TestCase
+ PACKAGES = ( 'redirect-broken-redirect-template', # speedy deletion template 'archivebot-archiveheader', # archive header template diff --git a/tests/namespace_tests.py b/tests/namespace_tests.py index 23d11c2..28f6cf9 100755 --- a/tests/namespace_tests.py +++ b/tests/namespace_tests.py @@ -14,6 +14,7 @@ from pywikibot.site._namespace import BuiltinNamespace from tests.aspects import TestCase, unittest
+ # Default namespaces which should work in any MW wiki _base_builtin_ns = { 'Media': -2, diff --git a/tests/page_tests.py b/tests/page_tests.py index 9308f32..a84ea05 100755 --- a/tests/page_tests.py +++ b/tests/page_tests.py @@ -38,6 +38,7 @@ ) from tests.utils import skipping
+ EMPTY_TITLE_RE = r'Title must be specified and not empty if source is a Site.' INVALID_TITLE_RE = r'The link [[.*]] does not contain a page title' NO_PAGE_RE = r"doesn't exist." diff --git a/tests/pagegenerators_tests.py b/tests/pagegenerators_tests.py index 7d1aaa1..350f490 100755 --- a/tests/pagegenerators_tests.py +++ b/tests/pagegenerators_tests.py @@ -39,6 +39,7 @@ from tests.tools_tests import GeneratorIntersectTestCase from tests.utils import skipping
+ en_wp_page_titles = ( # just a bunch of randomly selected titles for English Wikipedia tests 'Eastern Sayan', diff --git a/tests/patrolbot_tests.py b/tests/patrolbot_tests.py index 28f8a69..b957695 100755 --- a/tests/patrolbot_tests.py +++ b/tests/patrolbot_tests.py @@ -12,6 +12,7 @@ from scripts.patrol import PatrolBot from tests.aspects import DefaultDrySiteTestCase, unittest
+ DUMMY_PAGE_TUPLES = """ This is some text above the entries:
diff --git a/tests/pwb_tests.py b/tests/pwb_tests.py index 4a04f12..130ee4a 100755 --- a/tests/pwb_tests.py +++ b/tests/pwb_tests.py @@ -15,6 +15,7 @@ from tests.aspects import PwbTestCase from tests.utils import execute, execute_pwb
+ join_pwb_tests_path = create_path_func(join_tests_path, 'pwb')
diff --git a/tests/replacebot_tests.py b/tests/replacebot_tests.py index 319871a..f7abe98 100755 --- a/tests/replacebot_tests.py +++ b/tests/replacebot_tests.py @@ -17,6 +17,7 @@ from tests.bot_tests import TWNBotTestCase from tests.utils import empty_sites
+ # Load only the custom fixes fixes.fixes.clear() fixes._load_file(join_data_path('fixes.py')) diff --git a/tests/script_tests.py b/tests/script_tests.py index bd208b3..7bd674e 100755 --- a/tests/script_tests.py +++ b/tests/script_tests.py @@ -18,6 +18,7 @@ from tests.aspects import DefaultSiteTestCase, MetaTestCaseClass, PwbTestCase from tests.utils import execute_pwb
+ ci_test_run = os.environ.get('PYWIKIBOT_TEST_RUNNING', '0') == '1' scripts_path = join_root_path('scripts')
diff --git a/tests/site_generators_tests.py b/tests/site_generators_tests.py index 75bd805..9655029 100755 --- a/tests/site_generators_tests.py +++ b/tests/site_generators_tests.py @@ -25,6 +25,7 @@ from tests.aspects import DefaultSiteTestCase, DeprecationTestCase, TestCase from tests.utils import skipping
+ global_expected_params = { 'action': ['query'], 'continue': [True], diff --git a/tests/sparql_tests.py b/tests/sparql_tests.py index 2037ada..01cc243 100755 --- a/tests/sparql_tests.py +++ b/tests/sparql_tests.py @@ -18,6 +18,7 @@ from tests.aspects import TestCase, WikidataTestCase from tests.utils import skipping
+ # See: https://www.w3.org/TR/2013/REC-sparql11-results-json-20130321/
SQL_RESPONSE_CONTAINER = """ diff --git a/tests/textlib_tests.py b/tests/textlib_tests.py index 742a317..5acd756 100755 --- a/tests/textlib_tests.py +++ b/tests/textlib_tests.py @@ -29,6 +29,7 @@ require_modules, )
+ files = {} dirname = os.path.join(os.path.dirname(__file__), 'pages')
diff --git a/tests/thanks_tests.py b/tests/thanks_tests.py index 2f8910b..f0300a0 100755 --- a/tests/thanks_tests.py +++ b/tests/thanks_tests.py @@ -13,6 +13,7 @@ from pywikibot.page import Page, User from tests.aspects import TestCase
+ NO_THANKABLE_REVS = 'There is no recent change which can be test thanked.'
diff --git a/tests/timestripper_tests.py b/tests/timestripper_tests.py index 39d1b47..2b768f1 100755 --- a/tests/timestripper_tests.py +++ b/tests/timestripper_tests.py @@ -15,6 +15,7 @@ from pywikibot.time import TZoneFixedOffset from tests.aspects import TestCase, unittest
+ MatchObject = type(re.search('', ''))
diff --git a/tests/ui_options_tests.py b/tests/ui_options_tests.py index bb6793b..d9f2f07 100755 --- a/tests/ui_options_tests.py +++ b/tests/ui_options_tests.py @@ -14,6 +14,7 @@ from pywikibot.bot_choice import ChoiceException, QuitKeyboardInterrupt from tests.aspects import TestCase
+ message = bot.Option.formatted
diff --git a/tests/ui_tests.py b/tests/ui_tests.py index d8706ef..d688b0c 100755 --- a/tests/ui_tests.py +++ b/tests/ui_tests.py @@ -33,6 +33,7 @@ from pywikibot.userinterfaces.transliteration import NON_LATIN_DIGITS, _trans from tests.aspects import TestCase, TestCaseBase
+ logger = logging.getLogger('pywiki') loggingcontext = {'caller_name': 'ui_tests', 'caller_file': 'ui_tests', diff --git a/tests/utils.py b/tests/utils.py index 341cb47..25b4547 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -26,6 +26,7 @@ from pywikibot.tools.collections import EMPTY_DEFAULT from tests import _pwb_py
+ OSWIN32 = (sys.platform == 'win32')
pywikibot-commits@lists.wikimedia.org