Skip to content

Commit ad4517f

Browse files
committed
Add type to symbolicreference._get_packed_refs_path()
1 parent 1f92267 commit ad4517f

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

‎git/refs/symbolic.py

+11-11
Original file line numberDiff line numberDiff line change
@@ -136,23 +136,23 @@ def _iter_packed_refs(cls, repo: 'Repo') -> Iterator[Tuple[str, str]]:
136136
# alright.
137137

138138
@classmethod
139-
def dereference_recursive(cls, repo: 'Repo', ref_path: PathLike) -> str:
139+
def dereference_recursive(cls, repo, ref_path):
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"""
144144
while True:
145-
hexsha, _ref_path = cls._get_ref_info(repo, ref_path)
145+
hexsha, ref_path = cls._get_ref_info(repo, ref_path)
146146
if hexsha is not None:
147147
return hexsha
148148
# END recursive dereferencing
149149

150150
@classmethod
151-
def _get_ref_info_helper(cls, repo: 'Repo', ref_path: PathLike) -> Union[Tuple[str, None], Tuple[None, str]]:
151+
def _get_ref_info_helper(cls, repo, ref_path):
152152
"""Return: (str(sha), str(target_ref_path)) if available, the sha the file at
153153
rela_path points to, or None. target_ref_path is the reference we
154154
point to, or None"""
155-
tokens: Union[Tuple[str, str], List[str], None] = None
155+
tokens = None
156156
repodir = _git_dir(repo, ref_path)
157157
try:
158158
with open(os.path.join(repodir, ref_path), 'rt', encoding='UTF-8') as fp:
@@ -169,7 +169,7 @@ def _get_ref_info_helper(cls, repo: 'Repo', ref_path: PathLike) -> Union[Tuple[s
169169
if path != ref_path:
170170
continue
171171
# sha will be used
172-
tokens = (sha, path)
172+
tokens = sha, path
173173
break
174174
# END for each packed ref
175175
# END handle packed refs
@@ -186,8 +186,8 @@ def _get_ref_info_helper(cls, repo: 'Repo', ref_path: PathLike) -> Union[Tuple[s
186186

187187
raise ValueError("Failed to parse reference information from %r" % ref_path)
188188

189-
@ classmethod
190-
def _get_ref_info(cls, repo: 'Repo', ref_path: PathLike) -> Union[Tuple[str, None], Tuple[None, str]]:
189+
@classmethod
190+
def _get_ref_info(cls, repo, ref_path):
191191
"""Return: (str(sha), str(target_ref_path)) if available, the sha the file at
192192
rela_path points to, or None. target_ref_path is the reference we
193193
point to, or None"""
@@ -370,7 +370,7 @@ def is_valid(self):
370370
else:
371371
return True
372372

373-
@ property
373+
@property
374374
def is_detached(self):
375375
"""
376376
:return:
@@ -420,7 +420,7 @@ def log_entry(self, index):
420420
In that case, it will be faster than the ``log()`` method"""
421421
return RefLog.entry_at(RefLog.path(self), index)
422422

423-
@ classmethod
423+
@classmethod
424424
def to_full_path(cls, path) -> PathLike:
425425
"""
426426
:return: string with a full repository-relative path which can be used to initialize
@@ -434,7 +434,7 @@ def to_full_path(cls, path) -> PathLike:
434434
full_ref_path = '%s/%s' % (cls._common_path_default, path)
435435
return full_ref_path
436436

437-
@ classmethod
437+
@classmethod
438438
def delete(cls, repo, path):
439439
"""Delete the reference at the given path
440440
@@ -492,7 +492,7 @@ def delete(cls, repo, path):
492492
os.remove(reflog_path)
493493
# END remove reflog
494494

495-
@ classmethod
495+
@classmethod
496496
def _create(cls, repo, path, resolve, reference, force, logmsg=None):
497497
"""internal method used to create a new symbolic reference.
498498
If resolve is False, the reference will be taken as is, creating

0 commit comments

Comments
 (0)