1919import threading
2020from collections import OrderedDict
2121from textwrap import dedent
22+ from typing import Any , Dict , List , Optional
2223
2324from git .compat import (
2425 defenc ,
3940 stream_copy ,
4041)
4142
43+ from .types import PathLike
44+
4245execute_kwargs = {'istream' , 'with_extended_output' ,
4346 'with_exceptions' , 'as_process' , 'stdout_as_string' ,
4447 'output_stream' , 'with_stdout' , 'kill_after_timeout' ,
@@ -516,7 +519,7 @@ def __del__(self):
516519 self ._stream .read (bytes_left + 1 )
517520 # END handle incomplete read
518521
519- def __init__ (self , working_dir = None ):
522+ def __init__ (self , working_dir : Optional [ PathLike ] = None ) -> None :
520523 """Initialize this instance with:
521524
522525 :param working_dir:
@@ -525,12 +528,12 @@ def __init__(self, working_dir=None):
525528 It is meant to be the working tree directory if available, or the
526529 .git directory in case of bare repositories."""
527530 super (Git , self ).__init__ ()
528- self ._working_dir = expand_path (working_dir )
531+ self ._working_dir = expand_path (working_dir ) if working_dir is not None else None
529532 self ._git_options = ()
530- self ._persistent_git_options = []
533+ self ._persistent_git_options = [] # type: List[str]
531534
532535 # Extra environment variables to pass to git commands
533- self ._environment = {}
536+ self ._environment = {} # type: Dict[str, Any]
534537
535538 # cached command slots
536539 self .cat_file_header = None
@@ -544,7 +547,7 @@ def __getattr__(self, name):
544547 return LazyMixin .__getattr__ (self , name )
545548 return lambda * args , ** kwargs : self ._call_process (name , * args , ** kwargs )
546549
547- def set_persistent_git_options (self , ** kwargs ):
550+ def set_persistent_git_options (self , ** kwargs ) -> None :
548551 """Specify command line options to the git executable
549552 for subsequent subcommand calls
550553
0 commit comments