From 3710e24d6b60213454af10b0dc0ff0c49717169f Mon Sep 17 00:00:00 2001 From: Yobmod Date: Fri, 9 Jul 2021 10:33:12 +0100 Subject: Rmv circular import, create Has_id_attribute Protocol instead --- git/objects/util.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'git/objects/util.py') 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_ -- cgit v1.2.1