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>
diff --git a/color.py b/color.py
index 0f63748..e3e2a5f 100644
--- a/color.py
+++ b/color.py
@@ -103,7 +103,7 @@
DEFAULT = "never"
-class Coloring(object):
+class Coloring:
def __init__(self, config, section_type):
self._section = "color.%s" % section_type
self._config = config
diff --git a/command.py b/command.py
index 9d5d56e..a6189ed 100644
--- a/command.py
+++ b/command.py
@@ -46,7 +46,7 @@
"""Exception thrown with invalid command usage."""
-class Command(object):
+class Command:
"""Base class for any command line action in repo."""
# Singleton for all commands to track overall repo command execution and
@@ -498,11 +498,11 @@
return True
-class MirrorSafeCommand(object):
+class MirrorSafeCommand:
"""Command permits itself to run within a mirror, and does not require a
working directory.
"""
-class GitcClientCommand(object):
+class GitcClientCommand:
"""Command that requires the local client to be a GITC client."""
diff --git a/editor.py b/editor.py
index 78311f1..10ff158 100644
--- a/editor.py
+++ b/editor.py
@@ -22,7 +22,7 @@
import platform_utils
-class Editor(object):
+class Editor:
"""Manages the user's preferred text editor."""
_editor = None
diff --git a/event_log.py b/event_log.py
index 60c1a43..ef01394 100644
--- a/event_log.py
+++ b/event_log.py
@@ -21,7 +21,7 @@
TASK_SYNC_LOCAL = "sync-local"
-class EventLog(object):
+class EventLog:
"""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.
diff --git a/git_command.py b/git_command.py
index 2e4974f..0e25639 100644
--- a/git_command.py
+++ b/git_command.py
@@ -58,7 +58,7 @@
logger = RepoLogger(__file__)
-class _GitCall(object):
+class _GitCall:
@functools.lru_cache(maxsize=None)
def version_tuple(self):
ret = Wrapper().ParseGitVersion()
@@ -148,7 +148,7 @@
return path
-class UserAgent(object):
+class UserAgent:
"""Mange User-Agent settings when talking to external services
We follow the style as documented here:
@@ -272,7 +272,7 @@
return env
-class GitCommand(object):
+class GitCommand:
"""Wrapper around a single git invocation."""
def __init__(
diff --git a/git_config.py b/git_config.py
index c19f766..4f053ed 100644
--- a/git_config.py
+++ b/git_config.py
@@ -70,7 +70,7 @@
return ".".join(parts)
-class GitConfig(object):
+class GitConfig:
_ForUser = None
_ForSystem = None
@@ -430,7 +430,7 @@
return os.path.join(repo_config_dir, ".repoconfig/config")
-class RefSpec(object):
+class RefSpec:
"""A Git refspec line, split into its components:
forced: True if the line starts with '+'
@@ -541,7 +541,7 @@
yield cookiefile, None
-class Remote(object):
+class Remote:
"""Configuration options related to a remote."""
def __init__(self, config, name):
@@ -723,7 +723,7 @@
return self._config.GetString(key, all_keys=all_keys)
-class Branch(object):
+class Branch:
"""Configuration options related to a single branch."""
def __init__(self, config, name):
diff --git a/git_refs.py b/git_refs.py
index 1f5eaab..8e8d603 100644
--- a/git_refs.py
+++ b/git_refs.py
@@ -28,7 +28,7 @@
R_M = "refs/remotes/m/"
-class GitRefs(object):
+class GitRefs:
def __init__(self, gitdir):
self._gitdir = gitdir
self._phyref = None
diff --git a/git_superproject.py b/git_superproject.py
index 5d8c0d4..651b6db 100644
--- a/git_superproject.py
+++ b/git_superproject.py
@@ -66,7 +66,7 @@
fatal: bool
-class Superproject(object):
+class Superproject:
"""Get commit ids from superproject.
Initializes a local copy of a superproject for the manifest. This allows
diff --git a/git_trace2_event_log_base.py b/git_trace2_event_log_base.py
index d986b24..7b51b75 100644
--- a/git_trace2_event_log_base.py
+++ b/git_trace2_event_log_base.py
@@ -42,7 +42,7 @@
p_init_count = 0
-class BaseEventLog(object):
+class BaseEventLog:
"""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.
diff --git a/hooks.py b/hooks.py
index 337c262..6ded08b 100644
--- a/hooks.py
+++ b/hooks.py
@@ -22,7 +22,7 @@
from git_refs import HEAD
-class RepoHook(object):
+class RepoHook:
"""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
diff --git a/main.py b/main.py
index 07c360f..a128285 100755
--- a/main.py
+++ b/main.py
@@ -186,7 +186,7 @@
)
-class _Repo(object):
+class _Repo:
def __init__(self, repodir):
self.repodir = repodir
self.commands = all_commands
diff --git a/manifest_xml.py b/manifest_xml.py
index 458dfb7..d2217bb 100644
--- a/manifest_xml.py
+++ b/manifest_xml.py
@@ -119,7 +119,7 @@
)
-class _Default(object):
+class _Default:
"""Project defaults within the manifest."""
revisionExpr = None
@@ -142,7 +142,7 @@
return self.__dict__ != other.__dict__
-class _XmlRemote(object):
+class _XmlRemote:
def __init__(
self,
name,
@@ -354,7 +354,7 @@
self.groups = groups or []
-class XmlManifest(object):
+class XmlManifest:
"""manages the repo configuration file"""
def __init__(
diff --git a/progress.py b/progress.py
index 80bc946..54eb8f9 100644
--- a/progress.py
+++ b/progress.py
@@ -82,7 +82,7 @@
return f"{total} job{'s' if total > 1 else ''}"
-class Progress(object):
+class Progress:
def __init__(
self,
title,
diff --git a/project.py b/project.py
index 80c20ad..c91ae21 100644
--- a/project.py
+++ b/project.py
@@ -152,7 +152,7 @@
return _project_hook_list
-class DownloadedChange(object):
+class DownloadedChange:
_commit_cache = None
def __init__(self, project, base, change_id, ps_id, commit):
@@ -178,7 +178,7 @@
return self._commit_cache
-class ReviewableBranch(object):
+class ReviewableBranch:
_commit_cache = None
_base_exists = None
@@ -319,7 +319,7 @@
self.fail = self.printer("fail", fg="red")
-class Annotation(object):
+class Annotation:
def __init__(self, name, value, keep):
self.name = name
self.value = value
@@ -386,7 +386,7 @@
return path
-class _CopyFile(object):
+class _CopyFile:
"""Container for <copyfile> manifest element."""
def __init__(self, git_worktree, src, topdir, dest):
@@ -435,7 +435,7 @@
logger.error("error: Cannot copy file %s to %s", src, dest)
-class _LinkFile(object):
+class _LinkFile:
"""Container for <linkfile> manifest element."""
def __init__(self, git_worktree, src, topdir, dest):
@@ -518,7 +518,7 @@
self.__linkIt(relSrc, absDest)
-class RemoteSpec(object):
+class RemoteSpec:
def __init__(
self,
name,
@@ -538,7 +538,7 @@
self.fetchUrl = fetchUrl
-class Project(object):
+class Project:
# These objects can be shared between several working trees.
@property
def shareable_dirs(self):
@@ -3475,7 +3475,7 @@
)
return logs
- class _GitGetByExec(object):
+ class _GitGetByExec:
def __init__(self, project, bare, gitdir):
self._project = project
self._bare = bare
@@ -3530,7 +3530,7 @@
except StopIteration:
break
- class _Info(object):
+ class _Info:
def __init__(self, path, omode, nmode, oid, nid, state):
self.path = path
self.src_path = None
@@ -3716,7 +3716,7 @@
return "contains uncommitted changes"
-class _InfoMessage(object):
+class _InfoMessage:
def __init__(self, project, text):
self.project = project
self.text = text
@@ -3728,7 +3728,7 @@
syncbuf.out.nl()
-class _Failure(object):
+class _Failure:
def __init__(self, project, why):
self.project = project
self.why = why
@@ -3740,7 +3740,7 @@
syncbuf.out.nl()
-class _Later(object):
+class _Later:
def __init__(self, project, action):
self.project = project
self.action = action
@@ -3766,7 +3766,7 @@
self.fail = self.printer("fail", fg="red")
-class SyncBuffer(object):
+class SyncBuffer:
def __init__(self, config, detach_head=False):
self._messages = []
self._failures = []
diff --git a/repo b/repo
index 7f24ff1..95f9df8 100755
--- a/repo
+++ b/repo
@@ -40,7 +40,7 @@
# Keep basic logic in sync with repo_trace.py.
-class Trace(object):
+class Trace:
"""Trace helper logic."""
REPO_TRACE = "REPO_TRACE"
@@ -1214,7 +1214,7 @@
return (repo, os.path.join(curdir, repodir))
-class _Options(object):
+class _Options:
help = False
version = False
@@ -1258,7 +1258,7 @@
return cmd, opt, arg
-class Requirements(object):
+class Requirements:
"""Helper for checking repo's system requirements."""
REQUIREMENTS_NAME = "requirements.json"
diff --git a/subcmds/branches.py b/subcmds/branches.py
index 33523c3..d9a190b 100644
--- a/subcmds/branches.py
+++ b/subcmds/branches.py
@@ -28,7 +28,7 @@
self.notinproject = self.printer("notinproject", fg="red")
-class BranchInfo(object):
+class BranchInfo:
def __init__(self, name):
self.name = name
self.current = 0
diff --git a/subcmds/sync.py b/subcmds/sync.py
index e1f7d01..dbdaa2c 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -1908,7 +1908,7 @@
print("repo version %s is current" % rp.work_git.describe(HEAD))
-class _FetchTimes(object):
+class _FetchTimes:
_ALPHA = 0.5
def __init__(self, manifest):
@@ -1951,7 +1951,7 @@
platform_utils.remove(self._path, missing_ok=True)
-class LocalSyncState(object):
+class LocalSyncState:
_LAST_FETCH = "last_fetch"
_LAST_CHECKOUT = "last_checkout"
diff --git a/tests/test_git_command.py b/tests/test_git_command.py
index 881cccb..7c108cc 100644
--- a/tests/test_git_command.py
+++ b/tests/test_git_command.py
@@ -72,7 +72,7 @@
"""Tests the GitCommand class .Wait()"""
def setUp(self):
- class MockPopen(object):
+ class MockPopen:
rc = 0
def __init__(self):
diff --git a/tests/test_project.py b/tests/test_project.py
index 79728d7..42f0f6e 100644
--- a/tests/test_project.py
+++ b/tests/test_project.py
@@ -48,7 +48,7 @@
yield tempdir
-class FakeProject(object):
+class FakeProject:
"""A fake for Project for basic functionality."""
def __init__(self, worktree):