Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf78587f

Browse files
committed
Remove explicit inheritance from object
Within the git module.In Python 2, it was necessary to inherit from object to have anew-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 smallclarity benefit while modernizing Python codebases. However, inGitPython, the benefit is greater, because it is possible toconfuse object (the root of the Python class hierarchy) withObject (the root of the GitPython subhierarchy of classesrepresenting things in the git object model).
1 parente8343e2 commitf78587f

File tree

9 files changed

+16
-16
lines changed

9 files changed

+16
-16
lines changed

‎git/cmd.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ def check_unsafe_options(cls, options: List[str], unsafe_options: List[str]) ->
490490
f"{unsafe_option} is not allowed, use `allow_unsafe_options=True` to allow it."
491491
)
492492

493-
classAutoInterrupt(object):
493+
classAutoInterrupt:
494494
"""Process wrapper that terminates the wrapped process on finalization.
495495
496496
This kills/interrupts the stored process instance once this instance goes out of
@@ -602,7 +602,7 @@ def read_all_from_possibly_closed_stream(stream: Union[IO[bytes], None]) -> byte
602602

603603
# END auto interrupt
604604

605-
classCatFileContentStream(object):
605+
classCatFileContentStream:
606606
"""Object representing a sized read-only stream returning the contents of
607607
an object.
608608

‎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
returnpath
8080

8181

82-
classDiffable(object):
82+
classDiffable:
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-
classIndex(object):
93+
classIndex:
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-
classDiff(object):
255+
classDiff:
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-
classBlobFilter(object):
35+
classBlobFilter:
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-
classTemporaryFileSwap(object):
36+
classTemporaryFileSwap:
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-
classTreeModifier(object):
105+
classTreeModifier:
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-
classProcessStreamAdapter(object):
340+
classProcessStreamAdapter:
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
returnrepo.common_dir
5656

5757

58-
classSymbolicReference(object):
58+
classSymbolicReference:
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-
classRepo(object):
111+
classRepo:
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
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ def remove_password_if_present(cmdline: Sequence[str]) -> List[str]:
516516
# { Classes
517517

518518

519-
classRemoteProgress(object):
519+
classRemoteProgress:
520520
"""
521521
Handler providing an interface to parse progress information emitted by git-push
522522
and git-fetch and to dispatch callbacks allowing subclasses to react to the progress.
@@ -723,7 +723,7 @@ def update(self, *args: Any, **kwargs: Any) -> None:
723723
self._callable(*args,**kwargs)
724724

725725

726-
classActor(object):
726+
classActor:
727727
"""Actors hold information about a person acting on the repository. They
728728
can be committers and authors or anything with a name and an email as
729729
mentioned in the git log entries."""
@@ -847,7 +847,7 @@ def author(cls, config_reader: Union[None, "GitConfigParser", "SectionConstraint
847847
returncls._main_actor(cls.env_author_name,cls.env_author_email,config_reader)
848848

849849

850-
classStats(object):
850+
classStats:
851851
"""
852852
Represents stat information as presented by git at the end of a merge. It is
853853
created from the output of a diff operation.
@@ -908,7 +908,7 @@ def _list_from_string(cls, repo: "Repo", text: str) -> "Stats":
908908
returnStats(hsh["total"],hsh["files"])
909909

910910

911-
classIndexFileSHA1Writer(object):
911+
classIndexFileSHA1Writer:
912912
"""Wrapper around a file-like object that remembers the SHA1 of
913913
the data written to it. It will write a sha when the stream is closed
914914
or if the asked for explicitly using write_sha.
@@ -942,7 +942,7 @@ def tell(self) -> int:
942942
returnself.f.tell()
943943

944944

945-
classLockFile(object):
945+
classLockFile:
946946
"""Provides methods to obtain, check for, and release a file based lock which
947947
should be used to handle concurrent access to the same file.
948948

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp