3232 from git .repo .base import Repo
3333 from git .config import GitConfigParser , SectionConstraint
3434
35- from .types import PathLike , TBD , Literal , SupportsIndex
35+ from .types import PathLike , Literal , SupportsIndex , HSH_TD , Files_TD
3636
3737# ---------------------------------------------------------------------
3838
@@ -746,7 +746,9 @@ class Stats(object):
746746 files = number of changed files as int"""
747747 __slots__ = ("total" , "files" )
748748
749- def __init__ (self , total : Dict [str , Dict [str , int ]], files : Dict [str , Dict [str , int ]]):
749+ from git .types import Total_TD , Files_TD
750+
751+ def __init__ (self , total : Total_TD , files : Dict [str , Files_TD ]):
750752 self .total = total
751753 self .files = files
752754
@@ -756,13 +758,12 @@ def _list_from_string(cls, repo: 'Repo', text: str) -> 'Stats':
756758
757759 :return: git.Stat"""
758760
759- # hsh: Dict[str, Dict[str, Union[int, Dict[str, int]]]]
760- hsh : Dict [str , Dict [str , TBD ]] = {'total' : {'insertions' : 0 ,
761- 'deletions' : 0 ,
762- 'lines' : 0 ,
763- 'files' : 0 },
764- 'files' : {}
765- } # need typeddict?
761+ hsh : HSH_TD = {'total' : {'insertions' : 0 ,
762+ 'deletions' : 0 ,
763+ 'lines' : 0 ,
764+ 'files' : 0 },
765+ 'files' : {}
766+ }
766767 for line in text .splitlines ():
767768 (raw_insertions , raw_deletions , filename ) = line .split ("\t " )
768769 insertions = raw_insertions != '-' and int (raw_insertions ) or 0
@@ -771,9 +772,9 @@ def _list_from_string(cls, repo: 'Repo', text: str) -> 'Stats':
771772 hsh ['total' ]['deletions' ] += deletions
772773 hsh ['total' ]['lines' ] += insertions + deletions
773774 hsh ['total' ]['files' ] += 1
774- files_dict = {'insertions' : insertions ,
775- 'deletions' : deletions ,
776- 'lines' : insertions + deletions }
775+ files_dict : Files_TD = {'insertions' : insertions ,
776+ 'deletions' : deletions ,
777+ 'lines' : insertions + deletions }
777778 hsh ['files' ][filename .strip ()] = files_dict
778779 return Stats (hsh ['total' ], hsh ['files' ])
779780
0 commit comments