diff options
author | Yobmod <yobmod@gmail.com> | 2021-07-09 10:33:12 +0100 |
---|---|---|
committer | Yobmod <yobmod@gmail.com> | 2021-07-09 10:33:12 +0100 |
commit | 3710e24d6b60213454af10b0dc0ff0c49717169f (patch) | |
tree | ef1d954d0c3e5b4ddabe7f04c76c2e454dfbb9ec /git/objects/util.py | |
parent | 030b1fded8b8e1bcf3855beaf9035b4e3e755f5c (diff) | |
download | gitpython-3710e24d6b60213454af10b0dc0ff0c49717169f.tar.gz |
Rmv circular import, create Has_id_attribute Protocol instead
Diffstat (limited to 'git/objects/util.py')
-rw-r--r-- | git/objects/util.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/git/objects/util.py b/git/objects/util.py index 4dce0aee..1c266563 100644 --- a/git/objects/util.py +++ b/git/objects/util.py @@ -19,13 +19,11 @@ import time import calendar from datetime import datetime, timedelta, tzinfo -from git.objects.base import IndexObject # just for an isinstance check - # typing ------------------------------------------------------------ from typing import (Any, Callable, Deque, Iterator, NamedTuple, overload, Sequence, TYPE_CHECKING, Tuple, Type, TypeVar, Union, cast) -from git.types import Literal +from git.types import Has_id_attribute, Literal if TYPE_CHECKING: from io import BytesIO, StringIO @@ -319,7 +317,7 @@ class Traversable(object): """ # Commit and Submodule have id.__attribute__ as IterableObj # Tree has id.__attribute__ inherited from IndexObject - if isinstance(self, (TraversableIterableObj, IndexObject)): + if isinstance(self, (TraversableIterableObj, Has_id_attribute)): id = self._id_attribute_ else: id = "" # shouldn't reach here, unless Traversable subclass created with no _id_attribute_ |