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

Commite66297a

Browse files
committed
Keep the type of a Commit'sparents from being too narrow
The type should be Sequence[Commit], rather than List[Commit] assome type checkers seem already to have been inferring and as someothers were caused to infer by the indirect fix that precedes this.
1 parentfe42ca7 commite66297a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

‎git/objects/commit.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ class Commit(base.Object, TraversableIterableObj, Diffable, Serializable):
7979
# INVARIANTS
8080
default_encoding="UTF-8"
8181

82-
# object configuration
8382
type:Literal["commit"]="commit"
83+
8484
__slots__= (
8585
"tree",
8686
"author",
@@ -94,8 +94,11 @@ class Commit(base.Object, TraversableIterableObj, Diffable, Serializable):
9494
"encoding",
9595
"gpgsig",
9696
)
97+
9798
_id_attribute_="hexsha"
9899

100+
parents:Sequence["Commit"]
101+
99102
def__init__(
100103
self,
101104
repo:"Repo",
@@ -753,7 +756,7 @@ def _deserialize(self, stream: BytesIO) -> "Commit":
753756
readline=stream.readline
754757
self.tree=Tree(self.repo,hex_to_bin(readline().split()[1]),Tree.tree_id<<12,"")
755758

756-
self.parents= []# type: List[Commit]
759+
self.parents= []
757760
next_line=None
758761
whileTrue:
759762
parent_line=readline()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp