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

Commitaecb80c

Browse files
authored
Update symbolic.py
1 parentea869bb commitaecb80c

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

‎git/refs/symbolic.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525

2626
ifTYPE_CHECKING:
2727
fromgit.repoimportRepo
28-
fromgit.refsimportReference,Head,TagReference,RemoteReference
29-
fromgit.configimportGitConfigParser
30-
fromgit.objects.commitimportActor
28+
fromgit.refsimportReference,Head,TagReference,RemoteReference# NOQA
29+
fromgit.configimportGitConfigParser# NOQA
30+
fromgit.objects.commitimportActor# NOQA
3131

3232
T_References=TypeVar('T_References',bound='SymbolicReference')
3333

@@ -37,9 +37,9 @@
3737
__all__= ["SymbolicReference"]
3838

3939

40-
def_git_dir(repo,path):
40+
def_git_dir(repo:'Repo',path:PathLike)->PathLike:
4141
""" Find the git dir that's appropriate for the path"""
42-
name="%s"% (path,)
42+
name=f"{path}"
4343
ifnamein ['HEAD','ORIG_HEAD','FETCH_HEAD','index','logs']:
4444
returnrepo.git_dir
4545
returnrepo.common_dir
@@ -59,34 +59,35 @@ class SymbolicReference(object):
5959
_remote_common_path_default="refs/remotes"
6060
_id_attribute_="name"
6161

62-
def__init__(self,repo:'Repo',path:PathLike,check_path:bool=False):
62+
def__init__(self,repo:'Repo',path:PathLike,check_path:bool=False)->None:
6363
self.repo=repo
6464
self.path=str(path)
65+
self.ref=self._get_reference()
6566

6667
def__str__(self)->str:
6768
returnself.path
6869

69-
def__repr__(self):
70+
def__repr__(self)->str:
7071
return'<git.%s "%s">'% (self.__class__.__name__,self.path)
7172

72-
def__eq__(self,other):
73+
def__eq__(self,other)->bool:
7374
ifhasattr(other,'path'):
7475
returnself.path==other.path
7576
returnFalse
7677

77-
def__ne__(self,other):
78+
def__ne__(self,other)->bool:
7879
returnnot (self==other)
7980

8081
def__hash__(self):
8182
returnhash(self.path)
8283

8384
@property
84-
defname(self):
85+
defname(self)->str:
8586
"""
8687
:return:
8788
In case of symbolic references, the shortest assumable name
8889
is the path itself."""
89-
returnself.path
90+
returnstr(self.path)
9091

9192
@property
9293
defabspath(self):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp