mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
isort: format codebase
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>
This commit is contained in:
parent
06ddc8c50a
commit
6447733eb2
41
.isort.cfg
Normal file
41
.isort.cfg
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
# Copyright 2023 The Android Open Source Project
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
# Config file for the isort python module.
|
||||||
|
# This is used to enforce import sorting standards.
|
||||||
|
#
|
||||||
|
# https://pycqa.github.io/isort/docs/configuration/options.html
|
||||||
|
|
||||||
|
[settings]
|
||||||
|
# Be compatible with `black` since it also matches what we want.
|
||||||
|
profile = black
|
||||||
|
|
||||||
|
line_length = 80
|
||||||
|
length_sort = false
|
||||||
|
force_single_line = true
|
||||||
|
lines_after_imports = 2
|
||||||
|
from_first = false
|
||||||
|
case_sensitive = false
|
||||||
|
force_sort_within_sections = true
|
||||||
|
order_by_type = false
|
||||||
|
|
||||||
|
# Ignore generated files.
|
||||||
|
extend_skip_glob = *_pb2.py
|
||||||
|
|
||||||
|
# Allow importing multiple classes on a single line from these modules.
|
||||||
|
# https://google.github.io/styleguide/pyguide#s2.2-imports
|
||||||
|
single_line_exclusions =
|
||||||
|
abc,
|
||||||
|
collections.abc,
|
||||||
|
typing,
|
1
color.py
1
color.py
@ -17,6 +17,7 @@ import sys
|
|||||||
|
|
||||||
import pager
|
import pager
|
||||||
|
|
||||||
|
|
||||||
COLORS = {
|
COLORS = {
|
||||||
None: -1,
|
None: -1,
|
||||||
"normal": -1,
|
"normal": -1,
|
||||||
|
@ -13,14 +13,14 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
import os
|
|
||||||
import optparse
|
import optparse
|
||||||
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from event_log import EventLog
|
|
||||||
from error import NoSuchProjectError
|
|
||||||
from error import InvalidProjectGroupsError
|
from error import InvalidProjectGroupsError
|
||||||
|
from error import NoSuchProjectError
|
||||||
from error import RepoExitError
|
from error import RepoExitError
|
||||||
|
from event_log import EventLog
|
||||||
import progress
|
import progress
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
from error import EditorError
|
from error import EditorError
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
import json
|
import json
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
|
|
||||||
|
|
||||||
TASK_COMMAND = "command"
|
TASK_COMMAND = "command"
|
||||||
TASK_SYNC_NETWORK = "sync-network"
|
TASK_SYNC_NETWORK = "sync-network"
|
||||||
TASK_SYNC_LOCAL = "sync-local"
|
TASK_SYNC_LOCAL = "sync-local"
|
||||||
|
1
fetch.py
1
fetch.py
@ -18,6 +18,7 @@ import subprocess
|
|||||||
import sys
|
import sys
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
from urllib.request import urlopen
|
from urllib.request import urlopen
|
||||||
|
|
||||||
from error import RepoExitError
|
from error import RepoExitError
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,17 +14,20 @@
|
|||||||
|
|
||||||
import functools
|
import functools
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
from typing import Any, Optional
|
from typing import Any, Optional
|
||||||
|
|
||||||
from error import GitError
|
from error import GitError
|
||||||
from error import RepoExitError
|
from error import RepoExitError
|
||||||
from git_refs import HEAD
|
from git_refs import HEAD
|
||||||
import platform_utils
|
import platform_utils
|
||||||
from repo_trace import REPO_TRACE, IsTrace, Trace
|
from repo_trace import IsTrace
|
||||||
|
from repo_trace import REPO_TRACE
|
||||||
|
from repo_trace import Trace
|
||||||
from wrapper import Wrapper
|
from wrapper import Wrapper
|
||||||
|
|
||||||
|
|
||||||
GIT = "git"
|
GIT = "git"
|
||||||
# NB: These do not need to be kept in sync with the repo launcher script.
|
# NB: These do not need to be kept in sync with the repo launcher script.
|
||||||
# These may be much newer as it allows the repo launcher to roll between
|
# These may be much newer as it allows the repo launcher to roll between
|
||||||
|
@ -26,11 +26,15 @@ from typing import Union
|
|||||||
import urllib.error
|
import urllib.error
|
||||||
import urllib.request
|
import urllib.request
|
||||||
|
|
||||||
from error import GitError, UploadError
|
from error import GitError
|
||||||
|
from error import UploadError
|
||||||
|
from git_command import GitCommand
|
||||||
|
from git_refs import R_CHANGES
|
||||||
|
from git_refs import R_HEADS
|
||||||
|
from git_refs import R_TAGS
|
||||||
import platform_utils
|
import platform_utils
|
||||||
from repo_trace import Trace
|
from repo_trace import Trace
|
||||||
from git_command import GitCommand
|
|
||||||
from git_refs import R_CHANGES, R_HEADS, R_TAGS
|
|
||||||
|
|
||||||
# Prefix that is prepended to all the keys of SyncAnalysisState's data
|
# Prefix that is prepended to all the keys of SyncAnalysisState's data
|
||||||
# that is saved in the config.
|
# that is saved in the config.
|
||||||
|
@ -13,8 +13,10 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from repo_trace import Trace
|
|
||||||
import platform_utils
|
import platform_utils
|
||||||
|
from repo_trace import Trace
|
||||||
|
|
||||||
|
|
||||||
HEAD = "HEAD"
|
HEAD = "HEAD"
|
||||||
R_CHANGES = "refs/changes/"
|
R_CHANGES = "refs/changes/"
|
||||||
|
@ -22,17 +22,19 @@ Examples:
|
|||||||
UpdateProjectsResult = superproject.UpdateProjectsRevisionId(projects)
|
UpdateProjectsResult = superproject.UpdateProjectsRevisionId(projects)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import hashlib
|
|
||||||
import functools
|
import functools
|
||||||
|
import hashlib
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
from typing import NamedTuple
|
from typing import NamedTuple
|
||||||
|
|
||||||
from git_command import git_require, GitCommand
|
from git_command import git_require
|
||||||
|
from git_command import GitCommand
|
||||||
from git_config import RepoConfig
|
from git_config import RepoConfig
|
||||||
from git_refs import GitRefs
|
from git_refs import GitRefs
|
||||||
|
|
||||||
|
|
||||||
_SUPERPROJECT_GIT_NAME = "superproject.git"
|
_SUPERPROJECT_GIT_NAME = "superproject.git"
|
||||||
_SUPERPROJECT_MANIFEST_NAME = "superproject_override.xml"
|
_SUPERPROJECT_MANIFEST_NAME = "superproject_override.xml"
|
||||||
|
|
||||||
|
@ -37,7 +37,8 @@ import sys
|
|||||||
import tempfile
|
import tempfile
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
from git_command import GitCommand, RepoSourceVersion
|
from git_command import GitCommand
|
||||||
|
from git_command import RepoSourceVersion
|
||||||
|
|
||||||
|
|
||||||
class EventLog(object):
|
class EventLog(object):
|
||||||
|
28
main.py
28
main.py
@ -21,6 +21,7 @@ which takes care of execing this entry point.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import getpass
|
import getpass
|
||||||
|
import json
|
||||||
import netrc
|
import netrc
|
||||||
import optparse
|
import optparse
|
||||||
import os
|
import os
|
||||||
@ -30,7 +31,7 @@ import sys
|
|||||||
import textwrap
|
import textwrap
|
||||||
import time
|
import time
|
||||||
import urllib.request
|
import urllib.request
|
||||||
import json
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import kerberos
|
import kerberos
|
||||||
@ -38,31 +39,34 @@ except ImportError:
|
|||||||
kerberos = None
|
kerberos = None
|
||||||
|
|
||||||
from color import SetDefaultColoring
|
from color import SetDefaultColoring
|
||||||
import event_log
|
|
||||||
from repo_trace import SetTrace, Trace, SetTraceToStderr
|
|
||||||
from git_command import user_agent
|
|
||||||
from git_config import RepoConfig
|
|
||||||
from git_trace2_event_log import EventLog
|
|
||||||
from command import InteractiveCommand
|
from command import InteractiveCommand
|
||||||
from command import MirrorSafeCommand
|
from command import MirrorSafeCommand
|
||||||
from subcmds.version import Version
|
|
||||||
from editor import Editor
|
from editor import Editor
|
||||||
from error import DownloadError
|
from error import DownloadError
|
||||||
|
from error import GitcUnsupportedError
|
||||||
from error import InvalidProjectGroupsError
|
from error import InvalidProjectGroupsError
|
||||||
from error import ManifestInvalidRevisionError
|
from error import ManifestInvalidRevisionError
|
||||||
from error import NoManifestException
|
from error import NoManifestException
|
||||||
from error import NoSuchProjectError
|
from error import NoSuchProjectError
|
||||||
from error import RepoChangedException
|
from error import RepoChangedException
|
||||||
|
from error import RepoError
|
||||||
from error import RepoExitError
|
from error import RepoExitError
|
||||||
from error import RepoUnhandledExceptionError
|
from error import RepoUnhandledExceptionError
|
||||||
from error import RepoError
|
|
||||||
from error import SilentRepoExitError
|
from error import SilentRepoExitError
|
||||||
from error import GitcUnsupportedError
|
import event_log
|
||||||
|
from git_command import user_agent
|
||||||
|
from git_config import RepoConfig
|
||||||
|
from git_trace2_event_log import EventLog
|
||||||
from manifest_xml import RepoClient
|
from manifest_xml import RepoClient
|
||||||
from pager import RunPager, TerminatePager
|
from pager import RunPager
|
||||||
from wrapper import WrapperPath, Wrapper
|
from pager import TerminatePager
|
||||||
|
from repo_trace import SetTrace
|
||||||
|
from repo_trace import SetTraceToStderr
|
||||||
|
from repo_trace import Trace
|
||||||
from subcmds import all_commands
|
from subcmds import all_commands
|
||||||
|
from subcmds.version import Version
|
||||||
|
from wrapper import Wrapper
|
||||||
|
from wrapper import WrapperPath
|
||||||
|
|
||||||
|
|
||||||
# NB: These do not need to be kept in sync with the repo launcher script.
|
# NB: These do not need to be kept in sync with the repo launcher script.
|
||||||
|
@ -18,27 +18,25 @@ import os
|
|||||||
import platform
|
import platform
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import xml.dom.minidom
|
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
|
import xml.dom.minidom
|
||||||
|
|
||||||
|
from error import ManifestInvalidPathError
|
||||||
|
from error import ManifestInvalidRevisionError
|
||||||
|
from error import ManifestParseError
|
||||||
from git_config import GitConfig
|
from git_config import GitConfig
|
||||||
from git_refs import R_HEADS, HEAD
|
from git_refs import HEAD
|
||||||
|
from git_refs import R_HEADS
|
||||||
from git_superproject import Superproject
|
from git_superproject import Superproject
|
||||||
import platform_utils
|
import platform_utils
|
||||||
from project import (
|
from project import Annotation
|
||||||
Annotation,
|
from project import ManifestProject
|
||||||
RemoteSpec,
|
from project import Project
|
||||||
Project,
|
from project import RemoteSpec
|
||||||
RepoProject,
|
from project import RepoProject
|
||||||
ManifestProject,
|
|
||||||
)
|
|
||||||
from error import (
|
|
||||||
ManifestParseError,
|
|
||||||
ManifestInvalidPathError,
|
|
||||||
ManifestInvalidRevisionError,
|
|
||||||
)
|
|
||||||
from wrapper import Wrapper
|
from wrapper import Wrapper
|
||||||
|
|
||||||
|
|
||||||
MANIFEST_FILE_NAME = "manifest.xml"
|
MANIFEST_FILE_NAME = "manifest.xml"
|
||||||
LOCAL_MANIFEST_NAME = "local_manifest.xml"
|
LOCAL_MANIFEST_NAME = "local_manifest.xml"
|
||||||
LOCAL_MANIFESTS_DIR_NAME = "local_manifests"
|
LOCAL_MANIFESTS_DIR_NAME = "local_manifests"
|
||||||
|
1
pager.py
1
pager.py
@ -19,6 +19,7 @@ import sys
|
|||||||
|
|
||||||
import platform_utils
|
import platform_utils
|
||||||
|
|
||||||
|
|
||||||
active = False
|
active = False
|
||||||
pager_process = None
|
pager_process = None
|
||||||
old_stdout = None
|
old_stdout = None
|
||||||
|
@ -12,12 +12,28 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
from ctypes import addressof
|
||||||
|
from ctypes import byref
|
||||||
|
from ctypes import c_buffer
|
||||||
|
from ctypes import c_ubyte
|
||||||
|
from ctypes import FormatError
|
||||||
|
from ctypes import get_last_error
|
||||||
|
from ctypes import Structure
|
||||||
|
from ctypes import Union
|
||||||
|
from ctypes import WinDLL
|
||||||
|
from ctypes import WinError
|
||||||
|
from ctypes.wintypes import BOOL
|
||||||
|
from ctypes.wintypes import BOOLEAN
|
||||||
|
from ctypes.wintypes import DWORD
|
||||||
|
from ctypes.wintypes import HANDLE
|
||||||
|
from ctypes.wintypes import LPCWSTR
|
||||||
|
from ctypes.wintypes import LPDWORD
|
||||||
|
from ctypes.wintypes import LPVOID
|
||||||
|
from ctypes.wintypes import ULONG
|
||||||
|
from ctypes.wintypes import USHORT
|
||||||
|
from ctypes.wintypes import WCHAR
|
||||||
import errno
|
import errno
|
||||||
|
|
||||||
from ctypes import WinDLL, get_last_error, FormatError, WinError, addressof
|
|
||||||
from ctypes import c_buffer, c_ubyte, Structure, Union, byref
|
|
||||||
from ctypes.wintypes import BOOL, BOOLEAN, LPCWSTR, DWORD, HANDLE
|
|
||||||
from ctypes.wintypes import WCHAR, USHORT, LPVOID, ULONG, LPDWORD
|
|
||||||
|
|
||||||
kernel32 = WinDLL("kernel32", use_last_error=True)
|
kernel32 = WinDLL("kernel32", use_last_error=True)
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import threading as _threading
|
import threading as _threading
|
||||||
except ImportError:
|
except ImportError:
|
||||||
@ -23,6 +24,7 @@ except ImportError:
|
|||||||
|
|
||||||
from repo_trace import IsTraceToStderr
|
from repo_trace import IsTraceToStderr
|
||||||
|
|
||||||
|
|
||||||
_TTY = sys.stderr.isatty()
|
_TTY = sys.stderr.isatty()
|
||||||
|
|
||||||
# This will erase all content in the current line (wherever the cursor is).
|
# This will erase all content in the current line (wherever the cursor is).
|
||||||
|
42
project.py
42
project.py
@ -26,35 +26,39 @@ import sys
|
|||||||
import tarfile
|
import tarfile
|
||||||
import tempfile
|
import tempfile
|
||||||
import time
|
import time
|
||||||
from typing import NamedTuple, List
|
from typing import List, NamedTuple
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
|
|
||||||
from color import Coloring
|
from color import Coloring
|
||||||
|
from error import DownloadError
|
||||||
|
from error import GitError
|
||||||
|
from error import ManifestInvalidPathError
|
||||||
|
from error import ManifestInvalidRevisionError
|
||||||
|
from error import ManifestParseError
|
||||||
|
from error import NoManifestException
|
||||||
|
from error import RepoError
|
||||||
|
from error import UploadError
|
||||||
import fetch
|
import fetch
|
||||||
from git_command import GitCommand, git_require
|
from git_command import git_require
|
||||||
from git_config import (
|
from git_command import GitCommand
|
||||||
GitConfig,
|
from git_config import GetSchemeFromUrl
|
||||||
IsId,
|
from git_config import GetUrlCookieFile
|
||||||
GetSchemeFromUrl,
|
from git_config import GitConfig
|
||||||
GetUrlCookieFile,
|
from git_config import ID_RE
|
||||||
ID_RE,
|
from git_config import IsId
|
||||||
)
|
from git_refs import GitRefs
|
||||||
|
from git_refs import HEAD
|
||||||
|
from git_refs import R_HEADS
|
||||||
|
from git_refs import R_M
|
||||||
|
from git_refs import R_PUB
|
||||||
|
from git_refs import R_TAGS
|
||||||
|
from git_refs import R_WORKTREE_M
|
||||||
import git_superproject
|
import git_superproject
|
||||||
from git_trace2_event_log import EventLog
|
from git_trace2_event_log import EventLog
|
||||||
from error import (
|
|
||||||
GitError,
|
|
||||||
UploadError,
|
|
||||||
DownloadError,
|
|
||||||
RepoError,
|
|
||||||
)
|
|
||||||
from error import ManifestInvalidRevisionError, ManifestInvalidPathError
|
|
||||||
from error import NoManifestException, ManifestParseError
|
|
||||||
import platform_utils
|
import platform_utils
|
||||||
import progress
|
import progress
|
||||||
from repo_trace import Trace
|
from repo_trace import Trace
|
||||||
|
|
||||||
from git_refs import GitRefs, HEAD, R_HEADS, R_TAGS, R_PUB, R_M, R_WORKTREE_M
|
|
||||||
|
|
||||||
|
|
||||||
class SyncNetworkHalfResult(NamedTuple):
|
class SyncNetworkHalfResult(NamedTuple):
|
||||||
"""Sync_NetworkHalf return value."""
|
"""Sync_NetworkHalf return value."""
|
||||||
|
@ -22,4 +22,5 @@ import sys
|
|||||||
|
|
||||||
import update_manpages
|
import update_manpages
|
||||||
|
|
||||||
|
|
||||||
sys.exit(update_manpages.main(sys.argv[1:]))
|
sys.exit(update_manpages.main(sys.argv[1:]))
|
||||||
|
@ -17,17 +17,18 @@
|
|||||||
Most code lives in this module so it can be unittested.
|
Most code lives in this module so it can be unittested.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from pathlib import Path
|
|
||||||
import argparse
|
import argparse
|
||||||
import functools
|
import functools
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
import os
|
import os
|
||||||
|
from pathlib import Path
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
|
|
||||||
TOPDIR = Path(__file__).resolve().parent.parent
|
TOPDIR = Path(__file__).resolve().parent.parent
|
||||||
MANDIR = TOPDIR.joinpath("man")
|
MANDIR = TOPDIR.joinpath("man")
|
||||||
|
|
||||||
|
4
repo
4
repo
@ -254,11 +254,13 @@ import re
|
|||||||
import shutil
|
import shutil
|
||||||
import stat
|
import stat
|
||||||
|
|
||||||
|
|
||||||
if sys.version_info[0] == 3:
|
if sys.version_info[0] == 3:
|
||||||
import urllib.request
|
|
||||||
import urllib.error
|
import urllib.error
|
||||||
|
import urllib.request
|
||||||
else:
|
else:
|
||||||
import imp
|
import imp
|
||||||
|
|
||||||
import urllib2
|
import urllib2
|
||||||
urllib = imp.new_module('urllib')
|
urllib = imp.new_module('urllib')
|
||||||
urllib.request = urllib2
|
urllib.request = urllib2
|
||||||
|
@ -19,6 +19,7 @@ import multiprocessing
|
|||||||
|
|
||||||
from color import Coloring
|
from color import Coloring
|
||||||
|
|
||||||
|
|
||||||
SEPARATOR = "=" * 80
|
SEPARATOR = "=" * 80
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,13 +21,14 @@ To also include trace outputs in stderr do `repo --trace_to_stderr ...`
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import contextlib
|
import contextlib
|
||||||
import sys
|
|
||||||
import os
|
import os
|
||||||
import time
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import time
|
||||||
|
|
||||||
import platform_utils
|
import platform_utils
|
||||||
|
|
||||||
|
|
||||||
# Env var to implicitly turn on tracing.
|
# Env var to implicitly turn on tracing.
|
||||||
REPO_TRACE = "REPO_TRACE"
|
REPO_TRACE = "REPO_TRACE"
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
@ -38,12 +39,20 @@ def run_flake8():
|
|||||||
).returncode
|
).returncode
|
||||||
|
|
||||||
|
|
||||||
|
def run_isort():
|
||||||
|
"""Returns the exit code from isort."""
|
||||||
|
return subprocess.run(
|
||||||
|
[sys.executable, "-m", "isort", "--check", ROOT_DIR], check=False
|
||||||
|
).returncode
|
||||||
|
|
||||||
|
|
||||||
def main(argv):
|
def main(argv):
|
||||||
"""The main entry."""
|
"""The main entry."""
|
||||||
checks = (
|
checks = (
|
||||||
lambda: pytest.main(argv),
|
lambda: pytest.main(argv),
|
||||||
run_black,
|
run_black,
|
||||||
run_flake8,
|
run_flake8,
|
||||||
|
run_isort,
|
||||||
)
|
)
|
||||||
return 0 if all(not c() for c in checks) else 1
|
return 0 if all(not c() for c in checks) else 1
|
||||||
|
|
||||||
|
@ -123,3 +123,8 @@ wheel: <
|
|||||||
name: "infra/python/wheels/pycodestyle-py2_py3"
|
name: "infra/python/wheels/pycodestyle-py2_py3"
|
||||||
version: "version:2.10.0"
|
version: "version:2.10.0"
|
||||||
>
|
>
|
||||||
|
|
||||||
|
wheel: <
|
||||||
|
name: "infra/python/wheels/isort-py3"
|
||||||
|
version: "version:5.10.1"
|
||||||
|
>
|
||||||
|
1
setup.py
1
setup.py
@ -16,6 +16,7 @@
|
|||||||
"""Python packaging for repo."""
|
"""Python packaging for repo."""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import setuptools
|
import setuptools
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
# A mapping of the subcommand name to the class that implements it.
|
# A mapping of the subcommand name to the class that implements it.
|
||||||
all_commands = {}
|
all_commands = {}
|
||||||
all_modules = []
|
all_modules = []
|
||||||
|
@ -17,10 +17,12 @@ import functools
|
|||||||
import itertools
|
import itertools
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from command import Command, DEFAULT_LOCAL_JOBS
|
from command import Command
|
||||||
|
from command import DEFAULT_LOCAL_JOBS
|
||||||
|
from error import RepoError
|
||||||
|
from error import RepoExitError
|
||||||
from git_command import git
|
from git_command import git
|
||||||
from progress import Progress
|
from progress import Progress
|
||||||
from error import RepoError, RepoExitError
|
|
||||||
|
|
||||||
|
|
||||||
class AbandonError(RepoExitError):
|
class AbandonError(RepoExitError):
|
||||||
|
@ -16,7 +16,8 @@ import itertools
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
from color import Coloring
|
from color import Coloring
|
||||||
from command import Command, DEFAULT_LOCAL_JOBS
|
from command import Command
|
||||||
|
from command import DEFAULT_LOCAL_JOBS
|
||||||
|
|
||||||
|
|
||||||
class BranchColoring(Coloring):
|
class BranchColoring(Coloring):
|
||||||
|
@ -14,12 +14,14 @@
|
|||||||
|
|
||||||
import functools
|
import functools
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from typing import NamedTuple
|
from typing import NamedTuple
|
||||||
from command import Command, DEFAULT_LOCAL_JOBS
|
|
||||||
|
from command import Command
|
||||||
|
from command import DEFAULT_LOCAL_JOBS
|
||||||
|
from error import GitError
|
||||||
|
from error import RepoExitError
|
||||||
from progress import Progress
|
from progress import Progress
|
||||||
from project import Project
|
from project import Project
|
||||||
from error import GitError, RepoExitError
|
|
||||||
|
|
||||||
|
|
||||||
class CheckoutBranchResult(NamedTuple):
|
class CheckoutBranchResult(NamedTuple):
|
||||||
|
@ -14,9 +14,11 @@
|
|||||||
|
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from command import Command
|
from command import Command
|
||||||
from git_command import GitCommand
|
|
||||||
from error import GitError
|
from error import GitError
|
||||||
|
from git_command import GitCommand
|
||||||
|
|
||||||
|
|
||||||
CHANGE_ID_RE = re.compile(r"^\s*Change-Id: I([0-9a-f]{40})\s*$")
|
CHANGE_ID_RE = re.compile(r"^\s*Change-Id: I([0-9a-f]{40})\s*$")
|
||||||
|
|
||||||
|
@ -15,7 +15,8 @@
|
|||||||
import functools
|
import functools
|
||||||
import io
|
import io
|
||||||
|
|
||||||
from command import DEFAULT_LOCAL_JOBS, PagedCommand
|
from command import DEFAULT_LOCAL_JOBS
|
||||||
|
from command import PagedCommand
|
||||||
|
|
||||||
|
|
||||||
class Diff(PagedCommand):
|
class Diff(PagedCommand):
|
||||||
|
@ -16,7 +16,10 @@ import re
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
from command import Command
|
from command import Command
|
||||||
from error import GitError, NoSuchProjectError, RepoExitError
|
from error import GitError
|
||||||
|
from error import NoSuchProjectError
|
||||||
|
from error import RepoExitError
|
||||||
|
|
||||||
|
|
||||||
CHANGE_RE = re.compile(r"^([1-9][0-9]*)(?:[/\.-]([1-9][0-9]*))?$")
|
CHANGE_RE = re.compile(r"^([1-9][0-9]*)(?:[/\.-]([1-9][0-9]*))?$")
|
||||||
|
|
||||||
|
@ -16,21 +16,20 @@ import errno
|
|||||||
import functools
|
import functools
|
||||||
import io
|
import io
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
import re
|
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import signal
|
import signal
|
||||||
import sys
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
from color import Coloring
|
from color import Coloring
|
||||||
from command import (
|
from command import Command
|
||||||
DEFAULT_LOCAL_JOBS,
|
from command import DEFAULT_LOCAL_JOBS
|
||||||
Command,
|
from command import MirrorSafeCommand
|
||||||
MirrorSafeCommand,
|
from command import WORKER_BATCH_SIZE
|
||||||
WORKER_BATCH_SIZE,
|
|
||||||
)
|
|
||||||
from error import ManifestInvalidRevisionError
|
from error import ManifestInvalidRevisionError
|
||||||
|
|
||||||
|
|
||||||
_CAN_COLOR = [
|
_CAN_COLOR = [
|
||||||
"branch",
|
"branch",
|
||||||
"diff",
|
"diff",
|
||||||
|
@ -14,12 +14,15 @@
|
|||||||
|
|
||||||
import functools
|
import functools
|
||||||
import sys
|
import sys
|
||||||
|
from typing import NamedTuple
|
||||||
|
|
||||||
from color import Coloring
|
from color import Coloring
|
||||||
from command import DEFAULT_LOCAL_JOBS, PagedCommand
|
from command import DEFAULT_LOCAL_JOBS
|
||||||
from error import GitError, InvalidArgumentsError, SilentRepoExitError
|
from command import PagedCommand
|
||||||
|
from error import GitError
|
||||||
|
from error import InvalidArgumentsError
|
||||||
|
from error import SilentRepoExitError
|
||||||
from git_command import GitCommand
|
from git_command import GitCommand
|
||||||
from typing import NamedTuple
|
|
||||||
from project import Project
|
from project import Project
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,14 +16,12 @@ import re
|
|||||||
import sys
|
import sys
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|
||||||
from subcmds import all_commands
|
|
||||||
from color import Coloring
|
from color import Coloring
|
||||||
from command import (
|
from command import MirrorSafeCommand
|
||||||
PagedCommand,
|
from command import PagedCommand
|
||||||
MirrorSafeCommand,
|
|
||||||
)
|
|
||||||
from wrapper import Wrapper
|
|
||||||
from error import RepoExitError
|
from error import RepoExitError
|
||||||
|
from subcmds import all_commands
|
||||||
|
from wrapper import Wrapper
|
||||||
|
|
||||||
|
|
||||||
class InvalidHelpCommand(RepoExitError):
|
class InvalidHelpCommand(RepoExitError):
|
||||||
|
@ -14,9 +14,10 @@
|
|||||||
|
|
||||||
import optparse
|
import optparse
|
||||||
|
|
||||||
from command import PagedCommand
|
|
||||||
from color import Coloring
|
from color import Coloring
|
||||||
from git_refs import R_M, R_HEADS
|
from command import PagedCommand
|
||||||
|
from git_refs import R_HEADS
|
||||||
|
from git_refs import R_M
|
||||||
|
|
||||||
|
|
||||||
class _Coloring(Coloring):
|
class _Coloring(Coloring):
|
||||||
|
@ -16,11 +16,15 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
from color import Coloring
|
from color import Coloring
|
||||||
from command import InteractiveCommand, MirrorSafeCommand
|
from command import InteractiveCommand
|
||||||
from git_command import git_require, MIN_GIT_VERSION_SOFT, MIN_GIT_VERSION_HARD
|
from command import MirrorSafeCommand
|
||||||
from wrapper import Wrapper
|
|
||||||
from error import UpdateManifestError
|
|
||||||
from error import RepoUnhandledExceptionError
|
from error import RepoUnhandledExceptionError
|
||||||
|
from error import UpdateManifestError
|
||||||
|
from git_command import git_require
|
||||||
|
from git_command import MIN_GIT_VERSION_HARD
|
||||||
|
from git_command import MIN_GIT_VERSION_SOFT
|
||||||
|
from wrapper import Wrapper
|
||||||
|
|
||||||
|
|
||||||
_REPO_ALLOW_SHALLOW = os.environ.get("REPO_ALLOW_SHALLOW")
|
_REPO_ALLOW_SHALLOW = os.environ.get("REPO_ALLOW_SHALLOW")
|
||||||
|
|
||||||
|
@ -14,7 +14,8 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from command import Command, MirrorSafeCommand
|
from command import Command
|
||||||
|
from command import MirrorSafeCommand
|
||||||
|
|
||||||
|
|
||||||
class List(Command, MirrorSafeCommand):
|
class List(Command, MirrorSafeCommand):
|
||||||
|
@ -15,7 +15,8 @@
|
|||||||
import itertools
|
import itertools
|
||||||
|
|
||||||
from color import Coloring
|
from color import Coloring
|
||||||
from command import DEFAULT_LOCAL_JOBS, PagedCommand
|
from command import DEFAULT_LOCAL_JOBS
|
||||||
|
from command import PagedCommand
|
||||||
|
|
||||||
|
|
||||||
class Prune(PagedCommand):
|
class Prune(PagedCommand):
|
||||||
|
@ -15,10 +15,11 @@
|
|||||||
import optparse
|
import optparse
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from command import Command, MirrorSafeCommand
|
from command import Command
|
||||||
from subcmds.sync import _PostRepoUpgrade
|
from command import MirrorSafeCommand
|
||||||
from subcmds.sync import _PostRepoFetch
|
|
||||||
from error import RepoExitError
|
from error import RepoExitError
|
||||||
|
from subcmds.sync import _PostRepoFetch
|
||||||
|
from subcmds.sync import _PostRepoUpgrade
|
||||||
|
|
||||||
|
|
||||||
class SelfupdateError(RepoExitError):
|
class SelfupdateError(RepoExitError):
|
||||||
|
@ -14,14 +14,15 @@
|
|||||||
|
|
||||||
import functools
|
import functools
|
||||||
import sys
|
import sys
|
||||||
|
from typing import NamedTuple
|
||||||
|
|
||||||
from command import Command, DEFAULT_LOCAL_JOBS
|
from command import Command
|
||||||
from git_config import IsImmutable
|
from command import DEFAULT_LOCAL_JOBS
|
||||||
|
from error import RepoExitError
|
||||||
from git_command import git
|
from git_command import git
|
||||||
|
from git_config import IsImmutable
|
||||||
from progress import Progress
|
from progress import Progress
|
||||||
from project import Project
|
from project import Project
|
||||||
from typing import NamedTuple
|
|
||||||
from error import RepoExitError
|
|
||||||
|
|
||||||
|
|
||||||
class ExecuteOneResult(NamedTuple):
|
class ExecuteOneResult(NamedTuple):
|
||||||
|
@ -17,9 +17,9 @@ import glob
|
|||||||
import io
|
import io
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from command import DEFAULT_LOCAL_JOBS, PagedCommand
|
|
||||||
|
|
||||||
from color import Coloring
|
from color import Coloring
|
||||||
|
from command import DEFAULT_LOCAL_JOBS
|
||||||
|
from command import PagedCommand
|
||||||
import platform_utils
|
import platform_utils
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,13 +25,14 @@ import socket
|
|||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
import time
|
import time
|
||||||
from typing import NamedTuple, List, Set
|
from typing import List, NamedTuple, Set
|
||||||
import urllib.error
|
import urllib.error
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
import urllib.request
|
import urllib.request
|
||||||
import xml.parsers.expat
|
import xml.parsers.expat
|
||||||
import xmlrpc.client
|
import xmlrpc.client
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import threading as _threading
|
import threading as _threading
|
||||||
except ImportError:
|
except ImportError:
|
||||||
@ -49,34 +50,35 @@ except ImportError:
|
|||||||
return (256, 256)
|
return (256, 256)
|
||||||
|
|
||||||
|
|
||||||
|
from command import Command
|
||||||
|
from command import DEFAULT_LOCAL_JOBS
|
||||||
|
from command import MirrorSafeCommand
|
||||||
|
from command import WORKER_BATCH_SIZE
|
||||||
|
from error import GitError
|
||||||
|
from error import RepoChangedException
|
||||||
|
from error import RepoExitError
|
||||||
|
from error import RepoUnhandledExceptionError
|
||||||
|
from error import SyncError
|
||||||
|
from error import UpdateManifestError
|
||||||
import event_log
|
import event_log
|
||||||
from git_command import git_require
|
from git_command import git_require
|
||||||
from git_config import GetUrlCookieFile
|
from git_config import GetUrlCookieFile
|
||||||
from git_refs import R_HEADS, HEAD
|
from git_refs import HEAD
|
||||||
|
from git_refs import R_HEADS
|
||||||
import git_superproject
|
import git_superproject
|
||||||
|
import platform_utils
|
||||||
|
from progress import elapsed_str
|
||||||
|
from progress import jobs_str
|
||||||
|
from progress import Progress
|
||||||
|
from project import DeleteWorktreeError
|
||||||
from project import Project
|
from project import Project
|
||||||
from project import RemoteSpec
|
from project import RemoteSpec
|
||||||
from command import (
|
from project import SyncBuffer
|
||||||
Command,
|
|
||||||
DEFAULT_LOCAL_JOBS,
|
|
||||||
MirrorSafeCommand,
|
|
||||||
WORKER_BATCH_SIZE,
|
|
||||||
)
|
|
||||||
from error import (
|
|
||||||
RepoChangedException,
|
|
||||||
GitError,
|
|
||||||
RepoExitError,
|
|
||||||
SyncError,
|
|
||||||
UpdateManifestError,
|
|
||||||
RepoUnhandledExceptionError,
|
|
||||||
)
|
|
||||||
import platform_utils
|
|
||||||
from project import SyncBuffer, DeleteWorktreeError
|
|
||||||
from progress import Progress, elapsed_str, jobs_str
|
|
||||||
from repo_trace import Trace
|
from repo_trace import Trace
|
||||||
import ssh
|
import ssh
|
||||||
from wrapper import Wrapper
|
from wrapper import Wrapper
|
||||||
|
|
||||||
|
|
||||||
_ONE_DAY_S = 24 * 60 * 60
|
_ONE_DAY_S = 24 * 60 * 60
|
||||||
|
|
||||||
# Env var to implicitly turn auto-gc back on. This was added to allow a user to
|
# Env var to implicitly turn auto-gc back on. This was added to allow a user to
|
||||||
|
@ -19,9 +19,12 @@ import re
|
|||||||
import sys
|
import sys
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
from command import DEFAULT_LOCAL_JOBS, InteractiveCommand
|
from command import DEFAULT_LOCAL_JOBS
|
||||||
|
from command import InteractiveCommand
|
||||||
from editor import Editor
|
from editor import Editor
|
||||||
from error import UploadError, SilentRepoExitError, GitError
|
from error import GitError
|
||||||
|
from error import SilentRepoExitError
|
||||||
|
from error import UploadError
|
||||||
from git_command import GitCommand
|
from git_command import GitCommand
|
||||||
from git_refs import R_HEADS
|
from git_refs import R_HEADS
|
||||||
from hooks import RepoHook
|
from hooks import RepoHook
|
||||||
|
@ -15,8 +15,11 @@
|
|||||||
import platform
|
import platform
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from command import Command, MirrorSafeCommand
|
from command import Command
|
||||||
from git_command import git, RepoSourceVersion, user_agent
|
from command import MirrorSafeCommand
|
||||||
|
from git_command import git
|
||||||
|
from git_command import RepoSourceVersion
|
||||||
|
from git_command import user_agent
|
||||||
from git_refs import HEAD
|
from git_refs import HEAD
|
||||||
from wrapper import Wrapper
|
from wrapper import Wrapper
|
||||||
|
|
||||||
|
@ -18,13 +18,14 @@ import inspect
|
|||||||
import pickle
|
import pickle
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import error
|
|
||||||
import project
|
|
||||||
import git_command
|
|
||||||
import fetch
|
|
||||||
import command
|
import command
|
||||||
|
import error
|
||||||
|
import fetch
|
||||||
|
import git_command
|
||||||
|
import project
|
||||||
from subcmds import all_modules
|
from subcmds import all_modules
|
||||||
|
|
||||||
|
|
||||||
imports = all_modules + [
|
imports = all_modules + [
|
||||||
error,
|
error,
|
||||||
project,
|
project,
|
||||||
|
@ -14,11 +14,12 @@
|
|||||||
|
|
||||||
"""Unittests for the git_command.py module."""
|
"""Unittests for the git_command.py module."""
|
||||||
|
|
||||||
import re
|
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
@ -21,10 +21,11 @@ import tempfile
|
|||||||
import unittest
|
import unittest
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
|
from test_manifest_xml import sort_attributes
|
||||||
|
|
||||||
import git_superproject
|
import git_superproject
|
||||||
import git_trace2_event_log
|
import git_trace2_event_log
|
||||||
import manifest_xml
|
import manifest_xml
|
||||||
from test_manifest_xml import sort_attributes
|
|
||||||
|
|
||||||
|
|
||||||
class SuperprojectTestCase(unittest.TestCase):
|
class SuperprojectTestCase(unittest.TestCase):
|
||||||
|
@ -14,9 +14,10 @@
|
|||||||
|
|
||||||
"""Unittests for the hooks.py module."""
|
"""Unittests for the hooks.py module."""
|
||||||
|
|
||||||
import hooks
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
import hooks
|
||||||
|
|
||||||
|
|
||||||
class RepoHookShebang(unittest.TestCase):
|
class RepoHookShebang(unittest.TestCase):
|
||||||
"""Check shebang parsing in RepoHook."""
|
"""Check shebang parsing in RepoHook."""
|
||||||
|
@ -22,9 +22,9 @@ import tempfile
|
|||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import error
|
import error
|
||||||
import manifest_xml
|
|
||||||
import git_command
|
import git_command
|
||||||
import git_config
|
import git_config
|
||||||
|
import manifest_xml
|
||||||
import platform_utils
|
import platform_utils
|
||||||
import project
|
import project
|
||||||
|
|
||||||
|
@ -16,16 +16,17 @@
|
|||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import tempfile
|
import tempfile
|
||||||
import unittest
|
|
||||||
import time
|
import time
|
||||||
|
import unittest
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import command
|
import command
|
||||||
from subcmds import sync
|
from error import GitError
|
||||||
|
from error import RepoExitError
|
||||||
from project import SyncNetworkHalfResult
|
from project import SyncNetworkHalfResult
|
||||||
from error import GitError, RepoExitError
|
from subcmds import sync
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
|
@ -17,8 +17,9 @@
|
|||||||
import unittest
|
import unittest
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
|
from error import GitError
|
||||||
|
from error import UploadError
|
||||||
from subcmds import upload
|
from subcmds import upload
|
||||||
from error import UploadError, GitError
|
|
||||||
|
|
||||||
|
|
||||||
class UnexpectedError(Exception):
|
class UnexpectedError(Exception):
|
||||||
|
Loading…
Reference in New Issue
Block a user