Skip to content

Commit

Permalink
automatically sort imports
Browse files Browse the repository at this point in the history
Change-Id: Id3241f339b2997d018f34cad212bef6e2136815e
  • Loading branch information
JJMC89 committed Jul 29, 2024
1 parent 21e99c1 commit e067349
Show file tree
Hide file tree
Showing 31 changed files with 33 additions and 1 deletion.
1 change: 1 addition & 0 deletions pywikibot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ class is mainly used for bots which work with Wikibase or together
VersionParseError,
WikiBaseError,
)

# the constants are
from pywikibot.logging import ( # noqa: F401
CRITICAL,
Expand Down
1 change: 1 addition & 0 deletions pywikibot/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#
from __future__ import annotations


__all__ = (
'CRITICAL', 'DEBUG', 'ERROR', 'INFO', 'WARNING', 'STDOUT', 'VERBOSE',
'INPUT',
Expand Down
2 changes: 1 addition & 1 deletion pywikibot/page/_basepage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions pywikibot/page/_toolforge.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@
from pywikibot import textlib
from pywikibot.tools import deprecated, deprecated_args


try:
import wikitextparser
except ImportError as e:
wikitextparser = e

if TYPE_CHECKING:
import datetime

from pywikibot import Timestamp
DATETYPE = str | Timestamp | datetime.datetime | datetime.date | None

Expand Down
1 change: 1 addition & 0 deletions scripts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@
#
from __future__ import annotations


__version__ = '9.4.0'
1 change: 1 addition & 0 deletions scripts/commons_information.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {'&params;': pagegenerators.parameterHelp} # noqa: N816
Expand Down
2 changes: 2 additions & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions tests/archivebot_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions tests/aspects.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
skipping,
)


OSWIN32 = (sys.platform == 'win32')
pywikibot.bot.set_interface('buffer')

Expand Down
1 change: 1 addition & 0 deletions tests/basesite_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down
1 change: 1 addition & 0 deletions tests/category_bot_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from scripts.category import CategoryMoveRobot, CategoryPreprocess
from tests.aspects import DefaultSiteTestCase, TestCase


MOCKED_USERNAME = Mock(return_value='FakeUsername')


Expand Down
1 change: 1 addition & 0 deletions tests/data/fixes.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#
from __future__ import annotations


# flake8 cannot detect that fixes is defined via pywikibot.fixes
if 'fixes' not in globals():
fixes = {}
Expand Down
1 change: 1 addition & 0 deletions tests/data/set-fixes.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
#
from __future__ import annotations


# Just kill the old value suffices
fixes = {}
1 change: 1 addition & 0 deletions tests/djvu_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions tests/edit_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from pywikibot.exceptions import Error
from tests.aspects import TestCase, require_version


called_back = False


Expand Down
1 change: 1 addition & 0 deletions tests/l10n_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions tests/namespace_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions tests/page_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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\."
Expand Down
1 change: 1 addition & 0 deletions tests/pagegenerators_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
1 change: 1 addition & 0 deletions tests/patrolbot_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions tests/pwb_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')


Expand Down
1 change: 1 addition & 0 deletions tests/replacebot_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down
1 change: 1 addition & 0 deletions tests/script_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down
1 change: 1 addition & 0 deletions tests/site_generators_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from tests.aspects import DefaultSiteTestCase, DeprecationTestCase, TestCase
from tests.utils import skipping


global_expected_params = {
'action': ['query'],
'continue': [True],
Expand Down
1 change: 1 addition & 0 deletions tests/sparql_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = """
Expand Down
1 change: 1 addition & 0 deletions tests/textlib_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
require_modules,
)


files = {}
dirname = os.path.join(os.path.dirname(__file__), 'pages')

Expand Down
1 change: 1 addition & 0 deletions tests/thanks_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.'


Expand Down
1 change: 1 addition & 0 deletions tests/timestripper_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from pywikibot.time import TZoneFixedOffset
from tests.aspects import TestCase, unittest


MatchObject = type(re.search('', ''))


Expand Down
1 change: 1 addition & 0 deletions tests/ui_options_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from pywikibot.bot_choice import ChoiceException, QuitKeyboardInterrupt
from tests.aspects import TestCase


message = bot.Option.formatted


Expand Down
1 change: 1 addition & 0 deletions tests/ui_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
1 change: 1 addition & 0 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from pywikibot.tools.collections import EMPTY_DEFAULT
from tests import _pwb_py


OSWIN32 = (sys.platform == 'win32')


Expand Down

0 comments on commit e067349

Please sign in to comment.