|
1 | 1 | from __future__ import annotations |
2 | 2 |
|
3 | 3 | import os |
| 4 | +import sys |
4 | 5 | import textwrap |
5 | 6 | import typing as t |
6 | 7 |
|
|
23 | 24 | from .param_types import CommaDelimitedList, LazyBinaryReadFile, ValidatorClassName |
24 | 25 | from .parse_result import ParseResult, SchemaLoadingMode |
25 | 26 |
|
| 27 | +if sys.version_info >= (3, 8): |
| 28 | + from typing import Literal |
| 29 | +else: |
| 30 | + from typing_extensions import Literal |
| 31 | + |
26 | 32 | BUILTIN_SCHEMA_NAMES = [f"vendor.{k}" for k in SCHEMA_CATALOG.keys()] + [ |
27 | 33 | f"custom.{k}" for k in CUSTOM_SCHEMA_NAMES |
28 | 34 | ] |
@@ -232,16 +238,16 @@ def main( |
232 | 238 | no_cache: bool, |
233 | 239 | cache_filename: str | None, |
234 | 240 | disable_formats: tuple[list[str], ...], |
235 | | - format_regex: str, |
236 | | - default_filetype: str, |
237 | | - traceback_mode: str, |
238 | | - data_transform: str | None, |
| 241 | + format_regex: Literal["python", "default"], |
| 242 | + default_filetype: Literal["json", "yaml", "toml", "json5"], |
| 243 | + traceback_mode: Literal["full", "short"], |
| 244 | + data_transform: Literal["azure-pipelines", "gitlab-ci"] | None, |
239 | 245 | fill_defaults: bool, |
240 | 246 | validator_class: type[jsonschema.protocols.Validator] | None, |
241 | | - output_format: str, |
| 247 | + output_format: Literal["text", "json"], |
242 | 248 | verbose: int, |
243 | 249 | quiet: int, |
244 | | - instancefiles: tuple[t.BinaryIO, ...], |
| 250 | + instancefiles: tuple[t.IO[bytes], ...], |
245 | 251 | ) -> None: |
246 | 252 | args = ParseResult() |
247 | 253 |
|
|
0 commit comments