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

Commit3be955e

Browse files
committed
Add type to symbolicreference.references()
1 parent13b38ce commit3be955e

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

‎git/refs/head.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ def __init__(self, repo: 'Repo', path: PathLike = _HEAD_NAME):
4040
raiseValueError("HEAD instance must point to %r, got %r"% (self._HEAD_NAME,path))
4141
super(HEAD,self).__init__(repo,path)
4242
self.commit:'Commit'
43-
self.ref:'Head'
4443

4544
deforig_head(self)->SymbolicReference:
4645
"""

‎git/refs/symbolic.py‎

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
ifTYPE_CHECKING:
2828
fromgit.repoimportRepo
29-
fromgit.refsimportHead,TagReference,Reference
29+
fromgit.refsimportHead,TagReference,RemoteReference,Reference
3030
from .logimportRefLogEntry
3131
fromgit.configimportGitConfigParser
3232
fromgit.objects.commitimportActor
@@ -65,7 +65,6 @@ class SymbolicReference(object):
6565
def__init__(self,repo:'Repo',path:PathLike,check_path:bool=False):
6666
self.repo=repo
6767
self.path=path
68-
self.ref=self.reference
6968

7069
def__str__(self)->str:
7170
returnstr(self.path)
@@ -363,15 +362,8 @@ def set_reference(self, ref: Union[Commit_ish, 'SymbolicReference', str],
363362
returnself
364363

365364
# aliased reference
366-
# reference = property(_get_reference, set_reference, doc="Returns the Reference we point to") # type: ignore
367-
368-
@property
369-
defreference(self)->'Reference':
370-
returnself._get_reference()
371-
372-
@reference.setter
373-
defreference(self,*args,**kwargs):
374-
returnself.set_reference(*args,**kwargs)
365+
reference=property(_get_reference,set_reference,doc="Returns the Reference we point to")# type: ignore
366+
ref:Union['Head','TagReference','RemoteReference','Reference']=reference# type: ignore
375367

376368
defis_valid(self)->bool:
377369
"""

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp