Skip to content

Commit 3c2454d

Browse files
committed
Add final types to symbolic.py
1 parent 48f64bb commit 3c2454d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Diff for: git/refs/symbolic.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,13 @@ def dereference_recursive(cls, repo: 'Repo', ref_path: PathLike) -> str:
146146
intermediate references as required
147147
:param repo: the repository containing the reference at ref_path"""
148148
while True:
149-
hexsha, ref_path = cls._get_ref_info(repo, ref_path)
149+
hexsha, ref_path = cls._get_ref_info(repo, ref_path) # type: ignore
150150
if hexsha is not None:
151151
return hexsha
152152
# END recursive dereferencing
153153

154154
@classmethod
155-
def _get_ref_info_helper(cls, repo: 'Repo', ref_path: PathLike):
155+
def _get_ref_info_helper(cls, repo: 'Repo', ref_path: PathLike) -> Union[Tuple[str, None], Tuple[None, str]]:
156156
"""Return: (str(sha), str(target_ref_path)) if available, the sha the file at
157157
rela_path points to, or None. target_ref_path is the reference we
158158
point to, or None"""
@@ -191,13 +191,13 @@ def _get_ref_info_helper(cls, repo: 'Repo', ref_path: PathLike):
191191
raise ValueError("Failed to parse reference information from %r" % ref_path)
192192

193193
@classmethod
194-
def _get_ref_info(cls, repo, ref_path):
194+
def _get_ref_info(cls, repo: 'Repo', ref_path: PathLike) -> Union[Tuple[str, None], Tuple[None, str]]:
195195
"""Return: (str(sha), str(target_ref_path)) if available, the sha the file at
196196
rela_path points to, or None. target_ref_path is the reference we
197197
point to, or None"""
198198
return cls._get_ref_info_helper(repo, ref_path)
199199

200-
def _get_object(self):
200+
def _get_object(self) -> Commit_ish:
201201
"""
202202
:return:
203203
The object our ref currently refers to. Refs can be cached, they will
@@ -206,7 +206,7 @@ def _get_object(self):
206206
# Our path will be resolved to the hexsha which will be used accordingly
207207
return Object.new_from_sha(self.repo, hex_to_bin(self.dereference_recursive(self.repo, self.path)))
208208

209-
def _get_commit(self):
209+
def _get_commit(self) -> 'Commit':
210210
"""
211211
:return:
212212
Commit object we point to, works for detached and non-detached

0 commit comments

Comments
 (0)