diff options
author | Yobmod <yobmod@gmail.com> | 2021-07-09 10:23:14 +0100 |
---|---|---|
committer | Yobmod <yobmod@gmail.com> | 2021-07-09 10:23:14 +0100 |
commit | 030b1fded8b8e1bcf3855beaf9035b4e3e755f5c (patch) | |
tree | 98cf783811e0de4c12c139ad0b5f12d447584ee6 /git/objects/tree.py | |
parent | f4cb7dbc707ea83f312aa669f3bea4dc10d3a24c (diff) | |
download | gitpython-030b1fded8b8e1bcf3855beaf9035b4e3e755f5c.tar.gz |
Add list_traverse() to Tree and TraversableIterableObj.
Diffstat (limited to 'git/objects/tree.py')
-rw-r--r-- | git/objects/tree.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/git/objects/tree.py b/git/objects/tree.py index d3681e23..804554d8 100644 --- a/git/objects/tree.py +++ b/git/objects/tree.py @@ -4,7 +4,7 @@ # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php -from git.util import join_path +from git.util import IterableList, join_path import git.diff as diff from git.util import to_bin_sha @@ -21,7 +21,7 @@ from .fun import ( # typing ------------------------------------------------- -from typing import (Callable, Dict, Iterable, Iterator, List, +from typing import (Any, Callable, Dict, Iterable, Iterator, List, Tuple, Type, Union, cast, TYPE_CHECKING) from git.types import PathLike, TypeGuard @@ -323,6 +323,9 @@ class Tree(IndexObject, diff.Diffable, util.Traversable, util.Serializable): super(Tree, self).traverse(predicate, prune, depth, # type: ignore branch_first, visit_once, ignore_self)) + def list_traverse(self, *args: Any, **kwargs: Any) -> IterableList[Union['Tree', 'Submodule', 'Blob']]: + return super(Tree, self).list_traverse(* args, **kwargs) + # List protocol def __getslice__(self, i: int, j: int) -> List[IndexObjUnion]: |