From 35231dba2f12ef4d19eabc409e72f773a19a3c43 Mon Sep 17 00:00:00 2001 From: Yobmod Date: Sat, 31 Jul 2021 18:04:28 +0100 Subject: Add type to objects.base.new() --- git/objects/base.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'git/objects/base.py') diff --git a/git/objects/base.py b/git/objects/base.py index 64f105ca..a3b0f230 100644 --- a/git/objects/base.py +++ b/git/objects/base.py @@ -25,6 +25,7 @@ if TYPE_CHECKING: from .tree import Tree from .blob import Blob from .submodule.base import Submodule + from git.refs.reference import Reference IndexObjUnion = Union['Tree', 'Blob', 'Submodule'] @@ -59,7 +60,7 @@ class Object(LazyMixin): assert len(binsha) == 20, "Require 20 byte binary sha, got %r, len = %i" % (binsha, len(binsha)) @classmethod - def new(cls, repo: 'Repo', id): # @ReservedAssignment + def new(cls, repo: 'Repo', id: Union[str, 'Reference']) -> Commit_ish: """ :return: New Object instance of a type appropriate to the object type behind id. The id of the newly created object will be a binsha even though -- cgit v1.2.1