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

Commit8eedc9d

Browse files
committed
Add type to symbolicreference.get_()
1 parent24c1242 commit8eedc9d

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

‎git/refs/symbolic.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
__all__= ["SymbolicReference"]
3737

3838

39-
def_git_dir(repo:'Repo',path:Union[PathLike,None])->PathLike:
39+
def_git_dir(repo:'Repo',path:PathLike)->PathLike:
4040
""" Find the git dir that's appropriate for the path"""
4141
name=f"{path}"
4242
ifnamein ['HEAD','ORIG_HEAD','FETCH_HEAD','index','logs']:
@@ -136,27 +136,26 @@ def _iter_packed_refs(cls, repo: 'Repo') -> Iterator[Tuple[str, str]]:
136136
# alright.
137137

138138
@classmethod
139-
defdereference_recursive(cls,repo:'Repo',ref_path:Union[None,PathLike])->str:
139+
defdereference_recursive(cls,repo:'Repo',ref_path:PathLike)->str:
140140
"""
141141
:return: hexsha stored in the reference at the given ref_path, recursively dereferencing all
142142
intermediate references as required
143143
:param repo: the repository containing the reference at ref_path"""
144-
whileTrue:# loop that overwrites ref_path each loop
144+
whileTrue:
145145
hexsha,ref_path=cls._get_ref_info(repo,ref_path)
146146
ifhexshaisnotNone:
147147
returnhexsha
148148
# END recursive dereferencing
149149

150150
@classmethod
151-
def_get_ref_info_helper(cls,repo:'Repo',ref_path:Union[PathLike,None]
152-
)->Union[Tuple[str,None],Tuple[None,str]]:
151+
def_get_ref_info_helper(cls,repo:'Repo',ref_path:PathLike):
153152
"""Return: (str(sha), str(target_ref_path)) if available, the sha the file at
154153
rela_path points to, or None. target_ref_path is the reference we
155154
point to, or None"""
156155
tokens:Union[None,List[str],Tuple[str,str]]=None
157156
repodir=_git_dir(repo,ref_path)
158157
try:
159-
withopen(os.path.join(repodir,cast(str,ref_path)),'rt',encoding='UTF-8')asfp:
158+
withopen(os.path.join(repodir,ref_path),'rt',encoding='UTF-8')asfp:
160159
value=fp.read().rstrip()
161160
# Don't only split on spaces, but on whitespace, which allows to parse lines like
162161
# 60b64ef992065e2600bfef6187a97f92398a9144 branch 'master' of git-server:/path/to/repo
@@ -188,7 +187,7 @@ def _get_ref_info_helper(cls, repo: 'Repo', ref_path: Union[PathLike, None]
188187
raiseValueError("Failed to parse reference information from %r"%ref_path)
189188

190189
@classmethod
191-
def_get_ref_info(cls,repo:'Repo',ref_path:Union[PathLike,None])->Union[Tuple[str,None],Tuple[None,str]]:
190+
def_get_ref_info(cls,repo,ref_path):
192191
"""Return: (str(sha), str(target_ref_path)) if available, the sha the file at
193192
rela_path points to, or None. target_ref_path is the reference we
194193
point to, or None"""

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp