1515import os .path
1616import subprocess
1717import sys
18+ from typing import Dict , Optional , Sequence
1819
1920import xdg .BaseDirectory
2021
2526 CONFIG_FILE_NAME )
2627
2728
28- def parse_arguments (argv = None ):
29+ def parse_arguments (argv : Optional [ Sequence [ str ]] = None ) -> argparse . Namespace :
2930 """
3031 Parse the command line arguments.
3132
@@ -66,7 +67,7 @@ def parse_arguments(argv=None):
6667 return args
6768
6869
69- def parse_mapping (mapping_file ) :
70+ def parse_mapping (mapping_file : Optional [ str ]) -> configparser . ConfigParser :
7071 """
7172 Parse the file containing the mappings from hosts to pass entries.
7273
@@ -100,7 +101,7 @@ def parse(mapping_file):
100101 return parse (file_handle )
101102
102103
103- def parse_request ():
104+ def parse_request () -> Dict [ str , str ] :
104105 """
105106 Parse the request of the git credential API from stdin.
106107
@@ -123,7 +124,7 @@ def parse_request():
123124 return request
124125
125126
126- def get_password (request , mapping ):
127+ def get_password (request , mapping ) -> None :
127128 """
128129 Resolve the given credential request in the provided mapping definition.
129130
@@ -175,15 +176,15 @@ def decode_skip(line, skip):
175176 sys .exit (1 )
176177
177178
178- def handle_skip ():
179+ def handle_skip () -> None :
179180 """Terminate the process if skipping is requested via an env variable."""
180181 if 'PASS_GIT_HELPER_SKIP' in os .environ :
181182 LOGGER .info (
182183 'Skipping processing as requested via environment variable' )
183184 sys .exit (1 )
184185
185186
186- def main (argv = None ):
187+ def main (argv : Optional [ Sequence [ str ]] = None ) -> None :
187188 """
188189 Start the pass-git-helper script.
189190
0 commit comments