diff options
Diffstat (limited to 'git/objects/base.py')
-rw-r--r-- | git/objects/base.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/git/objects/base.py b/git/objects/base.py index 884f9651..4e2ed493 100644 --- a/git/objects/base.py +++ b/git/objects/base.py @@ -17,15 +17,16 @@ from .util import get_object_type_by_name from typing import Any, TYPE_CHECKING, Optional, Union -from git.types import PathLike +from git.types import PathLike, Commit_ish if TYPE_CHECKING: from git.repo import Repo from gitdb.base import OStream from .tree import Tree from .blob import Blob - from .tag import TagObject - from .commit import Commit + from .submodule.base import Submodule + +IndexObjUnion = Union['Tree', 'Blob', 'Submodule'] # -------------------------------------------------------------------------- @@ -71,7 +72,7 @@ class Object(LazyMixin): return repo.rev_parse(str(id)) @classmethod - def new_from_sha(cls, repo: 'Repo', sha1: bytes) -> Union['Commit', 'TagObject', 'Tree', 'Blob']: + def new_from_sha(cls, repo: 'Repo', sha1: bytes) -> Commit_ish: """ :return: new object instance of a type appropriate to represent the given binary sha1 |