diff options
author | Yobmod <yobmod@gmail.com> | 2021-07-19 19:10:45 +0100 |
---|---|---|
committer | Yobmod <yobmod@gmail.com> | 2021-07-19 19:10:45 +0100 |
commit | 9e5e969479ec6018e1ba06b95bcdefca5b0082a4 (patch) | |
tree | 574e03c6c4acd1067e3b285974651ec9e9529a49 /git/repo/fun.py | |
parent | 9a587e14d509cc77bf47b9591d1def3e5a1df570 (diff) | |
download | gitpython-9e5e969479ec6018e1ba06b95bcdefca5b0082a4.tar.gz |
Change remaining type comments to py3.6+ types
Diffstat (limited to 'git/repo/fun.py')
-rw-r--r-- | git/repo/fun.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/git/repo/fun.py b/git/repo/fun.py index e96b62e0..a20e2ecb 100644 --- a/git/repo/fun.py +++ b/git/repo/fun.py @@ -1,5 +1,4 @@ """Package with general repository related functions""" -from git.refs.tag import Tag import os import stat from string import digits @@ -19,11 +18,13 @@ from git.cmd import Git # Typing ---------------------------------------------------------------------- from typing import Union, Optional, cast, TYPE_CHECKING -from git.types import PathLike + if TYPE_CHECKING: + from git.types import PathLike from .base import Repo from git.db import GitCmdObjectDB from git.objects import Commit, TagObject, Blob, Tree + from git.refs.tag import Tag # ---------------------------------------------------------------------------- @@ -122,7 +123,7 @@ def name_to_object(repo: 'Repo', name: str, return_ref: bool = False :param return_ref: if name specifies a reference, we will return the reference instead of the object. Otherwise it will raise BadObject or BadName """ - hexsha = None # type: Union[None, str, bytes] + hexsha: Union[None, str, bytes] = None # is it a hexsha ? Try the most common ones, which is 7 to 40 if repo.re_hexsha_shortened.match(name): @@ -162,7 +163,7 @@ def name_to_object(repo: 'Repo', name: str, return_ref: bool = False return Object.new_from_sha(repo, hex_to_bin(hexsha)) -def deref_tag(tag: Tag) -> 'TagObject': +def deref_tag(tag: 'Tag') -> 'TagObject': """Recursively dereference a tag and return the resulting object""" while True: try: |