|
| 1 | +import logging |
| 2 | +import re |
| 3 | +from typing import Any |
| 4 | + |
| 5 | +__version__: str = ... |
| 6 | +__author__: str = ... |
| 7 | +__date__: str = ... |
| 8 | + |
| 9 | +from typing import Protocol |
| 10 | + |
| 11 | +string_types: type[str] = ... |
| 12 | +text_type: type[str] = ... |
| 13 | +path_types: tuple[type[str]] = ... |
| 14 | + |
| 15 | +log_everything: bool = ... |
| 16 | +logger: logging.Logger = ... |
| 17 | +fsencoding: str = ... |
| 18 | + |
| 19 | +UNSAFE: re.Pattern[Any] = ... |
| 20 | + |
| 21 | +def shell_quote(s: str) -> str: ... |
| 22 | +def no_quote(s: str) -> str: ... |
| 23 | + |
| 24 | +class _ReadableFile(Protocol): |
| 25 | + def read(self, size: int) -> bytes: ... |
| 26 | + |
| 27 | +class StatusHandler: |
| 28 | + |
| 29 | + on_data_failure: Exception | None = ... |
| 30 | + def __init__(self, gpg: GPG) -> None: ... |
| 31 | + def handle_status(self, key: str, value: str) -> None: ... |
| 32 | + |
| 33 | +class Verify(StatusHandler): |
| 34 | + |
| 35 | + TRUST_EXPIRED: int = ... |
| 36 | + TRUST_UNDEFINED: int = ... |
| 37 | + TRUST_NEVER: int = ... |
| 38 | + TRUST_MARGINAL: int = ... |
| 39 | + TRUST_FULLY: int = ... |
| 40 | + TRUST_ULTIMATE: int = ... |
| 41 | + TRUST_LEVELS: dict[str, int] = ... |
| 42 | + GPG_SYSTEM_ERROR_CODES: dict[int, str] = ... |
| 43 | + GPG_ERROR_CODES: dict[int, str] = ... |
| 44 | + returncode: int | None = ... |
| 45 | + def __init__(self, gpg: GPG) -> None: ... |
| 46 | + def __nonzero__(self) -> bool: ... |
| 47 | + def handle_status(self, key: str, value: str) -> None: ... |
| 48 | + |
| 49 | +class ImportResult(StatusHandler): |
| 50 | + |
| 51 | + counts: list[str] = ... |
| 52 | + returncode: int | None = ... |
| 53 | + def __init__(self, gpg: GPG) -> None: ... |
| 54 | + def __nonzero__(self) -> bool: ... |
| 55 | + |
| 56 | + ok_reason: dict[str, str] = ... |
| 57 | + problem_reason: dict[str, str] = ... |
| 58 | + def handle_status(self, key: str, value: str) -> None: ... |
| 59 | + def summary(self) -> str: ... |
| 60 | + |
| 61 | +ESCAPE_PATTERN: re.Pattern[Any] = ... |
| 62 | +BASIC_ESCAPES: dict[str, str] = ... |
| 63 | + |
| 64 | +class SendResult(StatusHandler): |
| 65 | + |
| 66 | + returncode: int | None = ... |
| 67 | + def handle_status(self, key: str, value: str) -> None: ... |
| 68 | + |
| 69 | +class SearchKeys(StatusHandler, list[dict[Any, Any]]): |
| 70 | + |
| 71 | + UID_INDEX: int = ... |
| 72 | + FIELDS: list[str] = ... |
| 73 | + returncode: int | None = ... |
| 74 | + def __init__(self, gpg: GPG) -> None: ... |
| 75 | + def get_fields(self, args: Any) -> dict[str, Any]: ... |
| 76 | + def pub(self, args: Any) -> None: ... |
| 77 | + def uid(self, args: Any) -> None: ... |
| 78 | + def handle_status(self, key: str, value: str) -> None: ... |
| 79 | + |
| 80 | +class ListKeys(SearchKeys): |
| 81 | + |
| 82 | + UID_INDEX: int = ... |
| 83 | + FIELDS: list[str] = ... |
| 84 | + def __init__(self, gpg: GPG) -> None: ... |
| 85 | + def key(self, args: Any) -> None: ... |
| 86 | + sec: Any = ... |
| 87 | + def fpr(self, args: Any) -> None: ... |
| 88 | + def grp(self, args: Any) -> None: ... |
| 89 | + def sub(self, args: Any) -> None: ... |
| 90 | + def ssb(self, args: Any) -> None: ... |
| 91 | + def sig(self, args: Any) -> None: ... |
| 92 | + |
| 93 | +class ScanKeys(ListKeys): |
| 94 | + def sub(self, args: Any) -> None: ... |
| 95 | + |
| 96 | +class TextHandler: ... |
| 97 | + |
| 98 | +class Crypt(Verify, TextHandler): |
| 99 | + def __init__(self, gpg: GPG) -> None: ... |
| 100 | + def __nonzero__(self) -> bool: ... |
| 101 | + def handle_status(self, key: str, value: str) -> None: ... |
| 102 | + |
| 103 | +class GenKey(StatusHandler): |
| 104 | + |
| 105 | + returncode: int | None = ... |
| 106 | + def __init__(self, gpg: GPG) -> None: ... |
| 107 | + def __nonzero__(self) -> bool: ... |
| 108 | + def handle_status(self, key: str, value: str) -> None: ... |
| 109 | + |
| 110 | +class AddSubkey(StatusHandler): |
| 111 | + |
| 112 | + returncode: int | None = ... |
| 113 | + def __init__(self, gpg: GPG) -> None: ... |
| 114 | + def __nonzero__(self) -> bool: ... |
| 115 | + def handle_status(self, key: str, value: str) -> None: ... |
| 116 | + |
| 117 | +class ExportResult(GenKey): |
| 118 | + def handle_status(self, key: str, value: str) -> None: ... |
| 119 | + |
| 120 | +class DeleteResult(StatusHandler): |
| 121 | + |
| 122 | + returncode: int | None = ... |
| 123 | + def __init__(self, gpg: GPG) -> None: ... |
| 124 | + |
| 125 | + problem_reason: dict[str, str] = ... |
| 126 | + def handle_status(self, key: str, value: str) -> None: ... |
| 127 | + def __nonzero__(self) -> bool: ... |
| 128 | + |
| 129 | +class TrustResult(DeleteResult): ... |
| 130 | + |
| 131 | +class Sign(StatusHandler, TextHandler): |
| 132 | + |
| 133 | + returncode: int | None = ... |
| 134 | + def __init__(self, gpg: GPG) -> None: ... |
| 135 | + def __nonzero__(self) -> bool: ... |
| 136 | + def handle_status(self, key: str, value: str) -> None: ... |
| 137 | + |
| 138 | +class AutoLocateKey(StatusHandler): |
| 139 | + def __init__(self, gpg: GPG) -> None: ... |
| 140 | + def handle_status(self, key: str, value: str) -> None: ... |
| 141 | + def pub(self, args: Any) -> None: ... |
| 142 | + def uid(self, args: Any) -> None: ... |
| 143 | + def sub(self, args: Any) -> None: ... |
| 144 | + def fpr(self, args: Any) -> None: ... |
| 145 | + |
| 146 | +VERSION_RE: re.Pattern[Any] = ... |
| 147 | +HEX_DIGITS_RE: re.Pattern[Any] = ... |
| 148 | +PUBLIC_KEY_RE: re.Pattern[Any] = ... |
| 149 | + |
| 150 | +class GPG: |
| 151 | + |
| 152 | + error_map: None = ... |
| 153 | + decode_errors: str = ... |
| 154 | + buffer_size: int = ... |
| 155 | + result_map: dict[str, Any] = ... |
| 156 | + def __init__( |
| 157 | + self, |
| 158 | + gpgbinary: str = ..., |
| 159 | + gnupghome: str | None = ..., |
| 160 | + verbose: bool = ..., |
| 161 | + use_agent: bool = ..., |
| 162 | + keyring: str | list[str] | None = ..., |
| 163 | + options: list[str] | None = ..., |
| 164 | + secret_keyring: str | list[str] | None = ..., |
| 165 | + env: dict[str, str] | None = ..., |
| 166 | + ) -> None: ... |
| 167 | + def make_args(self, args: list[str], passphrase: str) -> list[str]: ... |
| 168 | + def is_valid_file(self, fileobj: Any) -> bool: ... |
| 169 | + def sign(self, message: str | bytes, **kwargs: Any) -> Sign: ... |
| 170 | + def set_output_without_confirmation(self, args: list[str], output: str) -> None: ... |
| 171 | + def is_valid_passphrase(self, passphrase: str) -> bool: ... |
| 172 | + def sign_file( |
| 173 | + self, |
| 174 | + fileobj_or_path: str | _ReadableFile, |
| 175 | + keyid: str | None = ..., |
| 176 | + passphrase: str | None = ..., |
| 177 | + clearsign: bool = ..., |
| 178 | + detach: bool = ..., |
| 179 | + binary: bool = ..., |
| 180 | + output: str | None = ..., |
| 181 | + extra_args: list[str] | None = ..., |
| 182 | + ) -> Sign: ... |
| 183 | + def verify(self, data: str | bytes, **kwargs: Any) -> Verify: ... |
| 184 | + def verify_file( |
| 185 | + self, |
| 186 | + fileobj_or_path: str | _ReadableFile, |
| 187 | + data_filename: str | None = ..., |
| 188 | + close_file: bool = ..., |
| 189 | + extra_args: list[str] | None = ..., |
| 190 | + ) -> Verify: ... |
| 191 | + def verify_data(self, sig_filename: str, data: str | bytes, extra_args: list[str] | None = ...) -> Verify: ... |
| 192 | + def import_keys( |
| 193 | + self, key_data: str | bytes, extra_args: list[str] | None = ..., passphrase: str | None = ... |
| 194 | + ) -> ImportResult: ... |
| 195 | + def import_keys_file(self, key_path: str, **kwargs: Any) -> ImportResult: ... |
| 196 | + def recv_keys(self, keyserver: str, *keyids: str, **kwargs: Any) -> ImportResult: ... |
| 197 | + def send_keys(self, keyserver: str, *keyids: str, **kwargs: Any) -> SendResult: ... |
| 198 | + def delete_keys( |
| 199 | + self, |
| 200 | + fingerprints: str | list[str], |
| 201 | + secret: bool = ..., |
| 202 | + passphrase: str | None = ..., |
| 203 | + expect_passphrase: bool = ..., |
| 204 | + exclamation_mode: bool = ..., |
| 205 | + ) -> DeleteResult: ... |
| 206 | + def export_keys( |
| 207 | + self, |
| 208 | + keyids: str | list[str], |
| 209 | + secret: bool = ..., |
| 210 | + armor: bool = ..., |
| 211 | + minimal: bool = ..., |
| 212 | + passphrase: str | None = ..., |
| 213 | + expect_passphrase: bool = ..., |
| 214 | + output: str | None = ..., |
| 215 | + ) -> ExportResult: ... |
| 216 | + def list_keys(self, secret: bool = ..., keys: str | list[str] | None = ..., sigs: bool = ...) -> ListKeys: ... |
| 217 | + def scan_keys(self, filename: str) -> ScanKeys: ... |
| 218 | + def scan_keys_mem(self, key_data: str | bytes) -> ScanKeys: ... |
| 219 | + def search_keys(self, query: str, keyserver: str = ..., extra_args: list[str] | None = ...) -> SearchKeys: ... |
| 220 | + def auto_locate_key(self, email: str, mechanisms: list[str] | None = ..., **kwargs: Any) -> AutoLocateKey: ... |
| 221 | + def gen_key(self, input: str) -> GenKey: ... |
| 222 | + def gen_key_input(self, **kwargs: Any) -> str: ... |
| 223 | + def add_subkey( |
| 224 | + self, master_key: str, master_passphrase: str | None = ..., algorithm: str = ..., usage: str = ..., expire: str = ... |
| 225 | + ) -> AddSubkey: ... |
| 226 | + def encrypt_file( |
| 227 | + self, |
| 228 | + fileobj_or_path: str | _ReadableFile, |
| 229 | + recipients: str | list[str], |
| 230 | + sign: str | None = ..., |
| 231 | + always_trust: bool = ..., |
| 232 | + passphrase: str | None = ..., |
| 233 | + armor: bool = ..., |
| 234 | + output: str | None = ..., |
| 235 | + symmetric: bool = ..., |
| 236 | + extra_args: list[str] | None = ..., |
| 237 | + ) -> Crypt: ... |
| 238 | + def encrypt(self, data: str | bytes, recipients: str | list[str], **kwargs: Any) -> Crypt: ... |
| 239 | + def decrypt(self, message: str | bytes, **kwargs: Any) -> Crypt: ... |
| 240 | + def decrypt_file( |
| 241 | + self, |
| 242 | + fileobj_or_path: str | _ReadableFile, |
| 243 | + always_trust: bool = ..., |
| 244 | + passphrase: str | None = ..., |
| 245 | + output: str | None = ..., |
| 246 | + extra_args: list[str] | None = ..., |
| 247 | + ) -> Crypt: ... |
| 248 | + def get_recipients(self, message: str | bytes, **kwargs: Any) -> list[str]: ... |
| 249 | + def get_recipients_file(self, fileobj_or_path: str | _ReadableFile, extra_args: list[str] | None = ...) -> list[str]: ... |
| 250 | + def trust_keys(self, fingerprints: str | list[str], trustlevel: str) -> TrustResult: ... |
0 commit comments