diff options
author | Yobmod <yobmod@gmail.com> | 2021-07-31 18:04:28 +0100 |
---|---|---|
committer | Yobmod <yobmod@gmail.com> | 2021-07-31 18:04:28 +0100 |
commit | 35231dba2f12ef4d19eabc409e72f773a19a3c43 (patch) | |
tree | 6ef30f918faad787ec8f93ea8a3a62c0049cf8f7 | |
parent | e364c5e327f916366e5936aa2c9f3f4065aec034 (diff) | |
download | gitpython-35231dba2f12ef4d19eabc409e72f773a19a3c43.tar.gz |
Add type to objects.base.new()
-rw-r--r-- | git/objects/base.py | 3 | ||||
-rw-r--r-- | pyproject.toml | 2 |
2 files changed, 3 insertions, 2 deletions
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 diff --git a/pyproject.toml b/pyproject.toml index 4751ffcb..ccf5c165 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,7 +19,7 @@ filterwarnings = 'ignore::DeprecationWarning' # filterwarnings ignore::WarningType # ignores those warnings [tool.mypy] -disallow_untyped_defs = true +#disallow_untyped_defs = true no_implicit_optional = true warn_redundant_casts = true # warn_unused_ignores = True |