6
6
from io import BytesIO , StringIO , TextIOWrapper
7
7
from typing import (
8
8
TYPE_CHECKING ,
9
- Any ,
10
9
Callable ,
11
10
Dict ,
12
11
Generator ,
@@ -55,7 +54,7 @@ def open(
55
54
self ,
56
55
mode : str = "r" ,
57
56
encoding : str = None ,
58
- key : tuple = None ,
57
+ key : Optional [ Tuple [ str , ...]] = None ,
59
58
raw : bool = True ,
60
59
rev : Optional [str ] = None ,
61
60
** kwargs ,
@@ -67,14 +66,16 @@ def open(
67
66
if self .backend is not None :
68
67
try :
69
68
if rev :
69
+ # pylint: disable-next=protected-access
70
70
commit , _ref = self .backend ._resolve_refish (rev )
71
71
else :
72
72
pass
73
73
if raw :
74
74
blob_kwargs = {}
75
75
else :
76
+ assert key is not None
76
77
path = "/" .join (key )
77
- blob_kwargs : Dict [ str , Any ] = {
78
+ blob_kwargs = {
78
79
"as_path" : path ,
79
80
"commit_id" : commit .oid ,
80
81
}
@@ -123,21 +124,21 @@ class Pygit2Config(Config):
123
124
def __init__ (self , config : "_Pygit2Config" ):
124
125
self ._config = config
125
126
126
- def _key (self , section : Tuple [str ], name : str ) -> str :
127
+ def _key (self , section : Tuple [str , ... ], name : str ) -> str :
127
128
return "." .join (section + (name ,))
128
129
129
- def get (self , section : Tuple [str ], name : str ) -> str :
130
+ def get (self , section : Tuple [str , ... ], name : str ) -> str :
130
131
return self ._config [self ._key (section , name )]
131
132
132
- def get_bool (self , section : Tuple [str ], name : str ) -> bool :
133
+ def get_bool (self , section : Tuple [str , ... ], name : str ) -> bool :
133
134
from pygit2 import GitError
134
135
135
136
try :
136
137
return self ._config .get_bool (self ._key (section , name ))
137
138
except GitError as exc :
138
139
raise ValueError ("invalid boolean config entry" ) from exc
139
140
140
- def get_multivar (self , section : Tuple [str ], name : str ) -> Iterator [str ]:
141
+ def get_multivar (self , section : Tuple [str , ... ], name : str ) -> Iterator [str ]:
141
142
from pygit2 import GitError
142
143
143
144
try :
0 commit comments