delete Python 2 (object) compat

Bug: 302871152
Change-Id: I39636d73a6e1d69efa8ade74f75c5381651e6dc8
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/390054
Commit-Queue: Mike Frysinger <vapier@google.com>
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Tested-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
Mike Frysinger 2023-10-19 05:13:32 -04:00 committed by LUCI
parent 024df06ec1
commit d4aee6570b
19 changed files with 43 additions and 43 deletions

View File

@ -103,7 +103,7 @@ def SetDefaultColoring(state):
DEFAULT = "never" DEFAULT = "never"
class Coloring(object): class Coloring:
def __init__(self, config, section_type): def __init__(self, config, section_type):
self._section = "color.%s" % section_type self._section = "color.%s" % section_type
self._config = config self._config = config

View File

@ -46,7 +46,7 @@ class UsageError(RepoExitError):
"""Exception thrown with invalid command usage.""" """Exception thrown with invalid command usage."""
class Command(object): class Command:
"""Base class for any command line action in repo.""" """Base class for any command line action in repo."""
# Singleton for all commands to track overall repo command execution and # Singleton for all commands to track overall repo command execution and
@ -498,11 +498,11 @@ class PagedCommand(Command):
return True return True
class MirrorSafeCommand(object): class MirrorSafeCommand:
"""Command permits itself to run within a mirror, and does not require a """Command permits itself to run within a mirror, and does not require a
working directory. working directory.
""" """
class GitcClientCommand(object): class GitcClientCommand:
"""Command that requires the local client to be a GITC client.""" """Command that requires the local client to be a GITC client."""

View File

@ -22,7 +22,7 @@ from error import EditorError
import platform_utils import platform_utils
class Editor(object): class Editor:
"""Manages the user's preferred text editor.""" """Manages the user's preferred text editor."""
_editor = None _editor = None

View File

@ -21,7 +21,7 @@ TASK_SYNC_NETWORK = "sync-network"
TASK_SYNC_LOCAL = "sync-local" TASK_SYNC_LOCAL = "sync-local"
class EventLog(object): class EventLog:
"""Event log that records events that occurred during a repo invocation. """Event log that records events that occurred during a repo invocation.
Events are written to the log as a consecutive JSON entries, one per line. Events are written to the log as a consecutive JSON entries, one per line.

View File

