summaryrefslogtreecommitdiff
path: root/git/objects/base.py
diff options
context:
space:
mode:
authorSebastian Thiel <sebastian.thiel@icloud.com>2021-07-02 07:54:45 +0800
committerGitHub <noreply@github.com>2021-07-02 07:54:45 +0800
commit18c777bf815357663226fd6834c8b1bcfe9b7b62 (patch)
tree6e60335c9c631c38d0e88cf0ac11623985b8bd36 /git/objects/base.py
parent8ad4f5923e7df65a4ad30a527ab10abc88f74f64 (diff)
parentd4a9eab9ddc64a18b33ac04a4224f347ccdc78de (diff)
downloadgitpython-18c777bf815357663226fd6834c8b1bcfe9b7b62.tar.gz
Merge pull request #1282 from Yobmod/main
Start adding types to Submodule, add py.typed to manifest
Diffstat (limited to 'git/objects/base.py')
-rw-r--r--git/objects/base.py9
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