diff options
author | Yobmod <yobmod@gmail.com> | 2021-07-19 16:57:04 +0100 |
---|---|---|
committer | Yobmod <yobmod@gmail.com> | 2021-07-19 16:57:04 +0100 |
commit | 6609ef7c3b5bb840dba8d0a5362e67746761a437 (patch) | |
tree | f79b38acd48927faf21a298bd690eba3b9fbacc2 /git/objects/tree.py | |
parent | 29e12e9ceee59a87984c9049ac84e030a4dd0ed2 (diff) | |
download | gitpython-6609ef7c3b5bb840dba8d0a5362e67746761a437.tar.gz |
Make types in refs compatible with objects
Diffstat (limited to 'git/objects/tree.py')
-rw-r--r-- | git/objects/tree.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/git/objects/tree.py b/git/objects/tree.py index a9656c1d..0e3f44b9 100644 --- a/git/objects/tree.py +++ b/git/objects/tree.py @@ -24,7 +24,7 @@ from .fun import ( from typing import (Any, Callable, Dict, Iterable, Iterator, List, Tuple, Type, Union, cast, TYPE_CHECKING) -from git.types import PathLike, TypeGuard +from git.types import PathLike, TypeGuard, Literal if TYPE_CHECKING: from git.repo import Repo @@ -195,7 +195,7 @@ class Tree(IndexObject, git_diff.Diffable, util.Traversable, util.Serializable): blob = tree[0] """ - type = "tree" + type: Literal['tree'] = "tree" __slots__ = "_cache" # actual integer ids for comparison @@ -285,7 +285,7 @@ class Tree(IndexObject, git_diff.Diffable, util.Traversable, util.Serializable): return [i for i in self if i.type == "tree"] @ property - def blobs(self) -> List['Blob']: + def blobs(self) -> List[Blob]: """:return: list(Blob, ...) list of blobs directly below this tree""" return [i for i in self if i.type == "blob"] @@ -322,8 +322,8 @@ class Tree(IndexObject, git_diff.Diffable, util.Traversable, util.Serializable): # assert is_tree_traversed(ret_tup), f"Type is {[type(x) for x in list(ret_tup[0])]}" # return ret_tup[0]""" return cast(Union[Iterator[IndexObjUnion], Iterator[TraversedTreeTup]], - super(Tree, self).traverse(predicate, prune, depth, # type: ignore - branch_first, visit_once, ignore_self)) + super(Tree, self)._traverse(predicate, prune, depth, # type: ignore + branch_first, visit_once, ignore_self)) def list_traverse(self, *args: Any, **kwargs: Any) -> IterableList[IndexObjUnion]: """ @@ -331,7 +331,7 @@ class Tree(IndexObject, git_diff.Diffable, util.Traversable, util.Serializable): traverse() Tree -> IterableList[Union['Submodule', 'Tree', 'Blob']] """ - return super(Tree, self).list_traverse(* args, **kwargs) + return super(Tree, self)._list_traverse(* args, **kwargs) # List protocol |