99from ..util import hex_to_bin
1010from ..compat import defenc
1111
12+ from typing import List , TYPE_CHECKING , Union
13+
14+ if TYPE_CHECKING :
15+ from git .repo import Repo
16+ from git .util import Actor
17+
1218__all__ = ("TagObject" , )
1319
1420
@@ -18,8 +24,10 @@ class TagObject(base.Object):
1824 type = "tag"
1925 __slots__ = ("object" , "tag" , "tagger" , "tagged_date" , "tagger_tz_offset" , "message" )
2026
21- def __init__ (self , repo , binsha , object = None , tag = None , # @ReservedAssignment
22- tagger = None , tagged_date = None , tagger_tz_offset = None , message = None ):
27+ def __init__ (self , repo : 'Repo' , binsha : bytes , object : Union [None , base .Object ] = None ,
28+ tag : Union [None , str ] = None , tagger : Union [None , Actor ] = None , tagged_date : Union [int , None ] = None ,
29+ tagger_tz_offset : Union [int , None ] = None , message : Union [str , None ] = None
30+ ) -> None : # @ReservedAssignment
2331 """Initialize a tag object with additional data
2432
2533 :param repo: repository this object is located in
@@ -46,11 +54,11 @@ def __init__(self, repo, binsha, object=None, tag=None, # @ReservedAssignment
4654 if message is not None :
4755 self .message = message
4856
49- def _set_cache_ (self , attr ) :
57+ def _set_cache_ (self , attr : str ) -> None :
5058 """Cache all our attributes at once"""
5159 if attr in TagObject .__slots__ :
5260 ostream = self .repo .odb .stream (self .binsha )
53- lines = ostream .read ().decode (defenc , 'replace' ).splitlines ()
61+ lines = ostream .read ().decode (defenc , 'replace' ).splitlines () # type: List[str]
5462
5563 _obj , hexsha = lines [0 ].split (" " )
5664 _type_token , type_name = lines [1 ].split (" " )
0 commit comments