@ -58,7 +58,7 @@ INVALID_GIT_EXIT_CODE = 126
logger = RepoLogger(__file__) logger = RepoLogger(__file__)
class _GitCall(object): class _GitCall:
@functools.lru_cache(maxsize=None) @functools.lru_cache(maxsize=None)
def version_tuple(self): def version_tuple(self):
ret = Wrapper().ParseGitVersion() ret = Wrapper().ParseGitVersion()
@ -148,7 +148,7 @@ def GetEventTargetPath():
return path return path
class UserAgent(object): class UserAgent:
"""Mange User-Agent settings when talking to external services """Mange User-Agent settings when talking to external services
We follow the style as documented here: We follow the style as documented here:
@ -272,7 +272,7 @@ def _build_env(
return env return env
class GitCommand(object): class GitCommand:
"""Wrapper around a single git invocation.""" """Wrapper around a single git invocation."""
def __init__( def __init__(

View File

@ -70,7 +70,7 @@ def _key(name):
return ".".join(parts) return ".".join(parts)
class GitConfig(object): class GitConfig:
_ForUser = None _ForUser = None
_ForSystem = None _ForSystem = None
@ -430,7 +430,7 @@ class RepoConfig(GitConfig):
return os.path.join(repo_config_dir, ".repoconfig/config") return os.path.join(repo_config_dir, ".repoconfig/config")
class RefSpec(object): class RefSpec:
"""A Git refspec line, split into its components: """A Git refspec line, split into its components:
forced: True if the line starts with '+' forced: True if the line starts with '+'
@ -541,7 +541,7 @@ def GetUrlCookieFile(url, quiet):
yield cookiefile, None yield cookiefile, None
class Remote(object): class Remote:
"""Configuration options related to a remote.""" """Configuration options related to a remote."""
def __init__(self, config, name): def __init__(self, config, name):
@ -723,7 +723,7 @@ class Remote(object):
return self._config.GetString(key, all_keys=all_keys) return self._config.GetString(key, all_keys=all_keys)
class Branch(object): class Branch:
"""Configuration options related to a single branch.""" """Configuration options related to a single branch."""
def __init__(self, config, name): def __init__(self, config, name):

View File

@ -28,7 +28,7 @@ R_WORKTREE_M = R_WORKTREE + "m/"
R_M = "refs/remotes/m/" R_M = "refs/remotes/m/"
class GitRefs(object): class GitRefs:
def __init__(self, gitdir): def __init__(self, gitdir):
self._gitdir = gitdir self._gitdir = gitdir
self._phyref = None self._phyref = None

View File

@ -66,7 +66,7 @@ class UpdateProjectsResult(NamedTuple):
fatal: bool fatal: bool
class Superproject(object): class Superproject:
"""Get commit ids from superproject. """Get commit ids from superproject.
Initializes a local copy of a superproject for the manifest. This allows Initializes a local copy of a superproject for the manifest. This allows

View File

@ -42,7 +42,7 @@ import threading
p_init_count = 0 p_init_count = 0
class BaseEventLog(object): class BaseEventLog:
"""Event log that records events that occurred during a repo invocation. """Event log that records events that occurred during a repo invocation.
Events are written to the log as a consecutive JSON entries, one per line. Events are written to the log as a consecutive JSON entries, one per line.

View File

@ -22,7 +22,7 @@ from error import HookError
from git_refs import HEAD from git_refs import HEAD
class RepoHook(object): class RepoHook:
"""A RepoHook contains information about a script to run as a hook. """A RepoHook contains information about a script to run as a hook.
Hooks are used to run a python script before running an upload (for Hooks are used to run a python script before running an upload (for

View File

@ -186,7 +186,7 @@ global_options.add_option(
) )
class _Repo(object): class _Repo:
def __init__(self, repodir): def __init__(self, repodir):
self.repodir = repodir self.repodir = repodir
self.commands = all_commands self.commands = all_commands

View File

@ -119,7 +119,7 @@ def XmlInt(node, attr, default=None):
) )
class _Default(object): class _Default:
"""Project defaults within the manifest.""" """Project defaults within the manifest."""
revisionExpr = None revisionExpr = None
@ -142,7 +142,7 @@ class _Default(object):
return self.__dict__ != other.__dict__ return self.__dict__ != other.__dict__
class _XmlRemote(object): class _XmlRemote:
def __init__( def __init__(
self, self,
name, name,
@ -354,7 +354,7 @@ class SubmanifestSpec:
self.groups = groups or [] self.groups = groups or []
class XmlManifest(object): class XmlManifest:
"""manages the repo configuration file""" """manages the repo configuration file"""
def __init__( def __init__(

View File

@ -82,7 +82,7 @@ def jobs_str(total):
return f"{total} job{'s' if total > 1 else ''}" return f"{total} job{'s' if total > 1 else ''}"
class Progress(object): class Progress:
def __init__( def __init__(
self, self,
title, title,

View File

@ -152,7 +152,7 @@ def _ProjectHooks():
return _project_hook_list return _project_hook_list
class DownloadedChange(object): class DownloadedChange:
_commit_cache = None _commit_cache = None
def __init__(self, project, base, change_id, ps_id, commit): def __init__(self, project, base, change_id, ps_id, commit):
@ -178,7 +178,7 @@ class DownloadedChange(object):
return self._commit_cache return self._commit_cache
class ReviewableBranch(object): class ReviewableBranch:
_commit_cache = None _commit_cache = None
_base_exists = None _base_exists = None
@ -319,7 +319,7 @@ class DiffColoring(Coloring):
self.fail = self.printer("fail", fg="red") self.fail = self.printer("fail", fg="red")
class Annotation(object): class Annotation:
def __init__(self, name, value, keep): def __init__(self, name, value, keep):
self.name = name self.name = name
self.value = value self.value = value
@ -386,7 +386,7 @@ def _SafeExpandPath(base, subpath, skipfinal=False):
return path return path
class _CopyFile(object): class _CopyFile:
"""Container for <copyfile> manifest element.""" """Container for <copyfile> manifest element."""
def __init__(self, git_worktree, src, topdir, dest): def __init__(self, git_worktree, src, topdir, dest):
@ -435,7 +435,7 @@ class _CopyFile(object):
logger.error("error: Cannot copy file %s to %s", src, dest) logger.error("error: Cannot copy file %s to %s", src, dest)
class _LinkFile(object): class _LinkFile:
"""Container for <linkfile> manifest element.""" """Container for <linkfile> manifest element."""
def __init__(self, git_worktree, src, topdir, dest): def __init__(self, git_worktree, src, topdir, dest):
@ -518,7 +518,7 @@ class _LinkFile(object):
self.__linkIt(relSrc, absDest) self.__linkIt(relSrc, absDest)
class RemoteSpec(object): class RemoteSpec:
def __init__( def __init__(
self, self,
name, name,
@ -538,7 +538,7 @@ class RemoteSpec(object):
self.fetchUrl = fetchUrl self.fetchUrl = fetchUrl
class Project(object): class Project:
# These objects can be shared between several working trees. # These objects can be shared between several working trees.
@property @property
def shareable_dirs(self): def shareable_dirs(self):
@ -3475,7 +3475,7 @@ class Project(object):
) )
return logs return logs
class _GitGetByExec(object): class _GitGetByExec:
def __init__(self, project, bare, gitdir): def __init__(self, project, bare, gitdir):
self._project = project self._project = project
self._bare = bare self._bare = bare
@ -3530,7 +3530,7 @@ class Project(object):
except StopIteration: except StopIteration:
break break
class _Info(object): class _Info:
def __init__(self, path, omode, nmode, oid, nid, state): def __init__(self, path, omode, nmode, oid, nid, state):
self.path = path self.path = path
self.src_path = None self.src_path = None
@ -3716,7 +3716,7 @@ class _DirtyError(LocalSyncFail):
return "contains uncommitted changes" return "contains uncommitted changes"
class _InfoMessage(object): class _InfoMessage:
def __init__(self, project, text): def __init__(self, project, text):
self.project = project self.project = project
self.text = text self.text = text
@ -3728,7 +3728,7 @@ class _InfoMessage(object):
syncbuf.out.nl() syncbuf.out.nl()
class _Failure(object): class _Failure:
def __init__(self, project, why): def __init__(self, project, why):
self.project = project self.project = project
self.why = why self.why = why
@ -3740,7 +3740,7 @@ class _Failure(object):
syncbuf.out.nl() syncbuf.out.nl()
class _Later(object): class _Later:
def __init__(self, project, action): def __init__(self, project, action):
self.project = project self.project = project
self.action = action self.action = action
@ -3766,7 +3766,7 @@ class _SyncColoring(Coloring):
self.fail = self.printer("fail", fg="red") self.fail = self.printer("fail", fg="red")
class SyncBuffer(object): class SyncBuffer:
def __init__(self, config, detach_head=False): def __init__(self, config, detach_head=False):
self._messages = [] self._messages = []
self._failures = [] self._failures = []

6
repo
View File

@ -40,7 +40,7 @@ MIN_PYTHON_VERSION_HARD = (3, 5)
# Keep basic logic in sync with repo_trace.py. # Keep basic logic in sync with repo_trace.py.
class Trace(object): class Trace:
"""Trace helper logic.""" """Trace helper logic."""
REPO_TRACE = "REPO_TRACE" REPO_TRACE = "REPO_TRACE"
@ -1214,7 +1214,7 @@ def _FindRepo():
return (repo, os.path.join(curdir, repodir)) return (repo, os.path.join(curdir, repodir))
class _Options(object): class _Options:
help = False help = False
version = False version = False
@ -1258,7 +1258,7 @@ def _ParseArguments(args):
return cmd, opt, arg return cmd, opt, arg
class Requirements(object): class Requirements:
"""Helper for checking repo's system requirements.""" """Helper for checking repo's system requirements."""
REQUIREMENTS_NAME = "requirements.json" REQUIREMENTS_NAME = "requirements.json"

View File

@ -28,7 +28,7 @@ class BranchColoring(Coloring):
self.notinproject = self.printer("notinproject", fg="red") self.notinproject = self.printer("notinproject", fg="red")
class BranchInfo(object): class BranchInfo:
def __init__(self, name): def __init__(self, name):
self.name = name self.name = name
self.current = 0 self.current = 0

View File

@ -1908,7 +1908,7 @@ def _PostRepoFetch(rp, repo_verify=True, verbose=False):
print("repo version %s is current" % rp.work_git.describe(HEAD)) print("repo version %s is current" % rp.work_git.describe(HEAD))
class _FetchTimes(object): class _FetchTimes:
_ALPHA = 0.5 _ALPHA = 0.5
def __init__(self, manifest): def __init__(self, manifest):
@ -1951,7 +1951,7 @@ class _FetchTimes(object):
platform_utils.remove(self._path, missing_ok=True) platform_utils.remove(self._path, missing_ok=True)
class LocalSyncState(object): class LocalSyncState:
_LAST_FETCH = "last_fetch" _LAST_FETCH = "last_fetch"
_LAST_CHECKOUT = "last_checkout" _LAST_CHECKOUT = "last_checkout"

View File

@ -72,7 +72,7 @@ class GitCommandWaitTest(unittest.TestCase):
"""Tests the GitCommand class .Wait()""" """Tests the GitCommand class .Wait()"""
def setUp(self): def setUp(self):
class MockPopen(object): class MockPopen:
rc = 0 rc = 0
def __init__(self): def __init__(self):

View File

@ -48,7 +48,7 @@ def TempGitTree():
yield tempdir yield tempdir
class FakeProject(object): class FakeProject:
"""A fake for Project for basic functionality.""" """A fake for Project for basic functionality."""
def __init__(self, worktree): def __init__(self, worktree):