2
2
This type stub file was generated by pyright.
3
3
"""
4
4
5
- from typing import Any
5
+ import logging
6
+ import re
7
+ from typing import Any , Callable
6
8
7
9
__version__ : str = ...
8
10
__author__ : str = ...
9
11
__date__ : str = ...
10
12
11
13
from typing import Protocol
12
14
13
- class ReadableFile (Protocol ):
15
+ string_types : type [str ] = str
16
+ text_type : type [str ] = str
17
+ path_types : tuple [type [str ]] = (str ,)
18
+
19
+ log_everything : bool = ...
20
+ logger : logging .Logger = ...
21
+ fsencoding : str = ...
22
+
23
+ UNSAFE : re .Pattern [Any ] = ...
24
+
25
+ def shell_quote (s : str ) -> str : ...
26
+ def no_quote (s : str ) -> str : ...
27
+
28
+ class _ReadableFile (Protocol ):
14
29
def read (self , size : int ) -> bytes : ...
15
-
30
+
16
31
class StatusHandler :
17
32
"""
18
33
The base class for handling status messages from `gpg`.
19
34
"""
20
35
21
- on_data_failure = ...
36
+ on_data_failure : Exception | None = ...
22
37
def __init__ (self , gpg : GPG ) -> None :
23
38
"""
24
39
Initialize an instance.
@@ -54,24 +69,24 @@ class Verify(StatusHandler):
54
69
TRUST_LEVELS : dict [str , int ] = ...
55
70
GPG_SYSTEM_ERROR_CODES : dict [int , str ] = ...
56
71
GPG_ERROR_CODES : dict [int , str ] = ...
57
- returncode = ...
72
+ returncode : int | None = ...
58
73
def __init__ (self , gpg : GPG ) -> None : ...
59
74
def __nonzero__ (self ) -> bool : ...
60
75
61
- __bool__ = ...
76
+ __bool__ : Any = ...
62
77
def handle_status (self , key : str , value : str ) -> None : ...
63
78
64
79
class ImportResult (StatusHandler ):
65
80
"""
66
81
This class handles status messages during key import.
67
82
"""
68
83
69
- counts = ...
70
- returncode = ...
84
+ counts : list [ str ] = ...
85
+ returncode : int | None = ...
71
86
def __init__ (self , gpg : GPG ) -> None : ...
72
87
def __nonzero__ (self ) -> bool : ...
73
88
74
- __bool__ = ...
89
+ __bool__ : Any = ...
75
90
ok_reason : dict [str , str ] = ...
76
91
problem_reason : dict [str , str ] = ...
77
92
def handle_status (self , key : str , value : str ) -> None : ...
@@ -81,25 +96,25 @@ class ImportResult(StatusHandler):
81
96
"""
82
97
...
83
98
84
- ESCAPE_PATTERN = ...
85
- BASIC_ESCAPES = ...
99
+ ESCAPE_PATTERN : re . Pattern [ Any ] = ...
100
+ BASIC_ESCAPES : dict [ str , str ] = ...
86
101
87
102
class SendResult (StatusHandler ):
88
103
"""
89
104
This class handles status messages during key sending.
90
105
"""
91
106
92
- returncode = ...
107
+ returncode : int | None = ...
93
108
def handle_status (self , key : str , value : str ) -> None : ...
94
109
95
110
class SearchKeys (StatusHandler , list [dict [Any , Any ]]):
96
111
"""
97
112
This class handles status messages during key search.
98
113
"""
99
114
100
- UID_INDEX = ...
101
- FIELDS = ...
102
- returncode = ...
115
+ UID_INDEX : int = ...
116
+ FIELDS : list [ str ] = ...
117
+ returncode : int | None = ...
103
118
def __init__ (self , gpg : GPG ) -> None : ...
104
119
def get_fields (self , args : Any ) -> dict [str , Any ]:
105
120
"""
@@ -139,15 +154,15 @@ class ListKeys(SearchKeys):
139
154
rvk = revocation key
140
155
"""
141
156
142
- UID_INDEX = ...
143
- FIELDS = ...
157
+ UID_INDEX : int = ...
158
+ FIELDS : list [ str ] = ...
144
159
def __init__ (self , gpg : GPG ) -> None : ...
145
160
def key (self , args : Any ) -> None :
146
161
"""
147
162
Internal method used to update the instance from a `gpg` status message.
148
163
"""
149
164
...
150
- sec = ...
165
+ sec : Any = ...
151
166
def fpr (self , args : Any ) -> None :
152
167
"""
153
168
Internal method used to update the instance from a `gpg` status message.
@@ -191,8 +206,6 @@ class ScanKeys(ListKeys):
191
206
192
207
class TextHandler : ...
193
208
194
- _INVALID_KEY_REASONS = ...
195
-
196
209
class Crypt (Verify , TextHandler ):
197
210
"""
198
211
This class handles status messages during encryption and decryption.
@@ -201,19 +214,19 @@ class Crypt(Verify, TextHandler):
201
214
def __init__ (self , gpg : GPG ) -> None : ...
202
215
def __nonzero__ (self ) -> bool : ...
203
216
204
- __bool__ = ...
217
+ __bool__ : Any = ...
205
218
def handle_status (self , key : str , value : str ) -> None : ...
206
219
207
220
class GenKey (StatusHandler ):
208
221
"""
209
222
This class handles status messages during key generation.
210
223
"""
211
224
212
- returncode = ...
225
+ returncode : int | None = ...
213
226
def __init__ (self , gpg : GPG ) -> None : ...
214
227
def __nonzero__ (self ) -> bool : ...
215
228
216
- __bool__ = ...
229
+ __bool__ : Any = ...
217
230
def __str__ (self ) -> str : ...
218
231
def handle_status (self , key : str , value : str ) -> None : ...
219
232
@@ -222,11 +235,11 @@ class AddSubkey(StatusHandler):
222
235
This class handles status messages during subkey addition.
223
236
"""
224
237
225
- returncode = ...
238
+ returncode : int | None = ...
226
239
def __init__ (self , gpg : GPG ) -> None : ...
227
240
def __nonzero__ (self ) -> bool : ...
228
241
229
- __bool__ = ...
242
+ __bool__ : Any = ...
230
243
def __str__ (self ) -> str : ...
231
244
def handle_status (self , key : str , value : str ) -> None : ...
232
245
@@ -242,15 +255,15 @@ class DeleteResult(StatusHandler):
242
255
This class handles status messages during key deletion.
243
256
"""
244
257
245
- returncode = ...
258
+ returncode : int | None = ...
246
259
def __init__ (self , gpg : GPG ) -> None : ...
247
260
def __str__ (self ) -> str : ...
248
261
249
- problem_reason = ...
262
+ problem_reason : dict [ str , str ] = ...
250
263
def handle_status (self , key : str , value : str ) -> None : ...
251
264
def __nonzero__ (self ) -> bool : ...
252
265
253
- __bool__ = ...
266
+ __bool__ : Any = ...
254
267
255
268
class TrustResult (DeleteResult ):
256
269
"""
@@ -264,11 +277,11 @@ class Sign(StatusHandler, TextHandler):
264
277
This class handles status messages during signing.
265
278
"""
266
279
267
- returncode = ...
280
+ returncode : int | None = ...
268
281
def __init__ (self , gpg : GPG ) -> None : ...
269
282
def __nonzero__ (self ) -> bool : ...
270
283
271
- __bool__ = ...
284
+ __bool__ : Any = ...
272
285
def handle_status (self , key : str , value : str ) -> None : ...
273
286
274
287
class AutoLocateKey (StatusHandler ):
@@ -294,19 +307,19 @@ class AutoLocateKey(StatusHandler):
294
307
def sub (self , args : Any ) -> None : ...
295
308
def fpr (self , args : Any ) -> None : ...
296
309
297
- VERSION_RE = ...
298
- HEX_DIGITS_RE = ...
299
- PUBLIC_KEY_RE = ...
310
+ VERSION_RE : re . Pattern [ Any ] = ...
311
+ HEX_DIGITS_RE : re . Pattern [ Any ] = ...
312
+ PUBLIC_KEY_RE : re . Pattern [ Any ] = ...
300
313
301
314
class GPG :
302
315
"""
303
316
This class provides a high-level programmatic interface for `gpg`.
304
317
"""
305
318
306
- error_map = ...
307
- decode_errors = ...
308
- buffer_size = ...
309
- result_map = ...
319
+ error_map : None = ...
320
+ decode_errors : str = ...
321
+ buffer_size : int = ...
322
+ result_map : dict [ str , Any ] = ...
310
323
def __init__ (
311
324
self ,
312
325
gpgbinary : str = ...,
@@ -412,7 +425,7 @@ class GPG:
412
425
413
426
def sign_file (
414
427
self ,
415
- fileobj_or_path : str | ReadableFile ,
428
+ fileobj_or_path : str | _ReadableFile ,
416
429
keyid : str | None = ...,
417
430
passphrase : str | None = ...,
418
431
clearsign : bool = ...,
@@ -464,7 +477,7 @@ class GPG:
464
477
465
478
def verify_file (
466
479
self ,
467
- fileobj_or_path : str | ReadableFile ,
480
+ fileobj_or_path : str | _ReadableFile ,
468
481
data_filename : str | None = ...,
469
482
close_file : bool = ...,
470
483
extra_args : list [str ] | None = ...,
@@ -743,7 +756,7 @@ class GPG:
743
756
744
757
def encrypt_file (
745
758
self ,
746
- fileobj_or_path : str | ReadableFile ,
759
+ fileobj_or_path : str | _ReadableFile ,
747
760
recipients : str | list [str ],
748
761
sign : str | None = ...,
749
762
always_trust : bool = ...,
@@ -828,7 +841,7 @@ class GPG:
828
841
829
842
def decrypt_file (
830
843
self ,
831
- fileobj_or_path : str | ReadableFile ,
844
+ fileobj_or_path : str | _ReadableFile ,
832
845
always_trust : bool = ...,
833
846
passphrase : str | None = ...,
834
847
output : str | None = ...,
@@ -864,7 +877,7 @@ class GPG:
864
877
...
865
878
866
879
def get_recipients_file (
867
- self , fileobj_or_path : str | ReadableFile , extra_args : list [str ] | None = ...
880
+ self , fileobj_or_path : str | _ReadableFile , extra_args : list [str ] | None = ...
868
881
) -> list [str ]:
869
882
"""
870
883
Get the list of recipients for an encrypted message in a file or file-like object.
0 commit comments