jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/879965 )
Change subject: sort imports with isort
......................................................................
sort imports with isort
Change-Id: I1fe160b12296bba6faa6e2968e340b4996feb09e
---
M pywikibot/data/memento.py
M tests/generate_user_files_tests.py
M scripts/commons_information.py
M tests/harvest_template_tests.py
M tests/aspects.py
M tests/tools_tests.py
M pywikibot/scripts/wrapper.py
M tests/gui_tests.py
M tests/tests_tests.py
M pywikibot/tools/itertools.py
M pywikibot/site_detect.py
M tests/make_dist_tests.py
M pywikibot/flow.py
M pywikibot/page/__init__.py
M tests/wikiblame_tests.py
M pywikibot/textlib.py
M pywikibot/site/_tokenwallet.py
M pywikibot/data/api/__init__.py
M tests/time_tests.py
M pywikibot/page/_toolforge.py
M pywikibot/comms/http.py
M tests/interwikimap_tests.py
M make_dist.py
M pywikibot/xmlreader.py
M tests/cache_tests.py
M tests/dry_api_tests.py
M tests/flow_thanks_tests.py
M pywikibot/site/_apisite.py
M pywikibot/site/_basesite.py
M tests/checkimages_tests.py
M pywikibot/userinterfaces/gui.py
M tests/api_tests.py
32 files changed, 47 insertions(+), 57 deletions(-)
Approvals:
JJMC89: Looks good to me, approved
jenkins-bot: Verified
diff --git a/make_dist.py b/make_dist.py
index 84685e5..01308c2 100755
--- a/make_dist.py
+++ b/make_dist.py
@@ -44,12 +44,12 @@
import abc
import shutil
import sys
-from subprocess import check_call
from pathlib import Path
+from subprocess import check_call
+import setup
from pywikibot import __version__, error, info, input_yn, warning
from pywikibot.backports import Tuple
-import setup
class SetupBase(abc.ABC):
diff --git a/pywikibot/comms/http.py b/pywikibot/comms/http.py
index 56518b3..9531757 100644
--- a/pywikibot/comms/http.py
+++ b/pywikibot/comms/http.py
@@ -48,9 +48,9 @@
from pywikibot.backports import Tuple
from pywikibot.exceptions import (
FatalServerError,
- ServerError,
Server414Error,
Server504Error,
+ ServerError,
)
from pywikibot.logging import critical, debug, error, log, warning
from pywikibot.tools import file_mode_checker
diff --git a/pywikibot/data/api/__init__.py b/pywikibot/data/api/__init__.py
index c7e6db9..81f5c26 100644
--- a/pywikibot/data/api/__init__.py
+++ b/pywikibot/data/api/__init__.py
@@ -10,8 +10,8 @@
from pywikibot.comms import http
from pywikibot.data.api._generators import (
- APIGeneratorBase,
APIGenerator,
+ APIGeneratorBase,
ListGenerator,
LogEntryListGenerator,
PageGenerator,
@@ -19,12 +19,13 @@
QueryGenerator,
update_page,
)
-from pywikibot.data.api._paraminfo import ParamInfo
from pywikibot.data.api._optionset import OptionSet
+from pywikibot.data.api._paraminfo import ParamInfo
from pywikibot.data.api._requests import CachedRequest, Request, encode_url
from pywikibot.family import SubdomainFamily
from pywikibot.tools import ModuleDeprecationWrapper
+
__all__ = (
'APIGeneratorBase',
'APIGenerator',
diff --git a/pywikibot/data/memento.py b/pywikibot/data/memento.py
index cf7ed11..14244a0 100644
--- a/pywikibot/data/memento.py
+++ b/pywikibot/data/memento.py
@@ -16,14 +16,14 @@
from datetime import datetime
from typing import Optional
+import requests
from memento_client.memento_client import MementoClient as OldMementoClient
from memento_client.memento_client import MementoClientException
-
-import requests
from requests.exceptions import InvalidSchema, MissingSchema
from pywikibot import config, debug, sleep, warning
+
__all__ = (
'MementoClient',
'MementoClientException',
diff --git a/pywikibot/flow.py b/pywikibot/flow.py
index ff95165..1af55ad 100644
--- a/pywikibot/flow.py
+++ b/pywikibot/flow.py
@@ -6,12 +6,12 @@
#
import abc
import datetime
-from typing import Any, Type, Optional, Union
+from typing import Any, Optional, Type, Union
from urllib.parse import parse_qs, urlparse
import pywikibot
-from pywikibot.backports import Dict, Iterator, List, Mapping
from pywikibot import config
+from pywikibot.backports import Dict, Iterator, List, Mapping
from pywikibot.exceptions import (
LockedPageError,
NoPageError,
diff --git a/pywikibot/page/__init__.py b/pywikibot/page/__init__.py
index f320c74..bd9c70f 100644
--- a/pywikibot/page/__init__.py
+++ b/pywikibot/page/__init__.py
@@ -15,14 +15,14 @@
from pywikibot.page._wikibase import (
Claim,
ItemPage,
+ LexemeForm,
+ LexemePage,
+ LexemeSense,
MediaInfo,
Property,
PropertyPage,
WikibaseEntity,
WikibasePage,
- LexemePage,
- LexemeForm,
- LexemeSense,
)
from pywikibot.site import BaseSite as _BaseSite
from pywikibot.tools import deprecated, issue_deprecation_warning
diff --git a/pywikibot/page/_toolforge.py b/pywikibot/page/_toolforge.py
index 4dccfdb..503e670 100644
--- a/pywikibot/page/_toolforge.py
+++ b/pywikibot/page/_toolforge.py
@@ -9,11 +9,9 @@
#
import collections
import re
-
from typing import Optional
import pywikibot
-
from pywikibot import config
diff --git a/pywikibot/scripts/wrapper.py b/pywikibot/scripts/wrapper.py
index 6e64d15..93ad965 100755
--- a/pywikibot/scripts/wrapper.py
+++ b/pywikibot/scripts/wrapper.py
@@ -322,7 +322,7 @@
def find_alternates(filename, script_paths):
"""Search for similar filenames in the given script
paths."""
- from pywikibot import config, input_choice, error, info, warning
+ from pywikibot import config, error, info, input_choice, warning
from pywikibot.bot import QuitKeyboardInterrupt, ShowingListOption
assert config.pwb_close_matches > 0, \
diff --git a/pywikibot/site/_apisite.py b/pywikibot/site/_apisite.py
index 3811df2..59a1522 100644
--- a/pywikibot/site/_apisite.py
+++ b/pywikibot/site/_apisite.py
@@ -14,17 +14,10 @@
from typing import Any, Iterable, Optional, Type, TypeVar, Union
import pywikibot
-from pywikibot.backports import (
- DefaultDict,
- Dict,
- List,
- Match,
- Pattern,
- Set,
- Tuple,
- removesuffix,
-)
+from pywikibot import login
+from pywikibot.backports import DefaultDict, Dict, List, Match
from pywikibot.backports import OrderedDict as OrderedDictType
+from pywikibot.backports import Pattern, Set, Tuple, removesuffix
from pywikibot.comms import http
from pywikibot.data import api
from pywikibot.exceptions import (
@@ -53,7 +46,6 @@
TitleblacklistError,
UnknownExtensionError,
)
-from pywikibot import login
from pywikibot.site._basesite import BaseSite
from pywikibot.site._decorators import need_right, need_version
from pywikibot.site._extensions import (
diff --git a/pywikibot/site/_basesite.py b/pywikibot/site/_basesite.py
index 643628d..4b6e296 100644
--- a/pywikibot/site/_basesite.py
+++ b/pywikibot/site/_basesite.py
@@ -22,9 +22,9 @@
from pywikibot.site._namespace import Namespace, NamespacesDict
from pywikibot.throttle import Throttle
from pywikibot.tools import (
- cached,
ComparableMixin,
SelfCallString,
+ cached,
first_upper,
normalize_username,
)
diff --git a/pywikibot/site/_tokenwallet.py b/pywikibot/site/_tokenwallet.py
index 1ec829d..1e1de18 100644
--- a/pywikibot/site/_tokenwallet.py
+++ b/pywikibot/site/_tokenwallet.py
@@ -5,10 +5,11 @@
# Distributed under the terms of the MIT license.
#
from collections.abc import Container
-from typing import Any, Optional, TYPE_CHECKING
+from typing import TYPE_CHECKING, Any, Optional
from pywikibot.backports import Dict, List
-from pywikibot.tools import issue_deprecation_warning, deprecated
+from pywikibot.tools import deprecated, issue_deprecation_warning
+
if TYPE_CHECKING:
from pywikibot.site import APISite
diff --git a/pywikibot/site_detect.py b/pywikibot/site_detect.py
index 45f269d..bb44038 100644
--- a/pywikibot/site_detect.py
+++ b/pywikibot/site_detect.py
@@ -15,8 +15,8 @@
from requests.exceptions import RequestException
import pywikibot
-from pywikibot.comms.http import fetch
from pywikibot.backports import removesuffix
+from pywikibot.comms.http import fetch
from pywikibot.exceptions import ServerError
from pywikibot.tools import MediaWikiVersion
diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py
index b3f4aa1..3079c22 100644
--- a/pywikibot/textlib.py
+++ b/pywikibot/textlib.py
@@ -32,6 +32,7 @@
)
from pywikibot.userinterfaces.transliteration import NON_LATIN_DIGITS
+
try:
import wikitextparser
except ImportError:
diff --git a/pywikibot/tools/itertools.py b/pywikibot/tools/itertools.py
index 50fb740..36f916d 100644
--- a/pywikibot/tools/itertools.py
+++ b/pywikibot/tools/itertools.py
@@ -10,7 +10,6 @@
#
import collections
import itertools
-
from contextlib import suppress
from itertools import chain, zip_longest
from typing import Any
diff --git a/pywikibot/userinterfaces/gui.py b/pywikibot/userinterfaces/gui.py
index 53c7272..5640915 100644
--- a/pywikibot/userinterfaces/gui.py
+++ b/pywikibot/userinterfaces/gui.py
@@ -9,18 +9,18 @@
#
# Distributed under the terms of the MIT license.
#
-from typing import Optional
-
from idlelib import replace as ReplaceDialog # noqa: N812
from idlelib import search as SearchDialog # noqa: N812
from idlelib.config import idleConf
from idlelib.configdialog import ConfigDialog
from idlelib.multicall import MultiCallCreator
+from typing import Optional
import pywikibot
from pywikibot.backports import Tuple
from pywikibot.tools import PYTHON_VERSION
+
try:
import tkinter
except ImportError as e:
diff --git a/pywikibot/xmlreader.py b/pywikibot/xmlreader.py
index d619d9f..4195a79 100644
--- a/pywikibot/xmlreader.py
+++ b/pywikibot/xmlreader.py
@@ -18,8 +18,9 @@
import re
from typing import Optional
+
try:
- from defusedxml.ElementTree import iterparse, ParseError
+ from defusedxml.ElementTree import ParseError, iterparse
except ImportError:
from xml.etree.ElementTree import iterparse, ParseError
diff --git a/scripts/commons_information.py b/scripts/commons_information.py
index cd7f746..de812e3 100755
--- a/scripts/commons_information.py
+++ b/scripts/commons_information.py
@@ -13,6 +13,7 @@
from pywikibot import i18n, pagegenerators
from pywikibot.bot import ExistingPageBot, SingleSiteBot
+
try:
import langdetect
except ImportError:
diff --git a/tests/api_tests.py b/tests/api_tests.py
index 5f13c04..a4a2343 100755
--- a/tests/api_tests.py
+++ b/tests/api_tests.py
@@ -18,12 +18,11 @@
from pywikibot.exceptions import APIError, NoUsernameError
from pywikibot.throttle import Throttle
from pywikibot.tools import suppress_warnings
-
from tests.aspects import (
- require_version,
DefaultDrySiteTestCase,
DefaultSiteTestCase,
TestCase,
+ require_version,
)
from tests.utils import FakeLoginManager
diff --git a/tests/aspects.py b/tests/aspects.py
index e8ba489..a85fea0 100644
--- a/tests/aspects.py
+++ b/tests/aspects.py
@@ -25,7 +25,7 @@
import pywikibot
from pywikibot import Site, config
-from pywikibot.backports import removeprefix, removesuffix, List
+from pywikibot.backports import List, removeprefix, removesuffix
from pywikibot.comms import http
from pywikibot.data.api import Request as _original_Request
from pywikibot.exceptions import (
@@ -35,8 +35,8 @@
)
from pywikibot.family import WikimediaFamily
from pywikibot.site import BaseSite
-from pywikibot.tools import suppress_warnings
from pywikibot.tools import MediaWikiVersion # noqa: F401 (used by f-string)
+from pywikibot.tools import suppress_warnings
from tests import (
WARN_SITE_CODE,
patch_request,
diff --git a/tests/cache_tests.py b/tests/cache_tests.py
index 7ddb229..b538fe2 100755
--- a/tests/cache_tests.py
+++ b/tests/cache_tests.py
@@ -7,11 +7,9 @@
#
import unittest
-from pywikibot.site import BaseSite
-from pywikibot.login import LoginStatus
-
import scripts.maintenance.cache as cache
-
+from pywikibot.login import LoginStatus
+from pywikibot.site import BaseSite
from tests import join_cache_path
from tests.aspects import TestCase
diff --git a/tests/checkimages_tests.py b/tests/checkimages_tests.py
index 2666052..d4a4cfd 100755
--- a/tests/checkimages_tests.py
+++ b/tests/checkimages_tests.py
@@ -8,7 +8,6 @@
import unittest
from pywikibot import FilePage
-
from scripts import checkimages
from tests.aspects import DefaultSiteTestCase, TestCase
diff --git a/tests/dry_api_tests.py b/tests/dry_api_tests.py
index a110d8a..889770d 100755
--- a/tests/dry_api_tests.py
+++ b/tests/dry_api_tests.py
@@ -19,7 +19,7 @@
from pywikibot.exceptions import Error
from pywikibot.family import Family
from pywikibot.login import LoginStatus
-from pywikibot.tools import suppress_warnings, PYTHON_VERSION
+from pywikibot.tools import PYTHON_VERSION, suppress_warnings
from tests import join_images_path
from tests.aspects import (
DefaultDrySiteTestCase,
diff --git a/tests/flow_thanks_tests.py b/tests/flow_thanks_tests.py
index acdd8cb..64d2077 100755
--- a/tests/flow_thanks_tests.py
+++ b/tests/flow_thanks_tests.py
@@ -9,7 +9,6 @@
from contextlib import suppress
from pywikibot.flow import Topic
-
from tests.aspects import TestCase
diff --git a/tests/generate_user_files_tests.py b/tests/generate_user_files_tests.py
index 770ace4..10a78d4 100755
--- a/tests/generate_user_files_tests.py
+++ b/tests/generate_user_files_tests.py
@@ -7,11 +7,9 @@
#
import re
import unittest
-
from contextlib import suppress
from pywikibot.scripts import generate_user_files as guf
-
from tests.aspects import TestCase
diff --git a/tests/gui_tests.py b/tests/gui_tests.py
index a908542..0e4188e 100755
--- a/tests/gui_tests.py
+++ b/tests/gui_tests.py
@@ -67,6 +67,7 @@
global EditBoxWindow, Tkdialog, tkinter
import tkinter
+
from pywikibot.userinterfaces.gui import EditBoxWindow, Tkdialog
diff --git a/tests/harvest_template_tests.py b/tests/harvest_template_tests.py
index 1d35e39..72941f6 100755
--- a/tests/harvest_template_tests.py
+++ b/tests/harvest_template_tests.py
@@ -10,7 +10,6 @@
from pywikibot import ItemPage, WbTime
from scripts.harvest_template import HarvestRobot
-
from tests.aspects import ScriptMainTestCase
diff --git a/tests/interwikimap_tests.py b/tests/interwikimap_tests.py
index fec9d2b..1b7f0b8 100755
--- a/tests/interwikimap_tests.py
+++ b/tests/interwikimap_tests.py
@@ -6,12 +6,10 @@
# Distributed under the terms of the MIT license.
#
import unittest
-
from contextlib import suppress
import pywikibot
from pywikibot.tools import suppress_warnings
-
from tests import WARN_SITE_CODE
from tests.aspects import TestCase
diff --git a/tests/make_dist_tests.py b/tests/make_dist_tests.py
index 430cb9d..fc70a34 100755
--- a/tests/make_dist_tests.py
+++ b/tests/make_dist_tests.py
@@ -9,9 +9,8 @@
import sys
import unittest
-from pywikibot import __version__
from make_dist import handle_args
-
+from pywikibot import __version__
from tests.aspects import TestCase
diff --git a/tests/tests_tests.py b/tests/tests_tests.py
index 47c1974..3f3f9c5 100755
--- a/tests/tests_tests.py
+++ b/tests/tests_tests.py
@@ -7,8 +7,8 @@
import unittest
from contextlib import suppress
-from tests.aspects import TestCase
from tests import utils
+from tests.aspects import TestCase
class HttpServerProblemTestCase(TestCase):
diff --git a/tests/time_tests.py b/tests/time_tests.py
index c074b7e..bd3e95e 100755
--- a/tests/time_tests.py
+++ b/tests/time_tests.py
@@ -11,7 +11,7 @@
from contextlib import suppress
from datetime import datetime, timedelta
-from pywikibot.time import parse_duration, str2timedelta, Timestamp
+from pywikibot.time import Timestamp, parse_duration, str2timedelta
from tests.aspects import TestCase
diff --git a/tests/tools_tests.py b/tests/tools_tests.py
index a372d50..bc898c8 100755
--- a/tests/tools_tests.py
+++ b/tests/tools_tests.py
@@ -28,7 +28,6 @@
islice_with_ellipsis,
roundrobin_generators,
)
-
from tests import join_xml_data_path
from tests.aspects import TestCase
from tests.utils import skipping
diff --git a/tests/wikiblame_tests.py b/tests/wikiblame_tests.py
index 06f59b2..647af79 100644
--- a/tests/wikiblame_tests.py
+++ b/tests/wikiblame_tests.py
@@ -5,11 +5,9 @@
# Distributed under the terms of the MIT license.
#
import unittest
-
from contextlib import suppress
import pywikibot
-
from tests.aspects import TestCase
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/879965
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: I1fe160b12296bba6faa6e2968e340b4996feb09e
Gerrit-Change-Number: 879965
Gerrit-PatchSet: 1
Gerrit-Owner: JJMC89 <JJMC89.Wikimedia(a)gmail.com>
Gerrit-Reviewer: JJMC89 <JJMC89.Wikimedia(a)gmail.com>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged