3131
3232# typing-------------------------------------------------------
3333
34- from typing import TYPE_CHECKING , Tuple
34+ from typing import Any , Callable , Mapping , TYPE_CHECKING , Tuple
3535
36- from git .types import Literal
36+ from git .types import Literal , Lit_config_levels , TBD
3737
3838if TYPE_CHECKING :
3939 pass
5959class MetaParserBuilder (abc .ABCMeta ):
6060
6161 """Utlity class wrapping base-class methods into decorators that assure read-only properties"""
62- def __new__ (cls , name , bases , clsdict ) :
62+ def __new__ (cls , name : str , bases : TBD , clsdict : Mapping [ str , Any ]) -> TBD :
6363 """
6464 Equip all base-class methods with a needs_values decorator, and all non-const methods
6565 with a set_dirty_and_flush_changes decorator in addition to that."""
@@ -85,23 +85,23 @@ def __new__(cls, name, bases, clsdict):
8585 return new_type
8686
8787
88- def needs_values (func ) :
88+ def needs_values (func : Callable ) -> Callable :
8989 """Returns method assuring we read values (on demand) before we try to access them"""
9090
9191 @wraps (func )
92- def assure_data_present (self , * args , ** kwargs ) :
92+ def assure_data_present (self , * args : Any , ** kwargs : Any ) -> Any :
9393 self .read ()
9494 return func (self , * args , ** kwargs )
9595 # END wrapper method
9696 return assure_data_present
9797
9898
99- def set_dirty_and_flush_changes (non_const_func ) :
99+ def set_dirty_and_flush_changes (non_const_func : Callable ) -> Callable :
100100 """Return method that checks whether given non constant function may be called.
101101 If so, the instance will be set dirty.
102102 Additionally, we flush the changes right to disk"""
103103
104- def flush_changes (self , * args , ** kwargs ) :
104+ def flush_changes (self , * args : Any , ** kwargs : Any ) -> Any :
105105 rval = non_const_func (self , * args , ** kwargs )
106106 self ._dirty = True
107107 self .write ()
@@ -206,7 +206,7 @@ def items_all(self):
206206 return [(k , self .getall (k )) for k in self ]
207207
208208
209- def get_config_path (config_level : Literal [ 'system' , 'global' , 'user' , 'repository' ] ) -> str :
209+ def get_config_path (config_level : Lit_config_levels ) -> str :
210210
211211 # we do not support an absolute path of the gitconfig on windows ,
212212 # use the global config instead
0 commit comments