summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2023-08-21 21:20:32 -0400
committerLUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-08-22 18:32:22 +0000
commit6447733eb28ea188d551ae518a7e51ebf63a4350 (patch)
tree3e2571b39af0f8544dae4660ebc1d29e2a7bda9d
parent06ddc8c50a7e802dbaf8468144c2b5773cda3714 (diff)
downloadgit-repo-6447733eb28ea188d551ae518a7e51ebf63a4350.tar.gz
isort: format codebasev2.36
Change-Id: I6f11d123b68fd077f558d3c21349c55c5f251019 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/383715 Reviewed-by: Gavin Mak <gavinmak@google.com> Tested-by: Mike Frysinger <vapier@google.com> Commit-Queue: Mike Frysinger <vapier@google.com>
-rw-r--r--.isort.cfg41
-rw-r--r--color.py1
-rw-r--r--command.py6
-rw-r--r--editor.py2
-rw-r--r--event_log.py1
-rw-r--r--fetch.py1
-rw-r--r--git_command.py7
-rw-r--r--git_config.py10
-rw-r--r--git_refs.py4
-rw-r--r--git_superproject.py6
-rw-r--r--git_trace2_event_log.py3
-rwxr-xr-xmain.py28
-rw-r--r--manifest_xml.py26
-rw-r--r--pager.py1
-rw-r--r--platform_utils_win32.py24
-rw-r--r--progress.py2
-rw-r--r--project.py42
-rwxr-xr-xrelease/update-manpages1
-rw-r--r--release/update_manpages.py3
-rwxr-xr-xrepo4
-rw-r--r--repo_logging.py1
-rw-r--r--repo_trace.py5
-rwxr-xr-xrun_tests9
-rw-r--r--run_tests.vpython35
-rwxr-xr-xsetup.py1
-rw-r--r--subcmds/__init__.py1
-rw-r--r--subcmds/abandon.py6
-rw-r--r--subcmds/branches.py3
-rw-r--r--subcmds/checkout.py8
-rw-r--r--subcmds/cherry_pick.py4
-rw-r--r--subcmds/diff.py3
-rw-r--r--subcmds/download.py5
-rw-r--r--subcmds/forall.py15
-rw-r--r--subcmds/grep.py9
-rw-r--r--subcmds/help.py10
-rw-r--r--subcmds/info.py5
-rw-r--r--subcmds/init.py12
-rw-r--r--subcmds/list.py3
-rw-r--r--subcmds/prune.py3
-rw-r--r--subcmds/selfupdate.py7
-rw-r--r--subcmds/start.py9
-rw-r--r--subcmds/status.py4
-rw-r--r--subcmds/sync.py40
-rw-r--r--subcmds/upload.py7
-rw-r--r--subcmds/version.py7
-rw-r--r--tests/test_error.py7
-rw-r--r--tests/test_git_command.py3
-rw-r--r--tests/test_git_superproject.py3
-rw-r--r--tests/test_hooks.py3
-rw-r--r--tests/test_project.py2
-rw-r--r--tests/test_subcmds_sync.py7
-rw-r--r--tests/test_subcmds_upload.py3
52 files changed, 280 insertions, 143 deletions
diff --git a/.isort.cfg b/.isort.cfg
new file mode 100644
index 00000000..bc47b614
--- /dev/null
+++ b/.isort.cfg
@@ -0,0 +1,41 @@
1# Copyright 2023 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15# Config file for the isort python module.
16# This is used to enforce import sorting standards.
17#
18# https://pycqa.github.io/isort/docs/configuration/options.html
19
20[settings]
21# Be compatible with `black` since it also matches what we want.
22profile = black
23
24line_length = 80
25length_sort = false
26force_single_line = true
27lines_after_imports = 2
28from_first = false
29case_sensitive = false
30force_sort_within_sections = true
31order_by_type = false
32
33# Ignore generated files.
34extend_skip_glob = *_pb2.py
35
36# Allow importing multiple classes on a single line from these modules.
37# https://google.github.io/styleguide/pyguide#s2.2-imports
38single_line_exclusions =
39 abc,
40 collections.abc,
41 typing,
diff --git a/color.py b/color.py
index 8f29b59f..0f637489 100644
--- a/color.py
+++ b/color.py
@@ -17,6 +17,7 @@ import sys
17 17
18import pager 18import pager
19 19
20
20COLORS = { 21COLORS = {
21 None: -1, 22 None: -1,
22 "normal": -1, 23 "normal": -1,
diff --git a/command.py b/command.py
index 0205932d..9d5d56ee 100644
--- a/command.py
+++ b/command.py
@@ -13,14 +13,14 @@
13# limitations under the License. 13# limitations under the License.
14 14
15import multiprocessing 15import multiprocessing
16import os
17import optparse 16import optparse
17import os
18import re 18import re
19 19
20from event_log import EventLog
21from error import NoSuchProjectError
22from error import InvalidProjectGroupsError 20from error import InvalidProjectGroupsError
21from error import NoSuchProjectError
23from error import RepoExitError 22from error import RepoExitError
23from event_log import EventLog
24import progress 24import progress
25 25
26 26
diff --git a/editor.py b/editor.py
index 96835aba..78311f1a 100644
--- a/editor.py
+++ b/editor.py
@@ -14,8 +14,8 @@
14 14
15import os 15import os
16import re 16import re
17import sys
18import subprocess 17import subprocess
18import sys
19import tempfile 19import tempfile
20 20
21from error import EditorError 21from error import EditorError
diff --git a/event_log.py b/event_log.py
index b1f8bdf9..60c1a437 100644
--- a/event_log.py
+++ b/event_log.py
@@ -15,6 +15,7 @@
15import json 15import json
16import multiprocessing 16import multiprocessing
17 17
18
18TASK_COMMAND = "command" 19TASK_COMMAND = "command"
19TASK_SYNC_NETWORK = "sync-network" 20TASK_SYNC_NETWORK = "sync-network"
20TASK_SYNC_LOCAL = "sync-local" 21TASK_SYNC_LOCAL = "sync-local"
diff --git a/fetch.py b/fetch.py
index cf8d1d7d..55845af7 100644
--- a/fetch.py
+++ b/fetch.py
@@ -18,6 +18,7 @@ import subprocess
18import sys 18import sys
19from urllib.parse import urlparse 19from urllib.parse import urlparse
20from urllib.request import urlopen 20from urllib.request import urlopen
21
21from error import RepoExitError 22from error import RepoExitError
22 23
23 24
diff --git a/git_command.py b/git_command.py
index 36fcfe7c..a5cf514b 100644
--- a/git_command.py
+++ b/git_command.py
@@ -14,17 +14,20 @@
14 14
15import functools 15import functools
16import os 16import os
17import sys
18import subprocess 17import subprocess
18import sys
19from typing import Any, Optional 19from typing import Any, Optional
20 20
21from error import GitError 21from error import GitError
22from error import RepoExitError 22from error import RepoExitError
23from git_refs import HEAD 23from git_refs import HEAD
24import platform_utils 24import platform_utils
25from repo_trace import REPO_TRACE, IsTrace, Trace 25from repo_trace import IsTrace
26from repo_trace import REPO_TRACE
27from repo_trace import Trace
26from wrapper import Wrapper 28from wrapper import Wrapper
27 29
30
28GIT = "git" 31GIT = "git"
29# NB: These do not need to be kept in sync with the repo launcher script. 32# NB: These do not need to be kept in sync with the repo launcher script.
30# These may be much newer as it allows the repo launcher to roll between 33# These may be much newer as it allows the repo launcher to roll between
diff --git a/git_config.py b/git_config.py
index 971066ef..8c2eb6e9 100644
--- a/git_config.py
+++ b/git_config.py
@@ -26,11 +26,15 @@ from typing import Union
26import urllib.error 26import urllib.error
27import urllib.request 27import urllib.request
28 28
29from error import GitError, UploadError 29from error import GitError
30from error import UploadError
31from git_command import GitCommand
32from git_refs import R_CHANGES
33from git_refs import R_HEADS
34from git_refs import R_TAGS
30import platform_utils 35import platform_utils
31from repo_trace import Trace 36from repo_trace import Trace
32from git_command import GitCommand 37
33from git_refs import R_CHANGES, R_HEADS, R_TAGS
34 38
35# Prefix that is prepended to all the keys of SyncAnalysisState's data 39# Prefix that is prepended to all the keys of SyncAnalysisState's data
36# that is saved in the config. 40# that is saved in the config.
diff --git a/git_refs.py b/git_refs.py
index aca1f90d..1f5eaab4 100644
--- a/git_refs.py
+++ b/git_refs.py
@@ -13,8 +13,10 @@
13# limitations under the License. 13# limitations under the License.
14 14
15import os 15import os
16from repo_trace import Trace 16
17import platform_utils 17import platform_utils
18from repo_trace import Trace
19
18 20
19HEAD = "HEAD" 21HEAD = "HEAD"
20R_CHANGES = "refs/changes/" 22R_CHANGES = "refs/changes/"
diff --git a/git_superproject.py b/git_superproject.py
index f1b4f231..5d8c0d4e 100644
--- a/git_superproject.py
+++ b/git_superproject.py
@@ -22,17 +22,19 @@ Examples:
22 UpdateProjectsResult = superproject.UpdateProjectsRevisionId(projects) 22 UpdateProjectsResult = superproject.UpdateProjectsRevisionId(projects)
23""" 23"""
24 24
25import hashlib
26import functools 25import functools
26import hashlib
27import os 27import os
28import sys 28import sys
29import time 29import time
30from typing import NamedTuple 30from typing import NamedTuple
31 31
32from git_command import git_require, GitCommand 32from git_command import git_require
33from git_command import GitCommand
33from git_config import RepoConfig 34from git_config import RepoConfig
34from git_refs import GitRefs 35from git_refs import GitRefs
35 36
37
36_SUPERPROJECT_GIT_NAME = "superproject.git" 38_SUPERPROJECT_GIT_NAME = "superproject.git"
37_SUPERPROJECT_MANIFEST_NAME = "superproject_override.xml" 39_SUPERPROJECT_MANIFEST_NAME = "superproject_override.xml"
38 40
diff --git a/git_trace2_event_log.py b/git_trace2_event_log.py
index 5b99867b..f26f8311 100644
--- a/git_trace2_event_log.py
+++ b/git_trace2_event_log.py
@@ -37,7 +37,8 @@ import sys
37import tempfile 37import tempfile
38import threading 38import threading
39 39
40from git_command import GitCommand, RepoSourceVersion 40from git_command import GitCommand
41from git_command import RepoSourceVersion
41 42
42 43
43class EventLog(object): 44class EventLog(object):
diff --git a/main.py b/main.py
index 126a4b61..1c7f0af6 100755
--- a/main.py
+++ b/main.py
@@ -21,6 +21,7 @@ which takes care of execing this entry point.
21""" 21"""
22 22
23import getpass 23import getpass
24import json
24import netrc 25import netrc
25import optparse 26import optparse
26import os 27import os
@@ -30,7 +31,7 @@ import sys
30import textwrap 31import textwrap
31import time 32import time
32import urllib.request 33import urllib.request
33import json 34
34 35
35try: 36try:
36 import kerberos 37 import kerberos
@@ -38,31 +39,34 @@ except ImportError:
38 kerberos = None 39 kerberos = None
39 40
40from color import SetDefaultColoring 41from color import SetDefaultColoring
41import event_log
42from repo_trace import SetTrace, Trace, SetTraceToStderr
43from git_command import user_agent
44from git_config import RepoConfig
45from git_trace2_event_log import EventLog
46from command import InteractiveCommand 42from command import InteractiveCommand
47from command import MirrorSafeCommand 43from command import MirrorSafeCommand
48from subcmds.version import Version
49from editor import Editor 44from editor import Editor
50from error import DownloadError 45from error import DownloadError
46from error import GitcUnsupportedError
51from error import InvalidProjectGroupsError 47from error import InvalidProjectGroupsError
52from error import ManifestInvalidRevisionError 48from error import ManifestInvalidRevisionError
53from error import NoManifestException 49from error import NoManifestException
54from error import NoSuchProjectError 50from error import NoSuchProjectError
55from error import RepoChangedException 51from error import RepoChangedException
52from error import RepoError
56from error import RepoExitError 53from error import RepoExitError
57from error import RepoUnhandledExceptionError 54from error import RepoUnhandledExceptionError
58from error import RepoError
59from error import SilentRepoExitError 55from error import SilentRepoExitError
60from error import GitcUnsupportedError 56import event_log
57from git_command import user_agent
58from git_config import RepoConfig
59from git_trace2_event_log import EventLog
61from manifest_xml import RepoClient 60from manifest_xml import RepoClient
62from pager import RunPager, TerminatePager 61from pager import RunPager
63from wrapper import WrapperPath, Wrapper 62from pager import TerminatePager
64 63from repo_trace import SetTrace
64from repo_trace import SetTraceToStderr
65from repo_trace import Trace
65from subcmds import all_commands 66from subcmds import all_commands
67from subcmds.version import Version
68from wrapper import Wrapper
69from wrapper import WrapperPath
66 70
67 71
68# NB: These do not need to be kept in sync with the repo launcher script. 72# NB: These do not need to be kept in sync with the repo launcher script.
diff --git a/manifest_xml.py b/manifest_xml.py
index 80e563a5..d944b409 100644
--- a/manifest_xml.py
+++ b/manifest_xml.py
@@ -18,27 +18,25 @@ import os
18import platform 18import platform
19import re 19import re
20import sys 20import sys
21import xml.dom.minidom
22import urllib.parse 21import urllib.parse
22import xml.dom.minidom
23 23
24from error import ManifestInvalidPathError
25from error import ManifestInvalidRevisionError
26from error import ManifestParseError
24from git_config import GitConfig 27from git_config import GitConfig
25from git_refs import R_HEADS, HEAD 28from git_refs import HEAD
29from git_refs import R_HEADS
26from git_superproject import Superproject 30from git_superproject import Superproject
27import platform_utils 31import platform_utils
28from project import ( 32from project import Annotation
29 Annotation, 33from project import ManifestProject
30 RemoteSpec, 34from project import Project
31 Project, 35from project import RemoteSpec
32 RepoProject, 36from project import RepoProject
33 ManifestProject,
34)
35from error import (
36 ManifestParseError,
37 ManifestInvalidPathError,
38 ManifestInvalidRevisionError,
39)
40from wrapper import Wrapper 37from wrapper import Wrapper
41 38
39
42MANIFEST_FILE_NAME = "manifest.xml" 40MANIFEST_FILE_NAME = "manifest.xml"
43LOCAL_MANIFEST_NAME = "local_manifest.xml" 41LOCAL_MANIFEST_NAME = "local_manifest.xml"
44LOCAL_MANIFESTS_DIR_NAME = "local_manifests" 42LOCAL_MANIFESTS_DIR_NAME = "local_manifests"
diff --git a/pager.py b/pager.py
index 2d51b45d..9a4da192 100644
--- a/pager.py
+++ b/pager.py
@@ -19,6 +19,7 @@ import sys
19 19
20import platform_utils 20import platform_utils
21 21
22
22active = False 23active = False
23pager_process = None 24pager_process = None
24old_stdout = None 25old_stdout = None
diff --git a/platform_utils_win32.py b/platform_utils_win32.py
index e9b15f46..80a52639 100644
--- a/platform_utils_win32.py
+++ b/platform_utils_win32.py
@@ -12,12 +12,28 @@
12# See the License for the specific language governing permissions and 12# See the License for the specific language governing permissions and
13# limitations under the License. 13# limitations under the License.
14 14
15from ctypes import addressof
16from ctypes import byref
17from ctypes import c_buffer
18from ctypes import c_ubyte
19from ctypes import FormatError
20from ctypes import get_last_error
21from ctypes import Structure
22from ctypes import Union
23from ctypes import WinDLL
24from ctypes import WinError
25from ctypes.wintypes import BOOL
26from ctypes.wintypes import BOOLEAN
27from ctypes.wintypes import DWORD
28from ctypes.wintypes import HANDLE
29from ctypes.wintypes import LPCWSTR
30from ctypes.wintypes import LPDWORD
31from ctypes.wintypes import LPVOID
32from ctypes.wintypes import ULONG
33from ctypes.wintypes import USHORT
34from ctypes.wintypes import WCHAR
15import errno 35import errno
16 36
17from ctypes import WinDLL, get_last_error, FormatError, WinError, addressof
18from ctypes import c_buffer, c_ubyte, Structure, Union, byref
19from ctypes.wintypes import BOOL, BOOLEAN, LPCWSTR, DWORD, HANDLE
20from ctypes.wintypes import WCHAR, USHORT, LPVOID, ULONG, LPDWORD
21 37
22kernel32 = WinDLL("kernel32", use_last_error=True) 38kernel32 = WinDLL("kernel32", use_last_error=True)
23 39
diff --git a/progress.py b/progress.py
index f2edf144..80bc9463 100644
--- a/progress.py
+++ b/progress.py
@@ -16,6 +16,7 @@ import os
16import sys 16import sys
17import time 17import time
18 18
19
19try: 20try:
20 import threading as _threading 21 import threading as _threading
21except ImportError: 22except ImportError:
@@ -23,6 +24,7 @@ except ImportError:
23 24
24from repo_trace import IsTraceToStderr 25from repo_trace import IsTraceToStderr
25 26
27
26_TTY = sys.stderr.isatty() 28_TTY = sys.stderr.isatty()
27 29
28# This will erase all content in the current line (wherever the cursor is). 30# This will erase all content in the current line (wherever the cursor is).
diff --git a/project.py b/project.py
index a3b6312e..bf4f9ae1 100644
--- a/project.py
+++ b/project.py
@@ -26,35 +26,39 @@ import sys
26import tarfile 26import tarfile
27import tempfile 27import tempfile
28import time 28import time
29from typing import NamedTuple, List 29from typing import List, NamedTuple
30import urllib.parse 30import urllib.parse
31 31
32from color import Coloring 32from color import Coloring
33from error import DownloadError
34from error import GitError
35from error import ManifestInvalidPathError
36from error import ManifestInvalidRevisionError
37from error import ManifestParseError
38from error import NoManifestException
39from error import RepoError
40from error import UploadError
33import fetch 41import fetch
34from git_command import GitCommand, git_require 42from git_command import git_require
35from git_config import ( 43from git_command import GitCommand
36 GitConfig, 44from git_config import GetSchemeFromUrl
37 IsId, 45from git_config import GetUrlCookieFile
38 GetSchemeFromUrl, 46from git_config import GitConfig
39 GetUrlCookieFile, 47from git_config import ID_RE
40 ID_RE, 48from git_config import IsId
41) 49from git_refs import GitRefs
50from git_refs import HEAD
51from git_refs import R_HEADS
52from git_refs import R_M
53from git_refs import R_PUB
54from git_refs import R_TAGS
55from git_refs import R_WORKTREE_M
42import git_superproject 56import git_superproject
43from git_trace2_event_log import EventLog 57from git_trace2_event_log import EventLog
44from error import (
45 GitError,
46 UploadError,
47 DownloadError,
48 RepoError,
49)
50from error import ManifestInvalidRevisionError, ManifestInvalidPathError
51from error import NoManifestException, ManifestParseError
52import platform_utils 58import platform_utils
53import progress 59import progress
54from repo_trace import Trace 60from repo_trace import Trace
55 61
56from git_refs import GitRefs, HEAD, R_HEADS, R_TAGS, R_PUB, R_M, R_WORKTREE_M
57
58 62
59class SyncNetworkHalfResult(NamedTuple): 63class SyncNetworkHalfResult(NamedTuple):
60 """Sync_NetworkHalf return value.""" 64 """Sync_NetworkHalf return value."""
diff --git a/release/update-manpages b/release/update-manpages
index 0402ad66..6679b179 100755
--- a/release/update-manpages
+++ b/release/update-manpages
@@ -22,4 +22,5 @@ import sys
22 22
23import update_manpages 23import update_manpages
24 24
25
25sys.exit(update_manpages.main(sys.argv[1:])) 26sys.exit(update_manpages.main(sys.argv[1:]))
diff --git a/release/update_manpages.py b/release/update_manpages.py
index cb687245..489de357 100644
--- a/release/update_manpages.py
+++ b/release/update_manpages.py
@@ -17,17 +17,18 @@
17Most code lives in this module so it can be unittested. 17Most code lives in this module so it can be unittested.
18""" 18"""
19 19
20from pathlib import Path
21import argparse 20import argparse
22import functools 21import functools
23import multiprocessing 22import multiprocessing
24import os 23import os
24from pathlib import Path
25import re 25import re
26import shutil 26import shutil
27import subprocess 27import subprocess
28import sys 28import sys
29import tempfile 29import tempfile
30 30
31
31TOPDIR = Path(__file__).resolve().parent.parent 32TOPDIR = Path(__file__).resolve().parent.parent
32MANDIR = TOPDIR.joinpath("man") 33MANDIR = TOPDIR.joinpath("man")
33 34
diff --git a/repo b/repo
index b9b1928a..79237752 100755
--- a/repo
+++ b/repo
@@ -254,11 +254,13 @@ import re
254import shutil 254import shutil
255import stat 255import stat
256 256
257
257if sys.version_info[0] == 3: 258if sys.version_info[0] == 3:
258 import urllib.request
259 import urllib.error 259 import urllib.error
260 import urllib.request
260else: 261else:
261 import imp 262 import imp
263
262 import urllib2 264 import urllib2
263 urllib = imp.new_module('urllib') 265 urllib = imp.new_module('urllib')
264 urllib.request = urllib2 266 urllib.request = urllib2
diff --git a/repo_logging.py b/repo_logging.py
index 67db05fb..b748df4f 100644
--- a/repo_logging.py
+++ b/repo_logging.py
@@ -19,6 +19,7 @@ import multiprocessing
19 19
20from color import Coloring 20from color import Coloring
21 21
22
22SEPARATOR = "=" * 80 23SEPARATOR = "=" * 80
23 24
24 25
diff --git a/repo_trace.py b/repo_trace.py
index 01beaf8e..d243ce6c 100644
--- a/repo_trace.py
+++ b/repo_trace.py
@@ -21,13 +21,14 @@ To also include trace outputs in stderr do `repo --trace_to_stderr ...`
21""" 21"""
22 22
23import contextlib 23import contextlib
24import sys
25import os 24import os
26import time 25import sys
27import tempfile 26import tempfile
27import time
28 28
29import platform_utils 29import platform_utils
30 30
31
31# Env var to implicitly turn on tracing. 32# Env var to implicitly turn on tracing.
32REPO_TRACE = "REPO_TRACE" 33REPO_TRACE = "REPO_TRACE"
33 34
diff --git a/run_tests b/run_tests
index 2d92cae3..d61308f6 100755
--- a/run_tests
+++ b/run_tests
@@ -18,6 +18,7 @@
18import os 18import os
19import subprocess 19import subprocess
20import sys 20import sys
21
21import pytest 22import pytest
22 23
23 24
@@ -38,12 +39,20 @@ def run_flake8():
38 ).returncode 39 ).returncode
39 40
40 41
42def run_isort():
43 """Returns the exit code from isort."""
44 return subprocess.run(
45 [sys.executable, "-m", "isort", "--check", ROOT_DIR], check=False
46 ).returncode
47
48
41def main(argv): 49def main(argv):
42 """The main entry.""" 50 """The main entry."""
43 checks = ( 51 checks = (
44 lambda: pytest.main(argv), 52 lambda: pytest.main(argv),
45 run_black, 53 run_black,
46 run_flake8, 54 run_flake8,
55 run_isort,
47 ) 56 )
48 return 0 if all(not c() for c in checks) else 1 57 return 0 if all(not c() for c in checks) else 1
49 58
diff --git a/run_tests.vpython3 b/run_tests.vpython3
index 3d0cd78e..036064d3 100644
--- a/run_tests.vpython3
+++ b/run_tests.vpython3
@@ -123,3 +123,8 @@ wheel: <
123 name: "infra/python/wheels/pycodestyle-py2_py3" 123 name: "infra/python/wheels/pycodestyle-py2_py3"
124 version: "version:2.10.0" 124 version: "version:2.10.0"
125> 125>
126
127wheel: <
128 name: "infra/python/wheels/isort-py3"
129 version: "version:5.10.1"
130>
diff --git a/setup.py b/setup.py
index 3e4e6b42..dca44ade 100755
--- a/setup.py
+++ b/setup.py
@@ -16,6 +16,7 @@
16"""Python packaging for repo.""" 16"""Python packaging for repo."""
17 17
18import os 18import os
19
19import setuptools 20import setuptools
20 21
21 22
diff --git a/subcmds/__init__.py b/subcmds/__init__.py
index 0754f708..965ad0bb 100644
--- a/subcmds/__init__.py
+++ b/subcmds/__init__.py
@@ -14,6 +14,7 @@
14 14
15import os 15import os
16 16
17
17# A mapping of the subcommand name to the class that implements it. 18# A mapping of the subcommand name to the class that implements it.
18all_commands = {} 19all_commands = {}
19all_modules = [] 20all_modules = []
diff --git a/subcmds/abandon.py b/subcmds/abandon.py
index 1499c75e..996c3d2c 100644
--- a/subcmds/abandon.py
+++ b/subcmds/abandon.py
@@ -17,10 +17,12 @@ import functools
17import itertools 17import itertools
18import sys 18import sys
19 19
20from command import Command, DEFAULT_LOCAL_JOBS 20from command import Command
21from command import DEFAULT_LOCAL_JOBS
22from error import RepoError
23from error import RepoExitError
21from git_command import git 24from git_command import git
22from progress import Progress 25from progress import Progress
23from error import RepoError, RepoExitError
24 26
25 27
26class AbandonError(RepoExitError): 28class AbandonError(RepoExitError):
diff --git a/subcmds/branches.py b/subcmds/branches.py
index 4d5bb196..33523c38 100644
--- a/subcmds/branches.py
+++ b/subcmds/branches.py
@@ -16,7 +16,8 @@ import itertools
16import sys 16import sys
17 17
18from color import Coloring 18from color import Coloring
19from command import Command, DEFAULT_LOCAL_JOBS 19from command import Command
20from command import DEFAULT_LOCAL_JOBS
20 21
21 22
22class BranchColoring(Coloring): 23class BranchColoring(Coloring):
diff --git a/subcmds/checkout.py b/subcmds/checkout.py
index 033fd349..67f1838c 100644
--- a/subcmds/checkout.py
+++ b/subcmds/checkout.py
@@ -14,12 +14,14 @@
14 14
15import functools 15import functools
16import sys 16import sys
17
18from typing import NamedTuple 17from typing import NamedTuple
19from command import Command, DEFAULT_LOCAL_JOBS 18
19from command import Command
20from command import DEFAULT_LOCAL_JOBS
21from error import GitError
22from error import RepoExitError
20from progress import Progress 23from progress import Progress
21from project import Project 24from project import Project
22from error import GitError, RepoExitError
23 25
24 26
25class CheckoutBranchResult(NamedTuple): 27class CheckoutBranchResult(NamedTuple):
diff --git a/subcmds/cherry_pick.py b/subcmds/cherry_pick.py
index 7a4dd09e..980720eb 100644
--- a/subcmds/cherry_pick.py
+++ b/subcmds/cherry_pick.py
@@ -14,9 +14,11 @@
14 14
15import re 15import re
16import sys 16import sys
17
17from command import Command 18from command import Command
18from git_command import GitCommand
19from error import GitError 19from error import GitError
20from git_command import GitCommand
21
20 22
21CHANGE_ID_RE = re.compile(r"^\s*Change-Id: I([0-9a-f]{40})\s*$") 23CHANGE_ID_RE = re.compile(r"^\s*Change-Id: I([0-9a-f]{40})\s*$")
22 24
diff --git a/subcmds/diff.py b/subcmds/diff.py
index 5c627c0c..d9d72b40 100644
--- a/subcmds/diff.py
+++ b/subcmds/diff.py
@@ -15,7 +15,8 @@
15import functools 15import functools
16import io 16import io
17 17
18from command import DEFAULT_LOCAL_JOBS, PagedCommand 18from command import DEFAULT_LOCAL_JOBS
19from command import PagedCommand
19 20
20 21
21class Diff(PagedCommand): 22class Diff(PagedCommand):
diff --git a/subcmds/download.py b/subcmds/download.py
index 18e555be..e33698e1 100644
--- a/subcmds/download.py
+++ b/subcmds/download.py
@@ -16,7 +16,10 @@ import re
16import sys 16import sys
17 17
18from command import Command 18from command import Command
19from error import GitError, NoSuchProjectError, RepoExitError 19from error import GitError
20from error import NoSuchProjectError
21from error import RepoExitError
22
20 23
21CHANGE_RE = re.compile(r"^([1-9][0-9]*)(?:[/\.-]([1-9][0-9]*))?$") 24CHANGE_RE = re.compile(r"^([1-9][0-9]*)(?:[/\.-]([1-9][0-9]*))?$")
22 25
diff --git a/subcmds/forall.py b/subcmds/forall.py
index 0a897357..9a02c49f 100644
--- a/subcmds/forall.py
+++ b/subcmds/forall.py
@@ -16,21 +16,20 @@ import errno
16import functools 16import functools
17import io 17import io
18import multiprocessing 18import multiprocessing
19import re
20import os 19import os
20import re
21import signal 21import signal
22import sys
23import subprocess 22import subprocess
23import sys
24 24
25from color import Coloring 25from color import Coloring
26from command import ( 26from command import Command
27 DEFAULT_LOCAL_JOBS, 27from command import DEFAULT_LOCAL_JOBS
28 Command, 28from command import MirrorSafeCommand
29 MirrorSafeCommand, 29from command import WORKER_BATCH_SIZE
30 WORKER_BATCH_SIZE,
31)
32from error import ManifestInvalidRevisionError 30from error import ManifestInvalidRevisionError
33 31
32
34_CAN_COLOR = [ 33_CAN_COLOR = [
35 "branch", 34 "branch",
36 "diff", 35 "diff",
diff --git a/subcmds/grep.py b/subcmds/grep.py
index 9ebd776c..19c06d4d 100644
--- a/subcmds/grep.py
+++ b/subcmds/grep.py
@@ -14,12 +14,15 @@
14 14
15import functools 15import functools
16import sys 16import sys
17from typing import NamedTuple
17 18
18from color import Coloring 19from color import Coloring
19from command import DEFAULT_LOCAL_JOBS, PagedCommand 20from command import DEFAULT_LOCAL_JOBS
20from error import GitError, InvalidArgumentsError, SilentRepoExitError 21from command import PagedCommand
22from error import GitError
23from error import InvalidArgumentsError
24from error import SilentRepoExitError
21from git_command import GitCommand 25from git_command import GitCommand
22from typing import NamedTuple
23from project import Project 26from project import Project
24 27
25 28
diff --git a/subcmds/help.py b/subcmds/help.py
index 0d7b664e..a839131b 100644
--- a/subcmds/help.py
+++ b/subcmds/help.py
@@ -16,14 +16,12 @@ import re
16import sys 16import sys
17import textwrap 17import textwrap
18 18
19from subcmds import all_commands
20from color import Coloring 19from color import Coloring
21from command import ( 20from command import MirrorSafeCommand
22 PagedCommand, 21from command import PagedCommand
23 MirrorSafeCommand,
24)
25from wrapper import Wrapper
26from error import RepoExitError 22from error import RepoExitError
23from subcmds import all_commands
24from wrapper import Wrapper
27 25
28 26
29class InvalidHelpCommand(RepoExitError): 27class InvalidHelpCommand(RepoExitError):
diff --git a/subcmds/info.py b/subcmds/info.py
index 6e7f3ed2..c24682c7 100644
--- a/subcmds/info.py
+++ b/subcmds/info.py
@@ -14,9 +14,10 @@
14 14
15import optparse 15import optparse
16 16
17from command import PagedCommand
18from color import Coloring 17from color import Coloring
19from git_refs import R_M, R_HEADS 18from command import PagedCommand
19from git_refs import R_HEADS
20from git_refs import R_M
20 21
21 22
22class _Coloring(Coloring): 23class _Coloring(Coloring):
diff --git a/subcmds/init.py b/subcmds/init.py
index c5a2c54c..529b212b 100644
--- a/subcmds/init.py
+++ b/subcmds/init.py
@@ -16,11 +16,15 @@ import os
16import sys 16import sys
17 17
18from color import Coloring 18from color import Coloring
19from command import InteractiveCommand, MirrorSafeCommand 19from command import InteractiveCommand
20from git_command import git_require, MIN_GIT_VERSION_SOFT, MIN_GIT_VERSION_HARD 20from command import MirrorSafeCommand
21from wrapper import Wrapper
22from error import UpdateManifestError
23from error import RepoUnhandledExceptionError 21from error import RepoUnhandledExceptionError
22from error import UpdateManifestError
23from git_command import git_require
24from git_command import MIN_GIT_VERSION_HARD
25from git_command import MIN_GIT_VERSION_SOFT
26from wrapper import Wrapper
27
24 28
25_REPO_ALLOW_SHALLOW = os.environ.get("REPO_ALLOW_SHALLOW") 29_REPO_ALLOW_SHALLOW = os.environ.get("REPO_ALLOW_SHALLOW")
26 30
diff --git a/subcmds/list.py b/subcmds/list.py
index 24e3e1fc..fba6a4dc 100644
--- a/subcmds/list.py
+++ b/subcmds/list.py
@@ -14,7 +14,8 @@
14 14
15import os 15import os
16 16
17from command import Command, MirrorSafeCommand 17from command import Command
18from command import MirrorSafeCommand
18 19
19 20
20class List(Command, MirrorSafeCommand): 21class List(Command, MirrorSafeCommand):
diff --git a/subcmds/prune.py b/subcmds/prune.py
index 5a68c14a..f18471f3 100644
--- a/subcmds/prune.py
+++ b/subcmds/prune.py
@@ -15,7 +15,8 @@
15import itertools 15import itertools
16 16
17from color import Coloring 17from color import Coloring
18from command import DEFAULT_LOCAL_JOBS, PagedCommand 18from command import DEFAULT_LOCAL_JOBS
19from command import PagedCommand
19 20
20 21
21class Prune(PagedCommand): 22class Prune(PagedCommand):
diff --git a/subcmds/selfupdate.py b/subcmds/selfupdate.py
index 983fd630..51d963ee 100644
--- a/subcmds/selfupdate.py
+++ b/subcmds/selfupdate.py
@@ -15,10 +15,11 @@
15import optparse 15import optparse
16import sys 16import sys
17 17
18from command import Command, MirrorSafeCommand 18from command import Command
19from subcmds.sync import _PostRepoUpgrade 19from command import MirrorSafeCommand
20from subcmds.sync import _PostRepoFetch
21from error import RepoExitError 20from error import RepoExitError
21from subcmds.sync import _PostRepoFetch
22from subcmds.sync import _PostRepoUpgrade
22 23
23 24
24class SelfupdateError(RepoExitError): 25class SelfupdateError(RepoExitError):
diff --git a/subcmds/start.py b/subcmds/start.py
index 481d9ef2..7a42b26c 100644
--- a/subcmds/start.py
+++ b/subcmds/start.py
@@ -14,14 +14,15 @@
14 14
15import functools 15import functools
16import sys 16import sys
17from typing import NamedTuple
17 18
18from command import Command, DEFAULT_LOCAL_JOBS 19from command import Command
19from git_config import IsImmutable 20from command import DEFAULT_LOCAL_JOBS
21from error import RepoExitError
20from git_command import git 22from git_command import git
23from git_config import IsImmutable
21from progress import Progress 24from progress import Progress
22from project import Project 25from project import Project
23from typing import NamedTuple
24from error import RepoExitError
25 26
26 27
27class ExecuteOneResult(NamedTuple): 28class ExecuteOneResult(NamedTuple):
diff --git a/subcmds/status.py b/subcmds/status.py
index 6e0026f9..dac61ab6 100644
--- a/subcmds/status.py
+++ b/subcmds/status.py
@@ -17,9 +17,9 @@ import glob
17import io 17import io
18import os 18import os
19 19
20from command import DEFAULT_LOCAL_JOBS, PagedCommand
21
22from color import Coloring 20from color import Coloring
21from command import DEFAULT_LOCAL_JOBS
22from command import PagedCommand
23import platform_utils 23import platform_utils
24 24
25 25
diff --git a/subcmds/sync.py b/subcmds/sync.py
index 74bc4557..13c964b2 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -25,13 +25,14 @@ import socket
25import sys 25import sys
26import tempfile 26import tempfile
27import time 27import time
28from typing import NamedTuple, List, Set 28from typing import List, NamedTuple, Set
29import urllib.error 29import urllib.error
30import urllib.parse 30import urllib.parse
31import urllib.request 31import urllib.request
32import xml.parsers.expat 32import xml.parsers.expat
33import xmlrpc.client 33import xmlrpc.client
34 34
35
35try: 36try:
36 import threading as _threading 37 import threading as _threading
37except ImportError: 38except ImportError:
@@ -49,34 +50,35 @@ except ImportError:
49 return (256, 256) 50 return (256, 256)
50 51
51 52
53from command import Command
54from command import DEFAULT_LOCAL_JOBS
55from command import MirrorSafeCommand
56from command import WORKER_BATCH_SIZE
57from error import GitError
58from error import RepoChangedException
59from error import RepoExitError
60from error import RepoUnhandledExceptionError
61from error import SyncError
62from error import UpdateManifestError
52import event_log 63import event_log
53from git_command import git_require 64from git_command import git_require
54from git_config import GetUrlCookieFile 65from git_config import GetUrlCookieFile
55from git_refs import R_HEADS, HEAD 66from git_refs import HEAD
67from git_refs import R_HEADS
56import git_superproject 68import git_superproject
69import platform_utils
70from progress import elapsed_str
71from progress import jobs_str
72from progress import Progress
73from project import DeleteWorktreeError
57from project import Project 74from project import Project
58from project import RemoteSpec 75from project import RemoteSpec
59from command import ( 76from project import SyncBuffer
60 Command,
61 DEFAULT_LOCAL_JOBS,
62 MirrorSafeCommand,
63 WORKER_BATCH_SIZE,
64)
65from error import (
66 RepoChangedException,
67 GitError,
68 RepoExitError,
69 SyncError,
70 UpdateManifestError,
71 RepoUnhandledExceptionError,
72)
73import platform_utils
74from project import SyncBuffer, DeleteWorktreeError
75from progress import Progress, elapsed_str, jobs_str
76from repo_trace import Trace 77from repo_trace import Trace
77import ssh 78import ssh
78from wrapper import Wrapper 79from wrapper import Wrapper
79 80
81
80_ONE_DAY_S = 24 * 60 * 60 82_ONE_DAY_S = 24 * 60 * 60
81 83
82# Env var to implicitly turn auto-gc back on. This was added to allow a user to 84# Env var to implicitly turn auto-gc back on. This was added to allow a user to
diff --git a/subcmds/upload.py b/subcmds/upload.py
index b89525ce..ec89ad43 100644
--- a/subcmds/upload.py
+++ b/subcmds/upload.py
@@ -19,9 +19,12 @@ import re
19import sys 19import sys
20from typing import List 20from typing import List
21 21
22from command import DEFAULT_LOCAL_JOBS, InteractiveCommand 22from command import DEFAULT_LOCAL_JOBS
23from command import InteractiveCommand
23from editor import Editor 24from editor import Editor
24from error import UploadError, SilentRepoExitError, GitError 25from error import GitError
26from error import SilentRepoExitError
27from error import UploadError
25from git_command import GitCommand 28from git_command import GitCommand
26from git_refs import R_HEADS 29from git_refs import R_HEADS
27from hooks import RepoHook 30from hooks import RepoHook
diff --git a/subcmds/version.py b/subcmds/version.py
index c539db63..71a03608 100644
--- a/subcmds/version.py
+++ b/subcmds/version.py
@@ -15,8 +15,11 @@
15import platform 15import platform
16import sys 16import sys
17 17
18from command import Command, MirrorSafeCommand 18from command import Command
19from git_command import git, RepoSourceVersion, user_agent 19from command import MirrorSafeCommand
20from git_command import git
21from git_command import RepoSourceVersion
22from git_command import user_agent
20from git_refs import HEAD 23from git_refs import HEAD
21from wrapper import Wrapper 24from wrapper import Wrapper
22 25
diff --git a/tests/test_error.py b/tests/test_error.py
index 2b28f5c2..a74ed2d7 100644
--- a/tests/test_error.py
+++ b/tests/test_error.py
@@ -18,13 +18,14 @@ import inspect
18import pickle 18import pickle
19import unittest 19import unittest
20 20
21import command
21import error 22import error
22import project
23import git_command
24import fetch 23import fetch
25import command 24import git_command
25import project
26from subcmds import all_modules 26from subcmds import all_modules
27 27
28
28imports = all_modules + [ 29imports = all_modules + [
29 error, 30 error,
30 project, 31 project,
diff --git a/tests/test_git_command.py b/tests/test_git_command.py
index 3dd31b29..c803d280 100644
--- a/tests/test_git_command.py
+++ b/tests/test_git_command.py
@@ -14,11 +14,12 @@
14 14
15"""Unittests for the git_command.py module.""" 15"""Unittests for the git_command.py module."""
16 16
17import re
18import os 17import os
18import re
19import subprocess 19import subprocess
20import unittest 20import unittest
21 21
22
22try: 23try:
23 from unittest import mock 24 from unittest import mock
24except ImportError: 25except ImportError:
diff --git a/tests/test_git_superproject.py b/tests/test_git_superproject.py
index eb542c60..f884f507 100644
--- a/tests/test_git_superproject.py
+++ b/tests/test_git_superproject.py
@@ -21,10 +21,11 @@ import tempfile
21import unittest 21import unittest
22from unittest import mock 22from unittest import mock
23 23
24from test_manifest_xml import sort_attributes
25
24import git_superproject 26import git_superproject
25import git_trace2_event_log 27import git_trace2_event_log
26import manifest_xml 28import manifest_xml
27from test_manifest_xml import sort_attributes
28 29
29 30
30class SuperprojectTestCase(unittest.TestCase): 31class SuperprojectTestCase(unittest.TestCase):
diff --git a/tests/test_hooks.py b/tests/test_hooks.py
index 78277128..76e928f7 100644
--- a/tests/test_hooks.py
+++ b/tests/test_hooks.py
@@ -14,9 +14,10 @@
14 14
15"""Unittests for the hooks.py module.""" 15"""Unittests for the hooks.py module."""
16 16
17import hooks
18import unittest 17import unittest
19 18
19import hooks
20
20 21
21class RepoHookShebang(unittest.TestCase): 22class RepoHookShebang(unittest.TestCase):
22 """Check shebang parsing in RepoHook.""" 23 """Check shebang parsing in RepoHook."""
diff --git a/tests/test_project.py b/tests/test_project.py
index bc8330b2..79728d70 100644
--- a/tests/test_project.py
+++ b/tests/test_project.py
@@ -22,9 +22,9 @@ import tempfile
22import unittest 22import unittest
23 23
24import error 24import error
25import manifest_xml
26import git_command 25import git_command
27import git_config 26import git_config
27import manifest_xml
28import platform_utils 28import platform_utils
29import project 29import project
30 30
diff --git a/tests/test_subcmds_sync.py b/tests/test_subcmds_sync.py
index 71b0f8e0..b9f0a746 100644
--- a/tests/test_subcmds_sync.py
+++ b/tests/test_subcmds_sync.py
@@ -16,16 +16,17 @@
16import os 16import os
17import shutil 17import shutil
18import tempfile 18import tempfile
19import unittest
20import time 19import time
20import unittest
21from unittest import mock 21from unittest import mock
22 22
23import pytest 23import pytest
24 24
25import command 25import command
26from subcmds import sync 26from error import GitError
27from error import RepoExitError
27from project import SyncNetworkHalfResult 28from project import SyncNetworkHalfResult
28from error import GitError, RepoExitError 29from subcmds import sync
29 30
30 31
31@pytest.mark.parametrize( 32@pytest.mark.parametrize(
diff --git a/tests/test_subcmds_upload.py b/tests/test_subcmds_upload.py
index 75811996..cd888977 100644
--- a/tests/test_subcmds_upload.py
+++ b/tests/test_subcmds_upload.py
@@ -17,8 +17,9 @@
17import unittest 17import unittest
18from unittest import mock 18from unittest import mock
19 19
20from error import GitError
21from error import UploadError
20from subcmds import upload 22from subcmds import upload
21from error import UploadError, GitError
22 23
23 24
24class UnexpectedError(Exception): 25class UnexpectedError(Exception):