Remove explicit inheritance from object · gitpython-developers/GitPython@f78587f · GitHub
Skip to content

Commit f78587f

Browse files
committed
Remove explicit inheritance from object
Within the git module. In Python 2, it was necessary to inherit from object to have a new-style class. In Python 3, all classes are new-style classes, and inheritance from object is implied. Usually, removing explicit inheritance from object is only a small clarity benefit while modernizing Python codebases. However, in GitPython, the benefit is greater, because it is possible to confuse object (the root of the Python class hierarchy) with Object (the root of the GitPython subhierarchy of classes representing things in the git object model).
1 parent e8343e2 commit f78587f

9 files changed

Lines changed: 16 additions & 16 deletions

File tree

git/cmd.py

Lines changed: 2 additions & 2 deletions

git/diff.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def decode_path(path: bytes, has_ab_prefix: bool = True) -> Optional[bytes]:
7979
return path
8080

8181

82-
class Diffable(object):
82+
class Diffable:
8383
"""Common interface for all objects that can be diffed against another object of
8484
compatible type.
8585
@@ -90,7 +90,7 @@ class Diffable(object):
9090

9191
__slots__ = ()
9292

93-
class Index(object):
93+
class Index:
9494
"""Stand-in indicating you want to diff against the index."""
9595

9696
def _process_diff_args(
@@ -252,7 +252,7 @@ def iter_change_type(self, change_type: Lit_change_type) -> Iterator[T_Diff]:
252252
# END for each diff
253253

254254

255-
class Diff(object):
255+
class Diff:
256256
"""A Diff contains diff information between two Trees.
257257
258258
It contains two sides a and b of the diff, members are prefixed with

git/index/typ.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
# } END invariants
3333

3434

35-
class BlobFilter(object):
35+
class BlobFilter:
3636
"""
3737
Predicate to be used by iter_blobs allowing to filter only return blobs which
3838
match the given list of directories or files.

git/index/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
# } END aliases
3434

3535

36-
class TemporaryFileSwap(object):
36+
class TemporaryFileSwap:
3737
"""Utility class moving a file to a temporary location within the same directory
3838
and moving it back on to where on object deletion."""
3939

git/objects/tree.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def merge_sort(a: List[TreeCacheTup], cmp: Callable[[TreeCacheTup, TreeCacheTup]
102102
k = k + 1
103103

104104

105-
class TreeModifier(object):
105+
class TreeModifier:
106106
"""A utility class providing methods to alter the underlying cache in a list-like fashion.
107107
108108
Once all adjustments are complete, the _cache, which really is a reference to

git/objects/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ def parse_actor_and_date(line: str) -> Tuple[Actor, int, int]:
337337
# { Classes
338338

339339

340-
class ProcessStreamAdapter(object):
340+
class ProcessStreamAdapter:
341341
"""Class wiring all calls to the contained Process instance.
342342
343343
Use this type to hide the underlying process to provide access only to a specified

git/refs/symbolic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def _git_dir(repo: "Repo", path: Union[PathLike, None]) -> PathLike:
5555
return repo.common_dir
5656

5757

58-
class SymbolicReference(object):
58+
class SymbolicReference:
5959
"""Special case of a reference that is symbolic.
6060
6161
This does not point to a specific commit, but to another

git/repo/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class BlameEntry(NamedTuple):
108108
orig_linenos: range
109109

110110

111-
class Repo(object):
111+
class Repo:
112112
"""Represents a git repository and allows you to query references,
113113
gather commit information, generate diffs, create and clone repositories query
114114
the log.

git/util.py

Lines changed: 5 additions & 5 deletions

0 commit comments

Comments
 (0)