From: Vasek Sraier Date: Thu, 6 Jan 2022 15:30:34 +0000 (+0100) Subject: manager: fix typing issues with new version of pyright, removed LiteralEnum as it... X-Git-Tag: v6.0.0a1~62 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6dabaf6040567309b5203957e66c670d9e11c89a;p=thirdparty%2Fknot-resolver.git manager: fix typing issues with new version of pyright, removed LiteralEnum as it's useless ;) --- diff --git a/manager/.flake8 b/manager/.flake8 index 79a16af7e..4a464999f 100644 --- a/manager/.flake8 +++ b/manager/.flake8 @@ -1,2 +1,2 @@ [flake8] -max-line-length = 120 \ No newline at end of file +max-line-length = 200 \ No newline at end of file diff --git a/manager/knot_resolver_manager/compat/dataclasses.py b/manager/knot_resolver_manager/compat/dataclasses.py index 7302612f2..9d4a80c24 100644 --- a/manager/knot_resolver_manager/compat/dataclasses.py +++ b/manager/knot_resolver_manager/compat/dataclasses.py @@ -1,18 +1,26 @@ """ -This is a compat module that we will use with dataclasses -due to them being unsupported on Python 3.6. However, a proper backport exists. -This module is simply a reimport of that backported library (or the system one), -so that if we have to vendor that library or do something similar with it, we have -the option to do it transparently, without changing anything else. +This module contains rather simplistic reimplementation of dataclasses due to them being unsupported on Python 3.6 """ from typing import Any, Dict, Set, Type +dataclasses_import_success = False +try: + import dataclasses + + dataclasses_import_success = True +except ImportError: + pass + + _CUSTOM_DATACLASS_MARKER = "_CUSTOM_DATACLASS_MARKER" def dataclass(cls: Any): + if dataclasses_import_success: + return dataclasses.dataclass(cls) + anot: Dict[str, Type[Any]] = cls.__dict__.get("__annotations__", {}) def ninit(slf: Any, *args: Any, **kwargs: Any) -> None: @@ -51,8 +59,11 @@ def dataclass(cls: Any): return cls -def is_dataclass(cls: Any) -> bool: - return hasattr(cls, _CUSTOM_DATACLASS_MARKER) +def is_dataclass(obj: Any) -> bool: + if dataclasses_import_success: + return dataclasses.is_dataclass(obj) + + return hasattr(obj, _CUSTOM_DATACLASS_MARKER) __all__ = ["dataclass", "is_dataclass"] diff --git a/manager/knot_resolver_manager/datamodel/config_schema.py b/manager/knot_resolver_manager/datamodel/config_schema.py index 99f763e0f..bafc07401 100644 --- a/manager/knot_resolver_manager/datamodel/config_schema.py +++ b/manager/knot_resolver_manager/datamodel/config_schema.py @@ -1,6 +1,6 @@ import os import sys -from typing import Dict, Optional, Text, Union +from typing import Dict, Optional, Union from jinja2 import Environment, FileSystemLoader, Template from typing_extensions import Literal @@ -116,5 +116,5 @@ class KresConfig(SchemaNode): return Dns64Schema() return obj.dns64 - def render_lua(self) -> Text: - return _MAIN_TEMPLATE.render(cfg=self) + def render_lua(self) -> str: + return _MAIN_TEMPLATE.render(cfg=self) # pyright: reportUnknownMemberType=false diff --git a/manager/knot_resolver_manager/datamodel/logging_config.py b/manager/knot_resolver_manager/datamodel/logging_config.py index 07d0d1a30..cfe65bcdd 100644 --- a/manager/knot_resolver_manager/datamodel/logging_config.py +++ b/manager/knot_resolver_manager/datamodel/logging_config.py @@ -1,11 +1,12 @@ from typing import List, Optional +from typing_extensions import Literal, TypeAlias + from knot_resolver_manager.utils import SchemaNode -from knot_resolver_manager.utils.types import LiteralEnum -LogLevelEnum = LiteralEnum["crit", "err", "warning", "notice", "info", "debug"] -LogTargetEnum = LiteralEnum["syslog", "stderr", "stdout"] -LogGroupsEnum = LiteralEnum[ +LogLevelEnum = Literal["crit", "err", "warning", "notice", "info", "debug"] +LogTargetEnum = Literal["syslog", "stderr", "stdout"] +LogGroupsEnum: TypeAlias = Literal[ "manager", "system", "cache", diff --git a/manager/knot_resolver_manager/datamodel/network_schema.py b/manager/knot_resolver_manager/datamodel/network_schema.py index 212d76cc4..526458c19 100644 --- a/manager/knot_resolver_manager/datamodel/network_schema.py +++ b/manager/knot_resolver_manager/datamodel/network_schema.py @@ -1,5 +1,7 @@ from typing import List, Optional +from typing_extensions import Literal + from knot_resolver_manager.datamodel.types import ( CheckedPath, IPAddress, @@ -10,9 +12,8 @@ from knot_resolver_manager.datamodel.types import ( SizeUnit, ) from knot_resolver_manager.utils import SchemaNode -from knot_resolver_manager.utils.types import LiteralEnum -KindEnum = LiteralEnum["dns", "xdp", "dot", "doh"] +KindEnum = Literal["dns", "xdp", "dot", "doh"] class InterfaceSchema(SchemaNode): diff --git a/manager/knot_resolver_manager/datamodel/options_schema.py b/manager/knot_resolver_manager/datamodel/options_schema.py index 48cecfa42..24d4f9de0 100644 --- a/manager/knot_resolver_manager/datamodel/options_schema.py +++ b/manager/knot_resolver_manager/datamodel/options_schema.py @@ -3,11 +3,10 @@ from typing import Any, Union from typing_extensions import Literal from knot_resolver_manager.utils import SchemaNode -from knot_resolver_manager.utils.types import LiteralEnum from .types import TimeUnit -GlueCheckingEnum = LiteralEnum["normal", "strict", "permissive"] +GlueCheckingEnum = Literal["normal", "strict", "permissive"] class PredictionSchema(SchemaNode): diff --git a/manager/knot_resolver_manager/datamodel/server_schema.py b/manager/knot_resolver_manager/datamodel/server_schema.py index 8b0916f51..4595404fe 100644 --- a/manager/knot_resolver_manager/datamodel/server_schema.py +++ b/manager/knot_resolver_manager/datamodel/server_schema.py @@ -8,7 +8,6 @@ from typing_extensions import Literal from knot_resolver_manager.datamodel.types import CheckedPath, DomainName, Listen, RecordTypeEnum, UncheckedPath from knot_resolver_manager.exceptions import DataException from knot_resolver_manager.utils import SchemaNode -from knot_resolver_manager.utils.types import LiteralEnum logger = logging.getLogger(__name__) @@ -31,7 +30,7 @@ def _cpu_count() -> int: return cpus -BackendEnum = LiteralEnum["auto", "systemd", "supervisord"] +BackendEnum = Literal["auto", "systemd", "supervisord"] class WatchDogSchema(SchemaNode): diff --git a/manager/knot_resolver_manager/datamodel/types.py b/manager/knot_resolver_manager/datamodel/types.py index de4238f54..f85f2f595 100644 --- a/manager/knot_resolver_manager/datamodel/types.py +++ b/manager/knot_resolver_manager/datamodel/types.py @@ -5,15 +5,16 @@ from enum import Enum, auto from pathlib import Path from typing import Any, Dict, Optional, Pattern, Type, Union +from typing_extensions import Literal + from knot_resolver_manager.exceptions import SchemaException from knot_resolver_manager.utils import CustomValueType, SchemaNode from knot_resolver_manager.utils.modelling import Serializable -from knot_resolver_manager.utils.types import LiteralEnum logger = logging.getLogger(__name__) # Policy actions -ActionEnum = LiteralEnum[ +ActionEnum = Literal[ # Nonchain actions "pass", "deny", @@ -31,7 +32,7 @@ ActionEnum = LiteralEnum[ ] # FLAGS from https://knot-resolver.readthedocs.io/en/stable/lib.html?highlight=options#c.kr_qflags -FlagsEnum = LiteralEnum[ +FlagsEnum = Literal[ "no-minimize", "no-ipv4", "no-ipv6", @@ -71,7 +72,7 @@ FlagsEnum = LiteralEnum[ ] # DNS record types from 'kres.type' table -RecordTypeEnum = LiteralEnum[ +RecordTypeEnum = Literal[ "A", "A6", "AAAA", diff --git a/manager/knot_resolver_manager/kresd_controller/supervisord/__init__.py b/manager/knot_resolver_manager/kresd_controller/supervisord/__init__.py index ae4267242..f14319706 100644 --- a/manager/knot_resolver_manager/kresd_controller/supervisord/__init__.py +++ b/manager/knot_resolver_manager/kresd_controller/supervisord/__init__.py @@ -77,7 +77,7 @@ async def _write_config_file(config: KresConfig, instances: Set["SupervisordSubp template = await read_resource(__package__, "supervisord.conf.j2") assert template is not None template = template.decode("utf8") - config_string = Template(template).render( + config_string = Template(template).render( # pyright: reportUnknownMemberType=false instances=[ _Instance( type=i.type.name, diff --git a/manager/knot_resolver_manager/server.py b/manager/knot_resolver_manager/server.py index 4f879b884..da478da5c 100644 --- a/manager/knot_resolver_manager/server.py +++ b/manager/knot_resolver_manager/server.py @@ -238,14 +238,7 @@ class Server: await self.runner.cleanup() -class _DefaultSentinel: - pass - - -_DEFAULT_SENTINEL = _DefaultSentinel() - - -async def _load_raw_config(config: Union[Path, ParsedTree, _DefaultSentinel]) -> ParsedTree: +async def _load_raw_config(config: Union[Path, ParsedTree]) -> ParsedTree: # Initial configuration of the manager if isinstance(config, Path): if not config.exists(): diff --git a/manager/knot_resolver_manager/utils/functional.py b/manager/knot_resolver_manager/utils/functional.py index 86ab38b80..43abd7055 100644 --- a/manager/knot_resolver_manager/utils/functional.py +++ b/manager/knot_resolver_manager/utils/functional.py @@ -1,5 +1,5 @@ from enum import Enum, auto -from typing import Any, Callable, Generic, Iterable, TypeVar +from typing import Any, Callable, Generic, Iterable, TypeVar, Union T = TypeVar("T") @@ -28,27 +28,41 @@ class _Status(Enum): ERROR = auto() +class _ResultSentinel: + pass + + +_RESULT_SENTINEL = _ResultSentinel() + + class Result(Generic[Succ, Err]): @staticmethod - def ok(succ: Succ) -> "Result[Succ, Any]": + def ok(succ: T) -> "Result[T, Any]": return Result(_Status.OK, succ=succ) @staticmethod - def err(err: Err) -> "Result[Any, Err]": + def err(err: T) -> "Result[Any, T]": return Result(_Status.ERROR, err=err) - def __init__(self, status: _Status, succ: Succ = None, err: Err = None) -> None: + def __init__( + self, + status: _Status, + succ: Union[Succ, _ResultSentinel] = _RESULT_SENTINEL, + err: Union[Err, _ResultSentinel] = _RESULT_SENTINEL, + ) -> None: super().__init__() self._status: _Status = status - self._succ: Succ = succ - self._err: Err = err + self._succ: Union[_ResultSentinel, Succ] = succ + self._err: Union[_ResultSentinel, Err] = err def unwrap(self) -> Succ: assert self._status is _Status.OK + assert not isinstance(self._succ, _ResultSentinel) return self._succ def unwrap_err(self) -> Err: assert self._status is _Status.ERROR + assert not isinstance(self._err, _ResultSentinel) return self._err def is_ok(self) -> bool: diff --git a/manager/knot_resolver_manager/utils/modelling.py b/manager/knot_resolver_manager/utils/modelling.py index ddc5adb1e..274a14832 100644 --- a/manager/knot_resolver_manager/utils/modelling.py +++ b/manager/knot_resolver_manager/utils/modelling.py @@ -1,3 +1,4 @@ +import enum import inspect from typing import Any, Dict, List, Optional, Set, Tuple, Type, Union, cast @@ -28,7 +29,7 @@ def is_obj_type(obj: Any, types: Union[type, Tuple[Any, ...], Tuple[type, ...]]) # To check specific type we are using 'type()' instead of 'isinstance()' # because for example 'bool' is instance of 'int', 'isinstance(False, int)' returns True. # pylint: disable=unidiomatic-typecheck - if isinstance(types, Tuple): + if isinstance(types, tuple): return type(obj) in types return type(obj) == types @@ -66,7 +67,7 @@ class Serializable: elif inspect.isclass(typ) and issubclass(typ, SchemaNode): node = cast(SchemaNode, obj) - return node.serialize() + return node.to_dict() elif is_list(typ): lst = cast(List[Any], obj) @@ -159,16 +160,12 @@ def _describe_type(typ: Type[Any]) -> Dict[Any, Any]: return {"type": "string"} elif is_literal(typ): - val = get_generic_type_argument(typ) - return {"type": {str: "string", int: "integer", bool: "boolean"}[type(val)], "const": val} + val = get_generic_type_arguments(typ) + return {"enum": val} elif is_union(typ): variants = get_generic_type_arguments(typ) - # simplification for Union of Literals - if all_matches(is_literal, variants): - return {"enum": [get_generic_type_argument(literal) for literal in variants]} - else: - return {"anyOf": [_describe_type(v) for v in variants]} + return {"anyOf": [_describe_type(v) for v in variants]} elif is_list(typ): return {"type": "array", "items": _describe_type(get_generic_type_argument(typ))} @@ -185,7 +182,7 @@ def _describe_type(typ: Type[Any]) -> Dict[Any, Any]: return {"type": "object", "additionalProperties": _describe_type(val)} - elif is_enum(typ): + elif inspect.isclass(typ) and issubclass(typ, enum.Enum): # same as our is_enum(typ), but inlined for type checker return {"type": "string", "enum": [str(v) for v in typ]} raise NotImplementedError(f"Trying to get JSON schema for type '{typ}', which is not implemented") @@ -268,8 +265,8 @@ def _validated_object_type( # Literal[T] elif is_literal(cls): - expected = get_generic_type_argument(cls) - if obj == expected: + expected = get_generic_type_arguments(cls) + if obj in expected: return obj else: raise SchemaException(f"Literal {cls} is not matched with the value {obj}", object_path) @@ -354,7 +351,7 @@ def _create_untouchable(name: str): return _Untouchable() -class SchemaNode: +class SchemaNode(Serializable): """ Class for modelling configuration schema. It somewhat resembles standard dataclasses with additional functionality: @@ -577,7 +574,7 @@ class SchemaNode: return schema - def serialize(self) -> Dict[Any, Any]: + def to_dict(self) -> Dict[Any, Any]: res: Dict[Any, Any] = {} cls = self.__class__ annot = cls.__dict__.get("__annotations__", {}) diff --git a/manager/knot_resolver_manager/utils/overload.py b/manager/knot_resolver_manager/utils/overload.py deleted file mode 100644 index 8834cfc40..000000000 --- a/manager/knot_resolver_manager/utils/overload.py +++ /dev/null @@ -1,77 +0,0 @@ -from collections import defaultdict -from typing import Any, Callable, Dict, Generic, List, Tuple, Type, TypeVar - -from knot_resolver_manager.utils.types import NoneType, get_optional_inner_type, is_optional - -T = TypeVar("T") - - -class OverloadedFunctionException(Exception): - pass - - -class Overloaded(Generic[T]): - def __init__(self): - self._vtable: Dict[Tuple[Any, ...], Callable[..., T]] = {} - - @staticmethod - def _create_signatures(*types: Any) -> List[Any]: - result: List[List[Any]] = [[]] - for arg_type in types: - if is_optional(arg_type): - tp = get_optional_inner_type(arg_type) - result = [p + [NoneType] for p in result] + [p + [tp] for p in result] - else: - result = [p + [arg_type] for p in result] - - # make tuples - return [tuple(x) for x in result] - - def add(self, *args: Type[Any], **kwargs: Type[Any]) -> Callable[[Callable[..., T]], Callable[..., T]]: - if len(kwargs) != 0: - raise OverloadedFunctionException( - "Sorry, named arguments are not supported. " - "You can however implement them and make them functional... ;)" - ) - - def wrapper(func: Callable[..., T]) -> Callable[..., T]: - signatures = Overloaded._create_signatures(*args) - for signature in signatures: - if signature in self._vtable: - raise OverloadedFunctionException( - "Sorry, signature {signature} is already defined. " - "You can't make a second definition of the same signature." - ) - self._vtable[signature] = func - - return self - - return wrapper - - def default(self, func: Callable[..., T]) -> Callable[..., T]: - if isinstance(self._vtable, defaultdict): - raise OverloadedFunctionException( - "Sorry, you can't define multiple default handlers in an overloaded function" - ) - - self._vtable = defaultdict(lambda: func, self._vtable) - return self - - def __call__(self, *args: Any, **kwargs: Any) -> T: - if len(kwargs) != 0: - raise OverloadedFunctionException( - "Sorry, named arguments are not supported. " - "You can however implement them and make them functional... ;)" - ) - - signature = tuple(type(a) for a in args) - if signature not in self._vtable: - raise OverloadedFunctionException( - f"Function overload with signature {signature} is not registered and can't be called." - ) - return self._vtable[signature](*args) - - def _print_vtable(self): - for signature in self._vtable: - print(f"{signature} registered") - print() diff --git a/manager/knot_resolver_manager/utils/types.py b/manager/knot_resolver_manager/utils/types.py index 155f81292..14658d36e 100644 --- a/manager/knot_resolver_manager/utils/types.py +++ b/manager/knot_resolver_manager/utils/types.py @@ -74,15 +74,6 @@ def get_attr_type(obj: Any, attr_name: str) -> Any: return annot[attr_name] -class _LiteralEnum: - def __getitem__(self, args: Tuple[Union[str, int, bytes], ...]) -> Any: - lits = tuple(Literal[x] for x in args) - return Union[lits] # type: ignore - - -LiteralEnum = _LiteralEnum() - - T = TypeVar("T") diff --git a/manager/poetry.lock b/manager/poetry.lock index 5c32c87ef..a957c0e5f 100644 --- a/manager/poetry.lock +++ b/manager/poetry.lock @@ -376,6 +376,24 @@ category = "main" optional = false python-versions = ">=3.6" +[[package]] +name = "mypy" +version = "0.930" +description = "Optional static typing for Python" +category = "dev" +optional = false +python-versions = ">=3.6" + +[package.dependencies] +mypy-extensions = ">=0.4.3" +tomli = ">=1.1.0" +typed-ast = {version = ">=1.4.0,<2", markers = "python_version < \"3.8\""} +typing-extensions = ">=3.10" + +[package.extras] +dmypy = ["psutil (>=4.0)"] +python2 = ["typed-ast (>=1.4.0,<2)"] + [[package]] name = "mypy-extensions" version = "0.4.3" @@ -779,6 +797,14 @@ category = "dev" optional = false python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" +[[package]] +name = "tomli" +version = "1.2.3" +description = "A lil' TOML parser" +category = "dev" +optional = false +python-versions = ">=3.6" + [[package]] name = "tomlkit" version = "0.8.0" @@ -829,6 +855,49 @@ category = "dev" optional = false python-versions = ">=3.6" +[[package]] +name = "types-click" +version = "7.1.8" +description = "Typing stubs for click" +category = "dev" +optional = false +python-versions = "*" + +[[package]] +name = "types-jinja2" +version = "2.11.9" +description = "Typing stubs for Jinja2" +category = "dev" +optional = false +python-versions = "*" + +[package.dependencies] +types-MarkupSafe = "*" + +[[package]] +name = "types-markupsafe" +version = "1.1.10" +description = "Typing stubs for MarkupSafe" +category = "dev" +optional = false +python-versions = "*" + +[[package]] +name = "types-pyyaml" +version = "6.0.1" +description = "Typing stubs for PyYAML" +category = "dev" +optional = false +python-versions = "*" + +[[package]] +name = "types-requests" +version = "2.26.3" +description = "Typing stubs for requests" +category = "dev" +optional = false +python-versions = "*" + [[package]] name = "typing-extensions" version = "4.0.1" @@ -906,7 +975,7 @@ testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytes [metadata] lock-version = "1.1" python-versions = "^3.6.8" -content-hash = "ec68fee6228dfb5ec8a32e66b5bc340dedd8050d04b8922f6d89fd140adff12e" +content-hash = "db994629f529ada321967b8bb6e8d5c536461ec2fed89d986a2f71c348c24b30" [metadata.files] aiohttp = [ @@ -1388,6 +1457,28 @@ multidict = [ {file = "multidict-5.2.0-cp39-cp39-win_amd64.whl", hash = "sha256:c9631c642e08b9fff1c6255487e62971d8b8e821808ddd013d8ac058087591ac"}, {file = "multidict-5.2.0.tar.gz", hash = "sha256:0dd1c93edb444b33ba2274b66f63def8a327d607c6c790772f448a53b6ea59ce"}, ] +mypy = [ + {file = "mypy-0.930-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:221cc94dc6a801ccc2be7c0c9fd791c5e08d1fa2c5e1c12dec4eab15b2469871"}, + {file = "mypy-0.930-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:db3a87376a1380f396d465bed462e76ea89f838f4c5e967d68ff6ee34b785c31"}, + {file = "mypy-0.930-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:1d2296f35aae9802eeb1327058b550371ee382d71374b3e7d2804035ef0b830b"}, + {file = "mypy-0.930-cp310-cp310-win_amd64.whl", hash = "sha256:959319b9a3cafc33a8185f440a433ba520239c72e733bf91f9efd67b0a8e9b30"}, + {file = "mypy-0.930-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:45a4dc21c789cfd09b8ccafe114d6de66f0b341ad761338de717192f19397a8c"}, + {file = "mypy-0.930-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:1e689e92cdebd87607a041585f1dc7339aa2e8a9f9bad9ba7e6ece619431b20c"}, + {file = "mypy-0.930-cp36-cp36m-win_amd64.whl", hash = "sha256:ed4e0ea066bb12f56b2812a15ff223c57c0a44eca817ceb96b214bb055c7051f"}, + {file = "mypy-0.930-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:a9d8dffefba634b27d650e0de2564379a1a367e2e08d6617d8f89261a3bf63b2"}, + {file = "mypy-0.930-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:b419e9721260161e70d054a15abbd50603c16f159860cfd0daeab647d828fc29"}, + {file = "mypy-0.930-cp37-cp37m-win_amd64.whl", hash = "sha256:601f46593f627f8a9b944f74fd387c9b5f4266b39abad77471947069c2fc7651"}, + {file = "mypy-0.930-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:1ea7199780c1d7940b82dbc0a4e37722b4e3851264dbba81e01abecc9052d8a7"}, + {file = "mypy-0.930-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:70b197dd8c78fc5d2daf84bd093e8466a2b2e007eedaa85e792e513a820adbf7"}, + {file = "mypy-0.930-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:5feb56f8bb280468fe5fc8e6f56f48f99aa0df9eed3c507a11505ee4657b5380"}, + {file = "mypy-0.930-cp38-cp38-win_amd64.whl", hash = "sha256:2e9c5409e9cb81049bb03fa1009b573dea87976713e3898561567a86c4eaee01"}, + {file = "mypy-0.930-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:554873e45c1ca20f31ddf873deb67fa5d2e87b76b97db50669f0468ccded8fae"}, + {file = "mypy-0.930-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:0feb82e9fa849affca7edd24713dbe809dce780ced9f3feca5ed3d80e40b777f"}, + {file = "mypy-0.930-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:bc1a0607ea03c30225347334af66b0af12eefba018a89a88c209e02b7065ea95"}, + {file = "mypy-0.930-cp39-cp39-win_amd64.whl", hash = "sha256:f9f665d69034b1fcfdbcd4197480d26298bbfb5d2dfe206245b6498addb34999"}, + {file = "mypy-0.930-py3-none-any.whl", hash = "sha256:bf4a44e03040206f7c058d1f5ba02ef2d1820720c88bc4285c7d9a4269f54173"}, + {file = "mypy-0.930.tar.gz", hash = "sha256:51426262ae4714cc7dd5439814676e0992b55bcc0f6514eccb4cf8e0678962c2"}, +] mypy-extensions = [ {file = "mypy_extensions-0.4.3-py2.py3-none-any.whl", hash = "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d"}, {file = "mypy_extensions-0.4.3.tar.gz", hash = "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"}, @@ -1610,6 +1701,10 @@ toml = [ {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, ] +tomli = [ + {file = "tomli-1.2.3-py3-none-any.whl", hash = "sha256:e3069e4be3ead9668e21cb9b074cd948f7b3113fd9c8bba083f48247aab8b11c"}, + {file = "tomli-1.2.3.tar.gz", hash = "sha256:05b6166bff487dc068d322585c7ea4ef78deed501cc124060e0f238e89a9231f"}, +] tomlkit = [ {file = "tomlkit-0.8.0-py3-none-any.whl", hash = "sha256:b824e3466f1d475b2b5f1c392954c6cb7ea04d64354ff7300dc7c14257dc85db"}, {file = "tomlkit-0.8.0.tar.gz", hash = "sha256:29e84a855712dfe0e88a48f6d05c21118dbafb283bb2eed614d46f80deb8e9a1"}, @@ -1643,6 +1738,26 @@ typed-ast = [ {file = "typed_ast-1.5.1-cp39-cp39-win_amd64.whl", hash = "sha256:b6d17f37f6edd879141e64a5db17b67488cfeffeedad8c5cec0392305e9bc775"}, {file = "typed_ast-1.5.1.tar.gz", hash = "sha256:484137cab8ecf47e137260daa20bafbba5f4e3ec7fda1c1e69ab299b75fa81c5"}, ] +types-click = [ + {file = "types-click-7.1.8.tar.gz", hash = "sha256:b6604968be6401dc516311ca50708a0a28baa7a0cb840efd7412f0dbbff4e092"}, + {file = "types_click-7.1.8-py3-none-any.whl", hash = "sha256:8cb030a669e2e927461be9827375f83c16b8178c365852c060a34e24871e7e81"}, +] +types-jinja2 = [ + {file = "types-Jinja2-2.11.9.tar.gz", hash = "sha256:dbdc74a40aba7aed520b7e4d89e8f0fe4286518494208b35123bcf084d4b8c81"}, + {file = "types_Jinja2-2.11.9-py3-none-any.whl", hash = "sha256:60a1e21e8296979db32f9374d8a239af4cb541ff66447bb915d8ad398f9c63b2"}, +] +types-markupsafe = [ + {file = "types-MarkupSafe-1.1.10.tar.gz", hash = "sha256:85b3a872683d02aea3a5ac2a8ef590193c344092032f58457287fbf8e06711b1"}, + {file = "types_MarkupSafe-1.1.10-py3-none-any.whl", hash = "sha256:ca2bee0f4faafc45250602567ef38d533e877d2ddca13003b319c551ff5b3cc5"}, +] +types-pyyaml = [ + {file = "types-PyYAML-6.0.1.tar.gz", hash = "sha256:2e27b0118ca4248a646101c5c318dc02e4ca2866d6bc42e84045dbb851555a76"}, + {file = "types_PyYAML-6.0.1-py3-none-any.whl", hash = "sha256:d5b318269652e809b5c30a5fe666c50159ab80bfd41cd6bafe655bf20b29fcba"}, +] +types-requests = [ + {file = "types-requests-2.26.3.tar.gz", hash = "sha256:d63fa617846dcefff5aa2d59e47ab4ffd806e4bb0567115f7adbb5e438302fe4"}, + {file = "types_requests-2.26.3-py3-none-any.whl", hash = "sha256:ad18284931c5ddbf050ccdd138f200d18fd56f88aa3567019d8da9b2d4fe0344"}, +] typing-extensions = [ {file = "typing_extensions-4.0.1-py3-none-any.whl", hash = "sha256:7f001e5ac290a0c0401508864c7ec868be4e701886d5b573a9528ed3973d9d3b"}, {file = "typing_extensions-4.0.1.tar.gz", hash = "sha256:4ca091dea149f945ec56afb48dae714f21e8692ef22a395223bcd328961b6a0e"}, diff --git a/manager/pyproject.toml b/manager/pyproject.toml index 7b0c6f4a5..a550f4407 100644 --- a/manager/pyproject.toml +++ b/manager/pyproject.toml @@ -35,6 +35,11 @@ supervisor = "^4.2.2" pylint = "^2.11.1" pytest-asyncio = "^0.16.0" pytest = "^6.2.5" +types-requests = "^2.26.3" +types-PyYAML = "^6.0.1" +mypy = "^0.930" +types-click = "^7.1.8" +types-Jinja2 = "^2.11.9" [tool.poe.tasks] run = { cmd = "scripts/run", help = "Run the manager" } diff --git a/manager/tests/unit/utils/test_overloaded.py b/manager/tests/unit/utils/test_overloaded.py deleted file mode 100644 index bcbdbc57c..000000000 --- a/manager/tests/unit/utils/test_overloaded.py +++ /dev/null @@ -1,45 +0,0 @@ -from typing import Optional - -from knot_resolver_manager.utils.overload import Overloaded - - -def test_simple(): - func: Overloaded[None] = Overloaded() - - @func.add(int) - def f1(a: int) -> None: - assert type(a) == int - - @func.add(str) - def f2(a: str) -> None: - assert type(a) == str - - func("test") - func(5) - f1("test") - f2(5) - f1("test") - f2(5) - - -def test_optional(): - # pyright: reportUnusedFunction=false - - func: Overloaded[int] = Overloaded() - - @func.add(Optional[int], str) - def f1(a: Optional[int], b: str) -> int: - assert a is None or type(a) == int - assert type(b) == str - return -1 - - @func.add(Optional[str], int) - def f2(a: Optional[str], b: int) -> int: - assert a is None or type(a) == str - assert type(b) == int - return 1 - - func(None, 5) - func("str", 5) - func(None, "str") - func(5, "str") diff --git a/manager/tests/unit/utils/test_types.py b/manager/tests/unit/utils/test_types.py index 580154a25..cf8984587 100644 --- a/manager/tests/unit/utils/test_types.py +++ b/manager/tests/unit/utils/test_types.py @@ -1,8 +1,8 @@ -from typing import List, Union +from typing import List from typing_extensions import Literal -from knot_resolver_manager.utils.types import LiteralEnum, is_list, is_literal +from knot_resolver_manager.utils.types import is_list, is_literal def test_is_list(): @@ -13,8 +13,3 @@ def test_is_list(): def test_is_literal(): assert is_literal(Literal[5]) assert is_literal(Literal["test"]) - - -def test_literal_enum(): - assert LiteralEnum[5, "test"] == Union[Literal[5], Literal["test"]] - assert LiteralEnum["str", 5] == Union[Literal["str"], Literal[5]] diff --git a/manager/typings/jinja2/__init__.pyi b/manager/typings/jinja2/__init__.pyi deleted file mode 100644 index f7bac8fc2..000000000 --- a/manager/typings/jinja2/__init__.pyi +++ /dev/null @@ -1,42 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -from jinja2.bccache import BytecodeCache as BytecodeCache -from jinja2.bccache import FileSystemBytecodeCache as FileSystemBytecodeCache -from jinja2.bccache import MemcachedBytecodeCache as MemcachedBytecodeCache -from jinja2.environment import Environment as Environment -from jinja2.environment import Template as Template -from jinja2.exceptions import TemplateAssertionError as TemplateAssertionError -from jinja2.exceptions import TemplateError as TemplateError -from jinja2.exceptions import TemplateNotFound as TemplateNotFound -from jinja2.exceptions import TemplatesNotFound as TemplatesNotFound -from jinja2.exceptions import TemplateSyntaxError as TemplateSyntaxError -from jinja2.exceptions import UndefinedError as UndefinedError -from jinja2.filters import contextfilter as contextfilter -from jinja2.filters import environmentfilter as environmentfilter -from jinja2.filters import evalcontextfilter as evalcontextfilter -from jinja2.loaders import BaseLoader as BaseLoader -from jinja2.loaders import ChoiceLoader as ChoiceLoader -from jinja2.loaders import DictLoader as DictLoader -from jinja2.loaders import FileSystemLoader as FileSystemLoader -from jinja2.loaders import FunctionLoader as FunctionLoader -from jinja2.loaders import ModuleLoader as ModuleLoader -from jinja2.loaders import PackageLoader as PackageLoader -from jinja2.loaders import PrefixLoader as PrefixLoader -from jinja2.runtime import DebugUndefined as DebugUndefined -from jinja2.runtime import StrictUndefined as StrictUndefined -from jinja2.runtime import Undefined as Undefined -from jinja2.runtime import make_logging_undefined as make_logging_undefined -from jinja2.utils import Markup as Markup -from jinja2.utils import clear_caches as clear_caches -from jinja2.utils import contextfunction as contextfunction -from jinja2.utils import environmentfunction as environmentfunction -from jinja2.utils import escape as escape -from jinja2.utils import evalcontextfunction as evalcontextfunction -from jinja2.utils import is_undefined as is_undefined -from jinja2.utils import select_autoescape as select_autoescape - -""" -This type stub file was generated by pyright. -""" diff --git a/manager/typings/jinja2/_compat.pyi b/manager/typings/jinja2/_compat.pyi deleted file mode 100644 index c119f2b17..000000000 --- a/manager/typings/jinja2/_compat.pyi +++ /dev/null @@ -1,38 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -import sys -from typing import Any, Optional - -""" -This type stub file was generated by pyright. -""" -if sys.version_info >= (3, ): - url_quote = ... -else: - ... -PY2: Any -PYPY: Any -unichr: Any -range_type: Any -text_type: Any -string_types: Any -integer_types: Any -iterkeys: Any -itervalues: Any -iteritems: Any -NativeStringIO: Any -def reraise(tp, value, tb: Optional[Any] = ...): - ... - -ifilter: Any -imap: Any -izip: Any -intern: Any -implements_iterator: Any -implements_to_string: Any -encode_filename: Any -get_next: Any -def with_metaclass(meta, *bases): - ... diff --git a/manager/typings/jinja2/_stringdefs.pyi b/manager/typings/jinja2/_stringdefs.pyi deleted file mode 100644 index a77d31902..000000000 --- a/manager/typings/jinja2/_stringdefs.pyi +++ /dev/null @@ -1,47 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -from typing import Any - -""" -This type stub file was generated by pyright. -""" -Cc: str -Cf: str -Cn: str -Co: str -Cs: Any -Ll: str -Lm: str -Lo: str -Lt: str -Lu: str -Mc: str -Me: str -Mn: str -Nd: str -Nl: str -No: str -Pc: str -Pd: str -Pe: str -Pf: str -Pi: str -Po: str -Ps: str -Sc: str -Sk: str -Sm: str -So: str -Zl: str -Zp: str -Zs: str -cats: Any -def combine(*args): - ... - -xid_start: str -xid_continue: str -def allexcept(*args): - ... diff --git a/manager/typings/jinja2/bccache.pyi b/manager/typings/jinja2/bccache.pyi deleted file mode 100644 index 86dc6b9a3..000000000 --- a/manager/typings/jinja2/bccache.pyi +++ /dev/null @@ -1,92 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -from typing import Any, Optional - -""" -This type stub file was generated by pyright. -""" -marshal_dump: Any -marshal_load: Any -bc_version: int -bc_magic: Any -class Bucket: - environment: Any - key: Any - checksum: Any - def __init__(self, environment, key, checksum) -> None: - ... - - code: Any - def reset(self): - ... - - def load_bytecode(self, f): - ... - - def write_bytecode(self, f): - ... - - def bytecode_from_string(self, string): - ... - - def bytecode_to_string(self): - ... - - - -class BytecodeCache: - def load_bytecode(self, bucket): - ... - - def dump_bytecode(self, bucket): - ... - - def clear(self): - ... - - def get_cache_key(self, name, filename: Optional[Any] = ...): - ... - - def get_source_checksum(self, source): - ... - - def get_bucket(self, environment, name, filename, source): - ... - - def set_bucket(self, bucket): - ... - - - -class FileSystemBytecodeCache(BytecodeCache): - directory: Any - pattern: Any - def __init__(self, directory: Optional[Any] = ..., pattern: str = ...) -> None: - ... - - def load_bytecode(self, bucket): - ... - - def dump_bytecode(self, bucket): - ... - - def clear(self): - ... - - - -class MemcachedBytecodeCache(BytecodeCache): - client: Any - prefix: Any - timeout: Any - ignore_memcache_errors: Any - def __init__(self, client, prefix: str = ..., timeout: Optional[Any] = ..., ignore_memcache_errors: bool = ...) -> None: - ... - - def load_bytecode(self, bucket): - ... - - def dump_bytecode(self, bucket): - ... diff --git a/manager/typings/jinja2/compiler.pyi b/manager/typings/jinja2/compiler.pyi deleted file mode 100644 index a528de715..000000000 --- a/manager/typings/jinja2/compiler.pyi +++ /dev/null @@ -1,398 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -from typing import Any, Optional - -from jinja2.visitor import NodeVisitor - -""" -This type stub file was generated by pyright. -""" -operators: Any -dict_item_iter: str -unoptimize_before_dead_code: bool -def generate(node, environment, name, filename, stream: Optional[Any] = ..., defer_init: bool = ...): - ... - -def has_safe_repr(value): - ... - -def find_undeclared(nodes, names): - ... - -class Identifiers: - declared: Any - outer_undeclared: Any - undeclared: Any - declared_locally: Any - declared_parameter: Any - def __init__(self) -> None: - ... - - def add_special(self, name): - ... - - def is_declared(self, name): - ... - - def copy(self): - ... - - - -class Frame: - eval_ctx: Any - identifiers: Any - toplevel: bool - rootlevel: bool - require_output_check: Any - buffer: Any - block: Any - assigned_names: Any - parent: Any - def __init__(self, eval_ctx, parent: Optional[Any] = ...) -> None: - ... - - def copy(self): - ... - - def inspect(self, nodes): - ... - - def find_shadowed(self, extra: Any = ...): - ... - - def inner(self): - ... - - def soft(self): - ... - - __copy__: Any - - -class VisitorExit(RuntimeError): - ... - - -class DependencyFinderVisitor(NodeVisitor): - filters: Any - tests: Any - def __init__(self) -> None: - ... - - def visit_Filter(self, node): - ... - - def visit_Test(self, node): - ... - - def visit_Block(self, node): - ... - - - -class UndeclaredNameVisitor(NodeVisitor): - names: Any - undeclared: Any - def __init__(self, names) -> None: - ... - - def visit_Name(self, node): - ... - - def visit_Block(self, node): - ... - - - -class FrameIdentifierVisitor(NodeVisitor): - identifiers: Any - def __init__(self, identifiers) -> None: - ... - - def visit_Name(self, node): - ... - - def visit_If(self, node): - ... - - def visit_Macro(self, node): - ... - - def visit_Import(self, node): - ... - - def visit_FromImport(self, node): - ... - - def visit_Assign(self, node): - ... - - def visit_For(self, node): - ... - - def visit_CallBlock(self, node): - ... - - def visit_FilterBlock(self, node): - ... - - def visit_AssignBlock(self, node): - ... - - def visit_Scope(self, node): - ... - - def visit_Block(self, node): - ... - - - -class CompilerExit(Exception): - ... - - -class CodeGenerator(NodeVisitor): - environment: Any - name: Any - filename: Any - stream: Any - created_block_context: bool - defer_init: Any - import_aliases: Any - blocks: Any - extends_so_far: int - has_known_extends: bool - code_lineno: int - tests: Any - filters: Any - debug_info: Any - def __init__(self, environment, name, filename, stream: Optional[Any] = ..., defer_init: bool = ...) -> None: - ... - - def fail(self, msg, lineno): - ... - - def temporary_identifier(self): - ... - - def buffer(self, frame): - ... - - def return_buffer_contents(self, frame): - ... - - def indent(self): - ... - - def outdent(self, step: int = ...): - ... - - def start_write(self, frame, node: Optional[Any] = ...): - ... - - def end_write(self, frame): - ... - - def simple_write(self, s, frame, node: Optional[Any] = ...): - ... - - def blockvisit(self, nodes, frame): - ... - - def write(self, x): - ... - - def writeline(self, x, node: Optional[Any] = ..., extra: int = ...): - ... - - def newline(self, node: Optional[Any] = ..., extra: int = ...): - ... - - def signature(self, node, frame, extra_kwargs: Optional[Any] = ...): - ... - - def pull_locals(self, frame): - ... - - def pull_dependencies(self, nodes): - ... - - def unoptimize_scope(self, frame): - ... - - def push_scope(self, frame, extra_vars: Any = ...): - ... - - def pop_scope(self, aliases, frame): - ... - - def function_scoping(self, node, frame, children: Optional[Any] = ..., find_special: bool = ...): - ... - - def macro_body(self, node, frame, children: Optional[Any] = ...): - ... - - def macro_def(self, node, frame): - ... - - def position(self, node): - ... - - def visit_Template(self, node, frame: Optional[Any] = ...): - ... - - def visit_Block(self, node, frame): - ... - - def visit_Extends(self, node, frame): - ... - - def visit_Include(self, node, frame): - ... - - def visit_Import(self, node, frame): - ... - - def visit_FromImport(self, node, frame): - ... - - def visit_For(self, node, frame): - ... - - def visit_If(self, node, frame): - ... - - def visit_Macro(self, node, frame): - ... - - def visit_CallBlock(self, node, frame): - ... - - def visit_FilterBlock(self, node, frame): - ... - - def visit_ExprStmt(self, node, frame): - ... - - def visit_Output(self, node, frame): - ... - - def make_assignment_frame(self, frame): - ... - - def export_assigned_vars(self, frame, assignment_frame): - ... - - def visit_Assign(self, node, frame): - ... - - def visit_AssignBlock(self, node, frame): - ... - - def visit_Name(self, node, frame): - ... - - def visit_Const(self, node, frame): - ... - - def visit_TemplateData(self, node, frame): - ... - - def visit_Tuple(self, node, frame): - ... - - def visit_List(self, node, frame): - ... - - def visit_Dict(self, node, frame): - ... - - def binop(self, interceptable: bool = ...): - ... - - def uaop(self, interceptable: bool = ...): - ... - - visit_Add: Any - visit_Sub: Any - visit_Mul: Any - visit_Div: Any - visit_FloorDiv: Any - visit_Pow: Any - visit_Mod: Any - visit_And: Any - visit_Or: Any - visit_Pos: Any - visit_Neg: Any - visit_Not: Any - def visit_Concat(self, node, frame): - ... - - def visit_Compare(self, node, frame): - ... - - def visit_Operand(self, node, frame): - ... - - def visit_Getattr(self, node, frame): - ... - - def visit_Getitem(self, node, frame): - ... - - def visit_Slice(self, node, frame): - ... - - def visit_Filter(self, node, frame): - ... - - def visit_Test(self, node, frame): - ... - - def visit_CondExpr(self, node, frame): - ... - - def visit_Call(self, node, frame, forward_caller: bool = ...): - ... - - def visit_Keyword(self, node, frame): - ... - - def visit_MarkSafe(self, node, frame): - ... - - def visit_MarkSafeIfAutoescape(self, node, frame): - ... - - def visit_EnvironmentAttribute(self, node, frame): - ... - - def visit_ExtensionAttribute(self, node, frame): - ... - - def visit_ImportedName(self, node, frame): - ... - - def visit_InternalName(self, node, frame): - ... - - def visit_ContextReference(self, node, frame): - ... - - def visit_Continue(self, node, frame): - ... - - def visit_Break(self, node, frame): - ... - - def visit_Scope(self, node, frame): - ... - - def visit_EvalContextModifier(self, node, frame): - ... - - def visit_ScopedEvalContextModifier(self, node, frame): - ... diff --git a/manager/typings/jinja2/constants.pyi b/manager/typings/jinja2/constants.pyi deleted file mode 100644 index e33f474c4..000000000 --- a/manager/typings/jinja2/constants.pyi +++ /dev/null @@ -1,8 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -""" -This type stub file was generated by pyright. -""" -LOREM_IPSUM_WORDS: str diff --git a/manager/typings/jinja2/debug.pyi b/manager/typings/jinja2/debug.pyi deleted file mode 100644 index c6ca8199a..000000000 --- a/manager/typings/jinja2/debug.pyi +++ /dev/null @@ -1,75 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -from typing import Any, Optional - -""" -This type stub file was generated by pyright. -""" -tproxy: Any -raise_helper: str -class TracebackFrameProxy: - tb: Any - def __init__(self, tb) -> None: - ... - - @property - def tb_next(self): - ... - - def set_next(self, next): - ... - - @property - def is_jinja_frame(self): - ... - - def __getattr__(self, name): - ... - - - -def make_frame_proxy(frame): - ... - -class ProcessedTraceback: - exc_type: Any - exc_value: Any - frames: Any - def __init__(self, exc_type, exc_value, frames) -> None: - ... - - def render_as_text(self, limit: Optional[Any] = ...): - ... - - def render_as_html(self, full: bool = ...): - ... - - @property - def is_template_syntax_error(self): - ... - - @property - def exc_info(self): - ... - - @property - def standard_exc_info(self): - ... - - - -def make_traceback(exc_info, source_hint: Optional[Any] = ...): - ... - -def translate_syntax_error(error, source: Optional[Any] = ...): - ... - -def translate_exception(exc_info, initial_skip: int = ...): - ... - -def fake_exc_info(exc_info, filename, lineno): - ... - -tb_set_next: Any diff --git a/manager/typings/jinja2/defaults.pyi b/manager/typings/jinja2/defaults.pyi deleted file mode 100644 index e1987ed02..000000000 --- a/manager/typings/jinja2/defaults.pyi +++ /dev/null @@ -1,28 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -from typing import Any, Dict, Optional - -from jinja2.filters import FILTERS -from jinja2.tests import TESTS - -""" -This type stub file was generated by pyright. -""" -DEFAULT_FILTERS = FILTERS -DEFAULT_TESTS = TESTS -BLOCK_START_STRING: str -BLOCK_END_STRING: str -VARIABLE_START_STRING: str -VARIABLE_END_STRING: str -COMMENT_START_STRING: str -COMMENT_END_STRING: str -LINE_STATEMENT_PREFIX: Optional[str] -LINE_COMMENT_PREFIX: Optional[str] -TRIM_BLOCKS: bool -LSTRIP_BLOCKS: bool -NEWLINE_SEQUENCE: str -KEEP_TRAILING_NEWLINE: bool -DEFAULT_NAMESPACE: Dict[str, Any] -DEFAULT_POLICIES = Dict[str, Any] diff --git a/manager/typings/jinja2/environment.pyi b/manager/typings/jinja2/environment.pyi deleted file mode 100644 index 801a1078a..000000000 --- a/manager/typings/jinja2/environment.pyi +++ /dev/null @@ -1,241 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -import sys -from typing import Any, AsyncIterator, Awaitable, Callable, Dict, Iterator, List, Optional, Sequence, Text, Type, Union - -from .bccache import BytecodeCache -from .loaders import BaseLoader -from .runtime import Context, Undefined - -""" -This type stub file was generated by pyright. -""" -if sys.version_info >= (3, 6): - ... -def get_spontaneous_environment(*args): - ... - -def create_cache(size): - ... - -def copy_cache(cache): - ... - -def load_extensions(environment, extensions): - ... - -class Environment: - sandboxed: bool - overlayed: bool - linked_to: Any - shared: bool - exception_handler: Any - exception_formatter: Any - code_generator_class: Any - context_class: Any - block_start_string: Text - block_end_string: Text - variable_start_string: Text - variable_end_string: Text - comment_start_string: Text - comment_end_string: Text - line_statement_prefix: Text - line_comment_prefix: Text - trim_blocks: bool - lstrip_blocks: Any - newline_sequence: Text - keep_trailing_newline: bool - undefined: Type[Undefined] - optimized: bool - finalize: Callable[..., Any] - autoescape: Any - filters: Any - tests: Any - globals: Dict[str, Any] - loader: BaseLoader - cache: Any - bytecode_cache: BytecodeCache - auto_reload: bool - extensions: List[Any] - def __init__(self, block_start_string: Text = ..., block_end_string: Text = ..., variable_start_string: Text = ..., variable_end_string: Text = ..., comment_start_string: Any = ..., comment_end_string: Text = ..., line_statement_prefix: Text = ..., line_comment_prefix: Text = ..., trim_blocks: bool = ..., lstrip_blocks: bool = ..., newline_sequence: Text = ..., keep_trailing_newline: bool = ..., extensions: List[Any] = ..., optimized: bool = ..., undefined: Type[Undefined] = ..., finalize: Optional[Callable[..., Any]] = ..., autoescape: Union[bool, Callable[[str], bool]] = ..., loader: Optional[BaseLoader] = ..., cache_size: int = ..., auto_reload: bool = ..., bytecode_cache: Optional[BytecodeCache] = ..., enable_async: bool = ...) -> None: - ... - - def add_extension(self, extension): - ... - - def extend(self, **attributes): - ... - - def overlay(self, block_start_string: Text = ..., block_end_string: Text = ..., variable_start_string: Text = ..., variable_end_string: Text = ..., comment_start_string: Any = ..., comment_end_string: Text = ..., line_statement_prefix: Text = ..., line_comment_prefix: Text = ..., trim_blocks: bool = ..., lstrip_blocks: bool = ..., extensions: List[Any] = ..., optimized: bool = ..., undefined: Type[Undefined] = ..., finalize: Callable[..., Any] = ..., autoescape: bool = ..., loader: Optional[BaseLoader] = ..., cache_size: int = ..., auto_reload: bool = ..., bytecode_cache: Optional[BytecodeCache] = ...): - ... - - lexer: Any - def iter_extensions(self): - ... - - def getitem(self, obj, argument): - ... - - def getattr(self, obj, attribute): - ... - - def call_filter(self, name, value, args: Optional[Any] = ..., kwargs: Optional[Any] = ..., context: Optional[Any] = ..., eval_ctx: Optional[Any] = ...): - ... - - def call_test(self, name, value, args: Optional[Any] = ..., kwargs: Optional[Any] = ...): - ... - - def parse(self, source, name: Optional[Any] = ..., filename: Optional[Any] = ...): - ... - - def lex(self, source, name: Optional[Any] = ..., filename: Optional[Any] = ...): - ... - - def preprocess(self, source: Text, name: Optional[Any] = ..., filename: Optional[Any] = ...): - ... - - def compile(self, source, name: Optional[Any] = ..., filename: Optional[Any] = ..., raw: bool = ..., defer_init: bool = ...): - ... - - def compile_expression(self, source: Text, undefined_to_none: bool = ...): - ... - - def compile_templates(self, target, extensions: Optional[Any] = ..., filter_func: Optional[Any] = ..., zip: str = ..., log_function: Optional[Any] = ..., ignore_errors: bool = ..., py_compile: bool = ...): - ... - - def list_templates(self, extensions: Optional[Any] = ..., filter_func: Optional[Any] = ...): - ... - - def handle_exception(self, exc_info: Optional[Any] = ..., rendered: bool = ..., source_hint: Optional[Any] = ...): - ... - - def join_path(self, template: Union[Template, Text], parent: Text) -> Text: - ... - - def get_template(self, name: Union[Template, Text], parent: Optional[Text] = ..., globals: Optional[Any] = ...) -> Template: - ... - - def select_template(self, names: Sequence[Union[Template, Text]], parent: Optional[Text] = ..., globals: Optional[Dict[str, Any]] = ...) -> Template: - ... - - def get_or_select_template(self, template_name_or_list: Union[Union[Template, Text], Sequence[Union[Template, Text]]], parent: Optional[Text] = ..., globals: Optional[Dict[str, Any]] = ...) -> Template: - ... - - def from_string(self, source: Text, globals: Optional[Dict[str, Any]] = ..., template_class: Optional[Type[Template]] = ...) -> Template: - ... - - def make_globals(self, d: Optional[Dict[str, Any]]) -> Dict[str, Any]: - ... - - def install_gettext_translations(self, translations: Any, newstyle: Optional[bool] = ...): - ... - - def install_null_translations(self, newstyle: Optional[bool] = ...): - ... - - def install_gettext_callables(self, gettext: Callable[..., Any], ngettext: Callable[..., Any], newstyle: Optional[bool] = ...): - ... - - def uninstall_gettext_translations(self, translations: Any): - ... - - def extract_translations(self, source: Any, gettext_functions: Any): - ... - - newstyle_gettext: bool - - -class Template: - name: Optional[str] - filename: Optional[str] - def __new__(cls, source, block_start_string: Any = ..., block_end_string: Any = ..., variable_start_string: Any = ..., variable_end_string: Any = ..., comment_start_string: Any = ..., comment_end_string: Any = ..., line_statement_prefix: Any = ..., line_comment_prefix: Any = ..., trim_blocks: Any = ..., lstrip_blocks: Any = ..., newline_sequence: Any = ..., keep_trailing_newline: Any = ..., extensions: Any = ..., optimized: bool = ..., undefined: Any = ..., finalize: Optional[Any] = ..., autoescape: bool = ...): - ... - - environment: Environment = ... - @classmethod - def from_code(cls, environment, code, globals, uptodate: Optional[Any] = ...): - ... - - @classmethod - def from_module_dict(cls, environment, module_dict, globals): - ... - - def render(self, *args: Any, **kwargs: Any) -> Text: - ... - - def stream(self, *args, **kwargs) -> TemplateStream: - ... - - def generate(self, *args, **kwargs) -> Iterator[Text]: - ... - - def new_context(self, vars: Optional[Dict[str, Any]] = ..., shared: bool = ..., locals: Optional[Dict[str, Any]] = ...) -> Context: - ... - - def make_module(self, vars: Optional[Dict[str, Any]] = ..., shared: bool = ..., locals: Optional[Dict[str, Any]] = ...) -> Context: - ... - - @property - def module(self) -> Any: - ... - - def get_corresponding_lineno(self, lineno): - ... - - @property - def is_up_to_date(self) -> bool: - ... - - @property - def debug_info(self): - ... - - if sys.version_info >= (3, 6): - def render_async(self, *args: Any, **kwargs: Any) -> Awaitable[Text]: - ... - - def generate_async(self, *args, **kwargs) -> AsyncIterator[Text]: - ... - - - -class TemplateModule: - __name__: Any - def __init__(self, template, context) -> None: - ... - - def __html__(self): - ... - - - -class TemplateExpression: - def __init__(self, template, undefined_to_none) -> None: - ... - - def __call__(self, *args, **kwargs): - ... - - - -class TemplateStream: - def __init__(self, gen) -> None: - ... - - def dump(self, fp, encoding: Optional[Text] = ..., errors: Text = ...): - ... - - buffered: bool - def disable_buffering(self) -> None: - ... - - def enable_buffering(self, size: int = ...) -> None: - ... - - def __iter__(self): - ... - - def __next__(self): - ... diff --git a/manager/typings/jinja2/exceptions.pyi b/manager/typings/jinja2/exceptions.pyi deleted file mode 100644 index a9b12102d..000000000 --- a/manager/typings/jinja2/exceptions.pyi +++ /dev/null @@ -1,67 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -from typing import Any, Optional, Text - -""" -This type stub file was generated by pyright. -""" -class TemplateError(Exception): - def __init__(self, message: Optional[Text] = ...) -> None: - ... - - @property - def message(self): - ... - - def __unicode__(self): - ... - - - -class TemplateNotFound(IOError, LookupError, TemplateError): - message: Any - name: Any - templates: Any - def __init__(self, name, message: Optional[Text] = ...) -> None: - ... - - - -class TemplatesNotFound(TemplateNotFound): - templates: Any - def __init__(self, names: Any = ..., message: Optional[Text] = ...) -> None: - ... - - - -class TemplateSyntaxError(TemplateError): - lineno: int - name: Text - filename: Text - source: Text - translated: bool - def __init__(self, message: Text, lineno: int, name: Optional[Text] = ..., filename: Optional[Text] = ...) -> None: - ... - - - -class TemplateAssertionError(TemplateSyntaxError): - ... - - -class TemplateRuntimeError(TemplateError): - ... - - -class UndefinedError(TemplateRuntimeError): - ... - - -class SecurityError(TemplateRuntimeError): - ... - - -class FilterArgumentError(TemplateRuntimeError): - ... diff --git a/manager/typings/jinja2/ext.pyi b/manager/typings/jinja2/ext.pyi deleted file mode 100644 index d86a40e2f..000000000 --- a/manager/typings/jinja2/ext.pyi +++ /dev/null @@ -1,108 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -from typing import Any, Optional - -""" -This type stub file was generated by pyright. -""" -GETTEXT_FUNCTIONS: Any -class ExtensionRegistry(type): - def __new__(cls, name, bases, d): - ... - - - -class Extension: - tags: Any - priority: int - environment: Any - def __init__(self, environment) -> None: - ... - - def bind(self, environment): - ... - - def preprocess(self, source, name, filename: Optional[Any] = ...): - ... - - def filter_stream(self, stream): - ... - - def parse(self, parser): - ... - - def attr(self, name, lineno: Optional[Any] = ...): - ... - - def call_method(self, name, args: Optional[Any] = ..., kwargs: Optional[Any] = ..., dyn_args: Optional[Any] = ..., dyn_kwargs: Optional[Any] = ..., lineno: Optional[Any] = ...): - ... - - - -class InternationalizationExtension(Extension): - tags: Any - def __init__(self, environment) -> None: - ... - - def parse(self, parser): - ... - - - -class ExprStmtExtension(Extension): - tags: Any - def parse(self, parser): - ... - - - -class LoopControlExtension(Extension): - tags: Any - def parse(self, parser): - ... - - - -class WithExtension(Extension): - tags: Any - def parse(self, parser): - ... - - - -class AutoEscapeExtension(Extension): - tags: Any - def parse(self, parser): - ... - - - -def extract_from_ast(node, gettext_functions: Any = ..., babel_style: bool = ...): - ... - -class _CommentFinder: - tokens: Any - comment_tags: Any - offset: int - last_lineno: int - def __init__(self, tokens, comment_tags) -> None: - ... - - def find_backwards(self, offset): - ... - - def find_comments(self, lineno): - ... - - - -def babel_extract(fileobj, keywords, comment_tags, options): - ... - -i18n: Any -do: Any -loopcontrols: Any -with_: Any -autoescape: Any diff --git a/manager/typings/jinja2/filters.pyi b/manager/typings/jinja2/filters.pyi deleted file mode 100644 index 12ba6837d..000000000 --- a/manager/typings/jinja2/filters.pyi +++ /dev/null @@ -1,157 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -from typing import Any, NamedTuple, Optional - -""" -This type stub file was generated by pyright. -""" -def contextfilter(f): - ... - -def evalcontextfilter(f): - ... - -def environmentfilter(f): - ... - -def make_attrgetter(environment, attribute): - ... - -def do_forceescape(value): - ... - -def do_urlencode(value): - ... - -def do_replace(eval_ctx, s, old, new, count: Optional[Any] = ...): - ... - -def do_upper(s): - ... - -def do_lower(s): - ... - -def do_xmlattr(_eval_ctx, d, autospace: bool = ...): - ... - -def do_capitalize(s): - ... - -def do_title(s): - ... - -def do_dictsort(value, case_sensitive: bool = ..., by: str = ...): - ... - -def do_sort(environment, value, reverse: bool = ..., case_sensitive: bool = ..., attribute: Optional[Any] = ...): - ... - -def do_default(value, default_value: str = ..., boolean: bool = ...): - ... - -def do_join(eval_ctx, value, d: str = ..., attribute: Optional[Any] = ...): - ... - -def do_center(value, width: int = ...): - ... - -def do_first(environment, seq): - ... - -def do_last(environment, seq): - ... - -def do_random(environment, seq): - ... - -def do_filesizeformat(value, binary: bool = ...): - ... - -def do_pprint(value, verbose: bool = ...): - ... - -def do_urlize(eval_ctx, value, trim_url_limit: Optional[Any] = ..., nofollow: bool = ..., target: Optional[Any] = ...): - ... - -def do_indent(s, width: int = ..., indentfirst: bool = ...): - ... - -def do_truncate(s, length: int = ..., killwords: bool = ..., end: str = ...): - ... - -def do_wordwrap(environment, s, width: int = ..., break_long_words: bool = ..., wrapstring: Optional[Any] = ...): - ... - -def do_wordcount(s): - ... - -def do_int(value, default: int = ..., base: int = ...): - ... - -def do_float(value, default: float = ...): - ... - -def do_format(value, *args, **kwargs): - ... - -def do_trim(value): - ... - -def do_striptags(value): - ... - -def do_slice(value, slices, fill_with: Optional[Any] = ...): - ... - -def do_batch(value, linecount, fill_with: Optional[Any] = ...): - ... - -def do_round(value, precision: int = ..., method: str = ...): - ... - -def do_groupby(environment, value, attribute): - ... - -class _GroupTuple(NamedTuple): - grouper: Any - list: Any - ... - - -def do_sum(environment, iterable, attribute: Optional[Any] = ..., start: int = ...): - ... - -def do_list(value): - ... - -def do_mark_safe(value): - ... - -def do_mark_unsafe(value): - ... - -def do_reverse(value): - ... - -def do_attr(environment, obj, name): - ... - -def do_map(*args, **kwargs): - ... - -def do_select(*args, **kwargs): - ... - -def do_reject(*args, **kwargs): - ... - -def do_selectattr(*args, **kwargs): - ... - -def do_rejectattr(*args, **kwargs): - ... - -FILTERS: Any diff --git a/manager/typings/jinja2/lexer.pyi b/manager/typings/jinja2/lexer.pyi deleted file mode 100644 index 08f5f9419..000000000 --- a/manager/typings/jinja2/lexer.pyi +++ /dev/null @@ -1,180 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -from typing import Any, Optional, Tuple - -""" -This type stub file was generated by pyright. -""" -whitespace_re: Any -string_re: Any -integer_re: Any -name_re: Any -float_re: Any -newline_re: Any -TOKEN_ADD: Any -TOKEN_ASSIGN: Any -TOKEN_COLON: Any -TOKEN_COMMA: Any -TOKEN_DIV: Any -TOKEN_DOT: Any -TOKEN_EQ: Any -TOKEN_FLOORDIV: Any -TOKEN_GT: Any -TOKEN_GTEQ: Any -TOKEN_LBRACE: Any -TOKEN_LBRACKET: Any -TOKEN_LPAREN: Any -TOKEN_LT: Any -TOKEN_LTEQ: Any -TOKEN_MOD: Any -TOKEN_MUL: Any -TOKEN_NE: Any -TOKEN_PIPE: Any -TOKEN_POW: Any -TOKEN_RBRACE: Any -TOKEN_RBRACKET: Any -TOKEN_RPAREN: Any -TOKEN_SEMICOLON: Any -TOKEN_SUB: Any -TOKEN_TILDE: Any -TOKEN_WHITESPACE: Any -TOKEN_FLOAT: Any -TOKEN_INTEGER: Any -TOKEN_NAME: Any -TOKEN_STRING: Any -TOKEN_OPERATOR: Any -TOKEN_BLOCK_BEGIN: Any -TOKEN_BLOCK_END: Any -TOKEN_VARIABLE_BEGIN: Any -TOKEN_VARIABLE_END: Any -TOKEN_RAW_BEGIN: Any -TOKEN_RAW_END: Any -TOKEN_COMMENT_BEGIN: Any -TOKEN_COMMENT_END: Any -TOKEN_COMMENT: Any -TOKEN_LINESTATEMENT_BEGIN: Any -TOKEN_LINESTATEMENT_END: Any -TOKEN_LINECOMMENT_BEGIN: Any -TOKEN_LINECOMMENT_END: Any -TOKEN_LINECOMMENT: Any -TOKEN_DATA: Any -TOKEN_INITIAL: Any -TOKEN_EOF: Any -operators: Any -reverse_operators: Any -operator_re: Any -ignored_tokens: Any -ignore_if_empty: Any -def describe_token(token): - ... - -def describe_token_expr(expr): - ... - -def count_newlines(value): - ... - -def compile_rules(environment): - ... - -class Failure: - message: Any - error_class: Any - def __init__(self, message, cls: Any = ...) -> None: - ... - - def __call__(self, lineno, filename): - ... - - - -class Token(Tuple[int, Any, Any]): - lineno: Any - type: Any - value: Any - def __new__(cls, lineno, type, value): - ... - - def test(self, expr): - ... - - def test_any(self, *iterable): - ... - - - -class TokenStreamIterator: - stream: Any - def __init__(self, stream) -> None: - ... - - def __iter__(self): - ... - - def __next__(self): - ... - - - -class TokenStream: - name: Any - filename: Any - closed: bool - current: Any - def __init__(self, generator, name, filename) -> None: - ... - - def __iter__(self): - ... - - def __bool__(self): - ... - - __nonzero__: Any - eos: Any - def push(self, token): - ... - - def look(self): - ... - - def skip(self, n: int = ...): - ... - - def next_if(self, expr): - ... - - def skip_if(self, expr): - ... - - def __next__(self): - ... - - def close(self): - ... - - def expect(self, expr): - ... - - - -def get_lexer(environment): - ... - -class Lexer: - newline_sequence: Any - keep_trailing_newline: Any - rules: Any - def __init__(self, environment) -> None: - ... - - def tokenize(self, source, name: Optional[Any] = ..., filename: Optional[Any] = ..., state: Optional[Any] = ...): - ... - - def wrap(self, stream, name: Optional[Any] = ..., filename: Optional[Any] = ...): - ... - - def tokeniter(self, source, name, filename: Optional[Any] = ..., state: Optional[Any] = ...): - ... diff --git a/manager/typings/jinja2/loaders.pyi b/manager/typings/jinja2/loaders.pyi deleted file mode 100644 index a0d660bc7..000000000 --- a/manager/typings/jinja2/loaders.pyi +++ /dev/null @@ -1,145 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -import sys -from types import ModuleType -from typing import Any, Callable, Iterable, List, Optional, Text, Tuple, Union - -from .environment import Environment - -""" -This type stub file was generated by pyright. -""" -if sys.version_info >= (3, 7): - ... -else: - _SearchPath = Union[Text, Iterable[Text]] -def split_template_path(template: Text) -> List[Text]: - ... - -class BaseLoader: - has_source_access: bool - def get_source(self, environment, template): - ... - - def list_templates(self): - ... - - def load(self, environment, name, globals: Optional[Any] = ...): - ... - - - -class FileSystemLoader(BaseLoader): - searchpath: Text - encoding: Any - followlinks: Any - def __init__(self, searchpath: _SearchPath, encoding: Text = ..., followlinks: bool = ...) -> None: - ... - - def get_source(self, environment: Environment, template: Text) -> Tuple[Text, Text, Callable[..., Any]]: - ... - - def list_templates(self): - ... - - - -class PackageLoader(BaseLoader): - encoding: Text - manager: Any - filesystem_bound: Any - provider: Any - package_path: Any - def __init__(self, package_name: Text, package_path: Text = ..., encoding: Text = ...) -> None: - ... - - def get_source(self, environment: Environment, template: Text) -> Tuple[Text, Text, Callable[..., Any]]: - ... - - def list_templates(self): - ... - - - -class DictLoader(BaseLoader): - mapping: Any - def __init__(self, mapping) -> None: - ... - - def get_source(self, environment: Environment, template: Text) -> Tuple[Text, Text, Callable[..., Any]]: - ... - - def list_templates(self): - ... - - - -class FunctionLoader(BaseLoader): - load_func: Any - def __init__(self, load_func) -> None: - ... - - def get_source(self, environment: Environment, template: Text) -> Tuple[Text, Optional[Text], Optional[Callable[..., Any]]]: - ... - - - -class PrefixLoader(BaseLoader): - mapping: Any - delimiter: Any - def __init__(self, mapping, delimiter: str = ...) -> None: - ... - - def get_loader(self, template): - ... - - def get_source(self, environment: Environment, template: Text) -> Tuple[Text, Text, Callable[..., Any]]: - ... - - def load(self, environment, name, globals: Optional[Any] = ...): - ... - - def list_templates(self): - ... - - - -class ChoiceLoader(BaseLoader): - loaders: Any - def __init__(self, loaders) -> None: - ... - - def get_source(self, environment: Environment, template: Text) -> Tuple[Text, Text, Callable[..., Any]]: - ... - - def load(self, environment, name, globals: Optional[Any] = ...): - ... - - def list_templates(self): - ... - - - -class _TemplateModule(ModuleType): - ... - - -class ModuleLoader(BaseLoader): - has_source_access: bool - module: Any - package_name: Any - def __init__(self, path) -> None: - ... - - @staticmethod - def get_template_key(name): - ... - - @staticmethod - def get_module_filename(name): - ... - - def load(self, environment, name, globals: Optional[Any] = ...): - ... diff --git a/manager/typings/jinja2/meta.pyi b/manager/typings/jinja2/meta.pyi deleted file mode 100644 index d5c6d663f..000000000 --- a/manager/typings/jinja2/meta.pyi +++ /dev/null @@ -1,29 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -from typing import Any - -from jinja2.compiler import CodeGenerator - -""" -This type stub file was generated by pyright. -""" -class TrackingCodeGenerator(CodeGenerator): - undeclared_identifiers: Any - def __init__(self, environment) -> None: - ... - - def write(self, x): - ... - - def pull_locals(self, frame): - ... - - - -def find_undeclared_variables(ast): - ... - -def find_referenced_templates(ast): - ... diff --git a/manager/typings/jinja2/nodes.pyi b/manager/typings/jinja2/nodes.pyi deleted file mode 100644 index 54859f61d..000000000 --- a/manager/typings/jinja2/nodes.pyi +++ /dev/null @@ -1,457 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -import typing -from typing import Any, Optional - -""" -This type stub file was generated by pyright. -""" -class Impossible(Exception): - ... - - -class NodeType(type): - def __new__(cls, name, bases, d): - ... - - - -class EvalContext: - environment: Any - autoescape: Any - volatile: bool - def __init__(self, environment, template_name: Optional[Any] = ...) -> None: - ... - - def save(self): - ... - - def revert(self, old): - ... - - - -def get_eval_context(node, ctx): - ... - -class Node: - fields: Any - attributes: Any - abstract: bool - def __init__(self, *fields, **attributes) -> None: - ... - - def iter_fields(self, exclude: Optional[Any] = ..., only: Optional[Any] = ...): - ... - - def iter_child_nodes(self, exclude: Optional[Any] = ..., only: Optional[Any] = ...): - ... - - def find(self, node_type): - ... - - def find_all(self, node_type): - ... - - def set_ctx(self, ctx): - ... - - def set_lineno(self, lineno, override: bool = ...): - ... - - def set_environment(self, environment): - ... - - def __eq__(self, other) -> bool: - ... - - def __ne__(self, other) -> bool: - ... - - __hash__: Any - - -class Stmt(Node): - abstract: bool - ... - - -class Helper(Node): - abstract: bool - ... - - -class Template(Node): - fields: Any - ... - - -class Output(Stmt): - fields: Any - ... - - -class Extends(Stmt): - fields: Any - ... - - -class For(Stmt): - fields: Any - ... - - -class If(Stmt): - fields: Any - ... - - -class Macro(Stmt): - fields: Any - name: str - args: typing.List[Any] - defaults: typing.List[Any] - body: typing.List[Any] - ... - - -class CallBlock(Stmt): - fields: Any - ... - - -class FilterBlock(Stmt): - fields: Any - ... - - -class Block(Stmt): - fields: Any - ... - - -class Include(Stmt): - fields: Any - ... - - -class Import(Stmt): - fields: Any - ... - - -class FromImport(Stmt): - fields: Any - ... - - -class ExprStmt(Stmt): - fields: Any - ... - - -class Assign(Stmt): - fields: Any - ... - - -class AssignBlock(Stmt): - fields: Any - ... - - -class Expr(Node): - abstract: bool - def as_const(self, eval_ctx: Optional[Any] = ...): - ... - - def can_assign(self): - ... - - - -class BinExpr(Expr): - fields: Any - operator: Any - abstract: bool - def as_const(self, eval_ctx: Optional[Any] = ...): - ... - - - -class UnaryExpr(Expr): - fields: Any - operator: Any - abstract: bool - def as_const(self, eval_ctx: Optional[Any] = ...): - ... - - - -class Name(Expr): - fields: Any - def can_assign(self): - ... - - - -class Literal(Expr): - abstract: bool - ... - - -class Const(Literal): - fields: Any - def as_const(self, eval_ctx: Optional[Any] = ...): - ... - - @classmethod - def from_untrusted(cls, value, lineno: Optional[Any] = ..., environment: Optional[Any] = ...): - ... - - - -class TemplateData(Literal): - fields: Any - def as_const(self, eval_ctx: Optional[Any] = ...): - ... - - - -class Tuple(Literal): - fields: Any - def as_const(self, eval_ctx: Optional[Any] = ...): - ... - - def can_assign(self): - ... - - - -class List(Literal): - fields: Any - def as_const(self, eval_ctx: Optional[Any] = ...): - ... - - - -class Dict(Literal): - fields: Any - def as_const(self, eval_ctx: Optional[Any] = ...): - ... - - - -class Pair(Helper): - fields: Any - def as_const(self, eval_ctx: Optional[Any] = ...): - ... - - - -class Keyword(Helper): - fields: Any - def as_const(self, eval_ctx: Optional[Any] = ...): - ... - - - -class CondExpr(Expr): - fields: Any - def as_const(self, eval_ctx: Optional[Any] = ...): - ... - - - -class Filter(Expr): - fields: Any - def as_const(self, eval_ctx: Optional[Any] = ...): - ... - - - -class Test(Expr): - fields: Any - ... - - -class Call(Expr): - fields: Any - def as_const(self, eval_ctx: Optional[Any] = ...): - ... - - - -class Getitem(Expr): - fields: Any - def as_const(self, eval_ctx: Optional[Any] = ...): - ... - - def can_assign(self): - ... - - - -class Getattr(Expr): - fields: Any - def as_const(self, eval_ctx: Optional[Any] = ...): - ... - - def can_assign(self): - ... - - - -class Slice(Expr): - fields: Any - def as_const(self, eval_ctx: Optional[Any] = ...): - ... - - - -class Concat(Expr): - fields: Any - def as_const(self, eval_ctx: Optional[Any] = ...): - ... - - - -class Compare(Expr): - fields: Any - def as_const(self, eval_ctx: Optional[Any] = ...): - ... - - - -class Operand(Helper): - fields: Any - ... - - -class Mul(BinExpr): - operator: str - ... - - -class Div(BinExpr): - operator: str - ... - - -class FloorDiv(BinExpr): - operator: str - ... - - -class Add(BinExpr): - operator: str - ... - - -class Sub(BinExpr): - operator: str - ... - - -class Mod(BinExpr): - operator: str - ... - - -class Pow(BinExpr): - operator: str - ... - - -class And(BinExpr): - operator: str - def as_const(self, eval_ctx: Optional[Any] = ...): - ... - - - -class Or(BinExpr): - operator: str - def as_const(self, eval_ctx: Optional[Any] = ...): - ... - - - -class Not(UnaryExpr): - operator: str - ... - - -class Neg(UnaryExpr): - operator: str - ... - - -class Pos(UnaryExpr): - operator: str - ... - - -class EnvironmentAttribute(Expr): - fields: Any - ... - - -class ExtensionAttribute(Expr): - fields: Any - ... - - -class ImportedName(Expr): - fields: Any - ... - - -class InternalName(Expr): - fields: Any - def __init__(self) -> None: - ... - - - -class MarkSafe(Expr): - fields: Any - def as_const(self, eval_ctx: Optional[Any] = ...): - ... - - - -class MarkSafeIfAutoescape(Expr): - fields: Any - def as_const(self, eval_ctx: Optional[Any] = ...): - ... - - - -class ContextReference(Expr): - ... - - -class Continue(Stmt): - ... - - -class Break(Stmt): - ... - - -class Scope(Stmt): - fields: Any - ... - - -class EvalContextModifier(Stmt): - fields: Any - ... - - -class ScopedEvalContextModifier(EvalContextModifier): - fields: Any - ... diff --git a/manager/typings/jinja2/optimizer.pyi b/manager/typings/jinja2/optimizer.pyi deleted file mode 100644 index f118f9a28..000000000 --- a/manager/typings/jinja2/optimizer.pyi +++ /dev/null @@ -1,44 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -from typing import Any - -from jinja2.visitor import NodeTransformer - -""" -This type stub file was generated by pyright. -""" -def optimize(node, environment): - ... - -class Optimizer(NodeTransformer): - environment: Any - def __init__(self, environment) -> None: - ... - - def visit_If(self, node): - ... - - def fold(self, node): - ... - - visit_Add: Any - visit_Sub: Any - visit_Mul: Any - visit_Div: Any - visit_FloorDiv: Any - visit_Pow: Any - visit_Mod: Any - visit_And: Any - visit_Or: Any - visit_Pos: Any - visit_Neg: Any - visit_Not: Any - visit_Compare: Any - visit_Getitem: Any - visit_Getattr: Any - visit_Call: Any - visit_Filter: Any - visit_Test: Any - visit_CondExpr: Any diff --git a/manager/typings/jinja2/parser.pyi b/manager/typings/jinja2/parser.pyi deleted file mode 100644 index 5ce300444..000000000 --- a/manager/typings/jinja2/parser.pyi +++ /dev/null @@ -1,168 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -from typing import Any, Optional - -""" -This type stub file was generated by pyright. -""" -class Parser: - environment: Any - stream: Any - name: Any - filename: Any - closed: bool - extensions: Any - def __init__(self, environment, source, name: Optional[Any] = ..., filename: Optional[Any] = ..., state: Optional[Any] = ...) -> None: - ... - - def fail(self, msg, lineno: Optional[Any] = ..., exc: Any = ...): - ... - - def fail_unknown_tag(self, name, lineno: Optional[Any] = ...): - ... - - def fail_eof(self, end_tokens: Optional[Any] = ..., lineno: Optional[Any] = ...): - ... - - def is_tuple_end(self, extra_end_rules: Optional[Any] = ...): - ... - - def free_identifier(self, lineno: Optional[Any] = ...): - ... - - def parse_statement(self): - ... - - def parse_statements(self, end_tokens, drop_needle: bool = ...): - ... - - def parse_set(self): - ... - - def parse_for(self): - ... - - def parse_if(self): - ... - - def parse_block(self): - ... - - def parse_extends(self): - ... - - def parse_import_context(self, node, default): - ... - - def parse_include(self): - ... - - def parse_import(self): - ... - - def parse_from(self): - ... - - def parse_signature(self, node): - ... - - def parse_call_block(self): - ... - - def parse_filter_block(self): - ... - - def parse_macro(self): - ... - - def parse_print(self): - ... - - def parse_assign_target(self, with_tuple: bool = ..., name_only: bool = ..., extra_end_rules: Optional[Any] = ...): - ... - - def parse_expression(self, with_condexpr: bool = ...): - ... - - def parse_condexpr(self): - ... - - def parse_or(self): - ... - - def parse_and(self): - ... - - def parse_not(self): - ... - - def parse_compare(self): - ... - - def parse_add(self): - ... - - def parse_sub(self): - ... - - def parse_concat(self): - ... - - def parse_mul(self): - ... - - def parse_div(self): - ... - - def parse_floordiv(self): - ... - - def parse_mod(self): - ... - - def parse_pow(self): - ... - - def parse_unary(self, with_filter: bool = ...): - ... - - def parse_primary(self): - ... - - def parse_tuple(self, simplified: bool = ..., with_condexpr: bool = ..., extra_end_rules: Optional[Any] = ..., explicit_parentheses: bool = ...): - ... - - def parse_list(self): - ... - - def parse_dict(self): - ... - - def parse_postfix(self, node): - ... - - def parse_filter_expr(self, node): - ... - - def parse_subscript(self, node): - ... - - def parse_subscribed(self): - ... - - def parse_call(self, node): - ... - - def parse_filter(self, node, start_inline: bool = ...): - ... - - def parse_test(self, node): - ... - - def subparse(self, end_tokens: Optional[Any] = ...): - ... - - def parse(self): - ... diff --git a/manager/typings/jinja2/runtime.pyi b/manager/typings/jinja2/runtime.pyi deleted file mode 100644 index 0ed45eeca..000000000 --- a/manager/typings/jinja2/runtime.pyi +++ /dev/null @@ -1,216 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -from typing import Any, Dict, Optional, Text, Union - -from jinja2.environment import Environment - -""" -This type stub file was generated by pyright. -""" -to_string: Any -identity: Any -def markup_join(seq): - ... - -def unicode_join(seq): - ... - -class TemplateReference: - def __init__(self, context) -> None: - ... - - def __getitem__(self, name): - ... - - - -class Context: - parent: Union[Context, Dict[str, Any]] - vars: Dict[str, Any] - environment: Environment - eval_ctx: Any - exported_vars: Any - name: Text - blocks: Dict[str, Any] - def __init__(self, environment: Environment, parent: Union[Context, Dict[str, Any]], name: Text, blocks: Dict[str, Any]) -> None: - ... - - def super(self, name, current): - ... - - def get(self, key, default: Optional[Any] = ...): - ... - - def resolve(self, key): - ... - - def get_exported(self): - ... - - def get_all(self): - ... - - def call(__self, __obj, *args, **kwargs): - ... - - def derived(self, locals: Optional[Any] = ...): - ... - - keys: Any - values: Any - items: Any - iterkeys: Any - itervalues: Any - iteritems: Any - def __contains__(self, name): - ... - - def __getitem__(self, key): - ... - - - -class BlockReference: - name: Any - def __init__(self, name, context, stack, depth) -> None: - ... - - @property - def super(self): - ... - - def __call__(self): - ... - - - -class LoopContext: - index0: int - depth0: Any - def __init__(self, iterable, recurse: Optional[Any] = ..., depth0: int = ...) -> None: - ... - - def cycle(self, *args): - ... - - first: Any - last: Any - index: Any - revindex: Any - revindex0: Any - depth: Any - def __len__(self): - ... - - def __iter__(self): - ... - - def loop(self, iterable): - ... - - __call__: Any - @property - def length(self): - ... - - - -class LoopContextIterator: - context: Any - def __init__(self, context) -> None: - ... - - def __iter__(self): - ... - - def __next__(self): - ... - - - -class Macro: - name: Any - arguments: Any - defaults: Any - catch_kwargs: Any - catch_varargs: Any - caller: Any - def __init__(self, environment, func, name, arguments, defaults, catch_kwargs, catch_varargs, caller) -> None: - ... - - def __call__(self, *args, **kwargs): - ... - - - -class Undefined: - def __init__(self, hint: Optional[Any] = ..., obj: Any = ..., name: Optional[Any] = ..., exc: Any = ...) -> None: - ... - - def __getattr__(self, name): - ... - - __add__: Any - __radd__: Any - __mul__: Any - __rmul__: Any - __div__: Any - __rdiv__: Any - __truediv__: Any - __rtruediv__: Any - __floordiv__: Any - __rfloordiv__: Any - __mod__: Any - __rmod__: Any - __pos__: Any - __neg__: Any - __call__: Any - __getitem__: Any - __lt__: Any - __le__: Any - __gt__: Any - __ge__: Any - __int__: Any - __float__: Any - __complex__: Any - __pow__: Any - __rpow__: Any - def __eq__(self, other) -> bool: - ... - - def __ne__(self, other) -> bool: - ... - - def __hash__(self) -> int: - ... - - def __len__(self): - ... - - def __iter__(self): - ... - - def __nonzero__(self): - ... - - __bool__: Any - - -def make_logging_undefined(logger: Optional[Any] = ..., base: Optional[Any] = ...): - ... - -class DebugUndefined(Undefined): - ... - - -class StrictUndefined(Undefined): - __iter__: Any - __len__: Any - __nonzero__: Any - __eq__: Any - __ne__: Any - __bool__: Any - __hash__: Any - ... diff --git a/manager/typings/jinja2/sandbox.pyi b/manager/typings/jinja2/sandbox.pyi deleted file mode 100644 index 1940479c9..000000000 --- a/manager/typings/jinja2/sandbox.pyi +++ /dev/null @@ -1,70 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -from typing import Any - -from jinja2.environment import Environment - -""" -This type stub file was generated by pyright. -""" -MAX_RANGE: int -UNSAFE_FUNCTION_ATTRIBUTES: Any -UNSAFE_METHOD_ATTRIBUTES: Any -UNSAFE_GENERATOR_ATTRIBUTES: Any -def safe_range(*args): - ... - -def unsafe(f): - ... - -def is_internal_attribute(obj, attr): - ... - -def modifies_known_mutable(obj, attr): - ... - -class SandboxedEnvironment(Environment): - sandboxed: bool - default_binop_table: Any - default_unop_table: Any - intercepted_binops: Any - intercepted_unops: Any - def intercept_unop(self, operator): - ... - - binop_table: Any - unop_table: Any - def __init__(self, *args, **kwargs) -> None: - ... - - def is_safe_attribute(self, obj, attr, value): - ... - - def is_safe_callable(self, obj): - ... - - def call_binop(self, context, operator, left, right): - ... - - def call_unop(self, context, operator, arg): - ... - - def getitem(self, obj, argument): - ... - - def getattr(self, obj, attribute): - ... - - def unsafe_undefined(self, obj, attribute): - ... - - def call(__self, __context, __obj, *args, **kwargs): - ... - - - -class ImmutableSandboxedEnvironment(SandboxedEnvironment): - def is_safe_attribute(self, obj, attr, value): - ... diff --git a/manager/typings/jinja2/tests.pyi b/manager/typings/jinja2/tests.pyi deleted file mode 100644 index 3a7139a2f..000000000 --- a/manager/typings/jinja2/tests.pyi +++ /dev/null @@ -1,61 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -from typing import Any - -""" -This type stub file was generated by pyright. -""" -number_re: Any -regex_type: Any -test_callable: Any -def test_odd(value): - ... - -def test_even(value): - ... - -def test_divisibleby(value, num): - ... - -def test_defined(value): - ... - -def test_undefined(value): - ... - -def test_none(value): - ... - -def test_lower(value): - ... - -def test_upper(value): - ... - -def test_string(value): - ... - -def test_mapping(value): - ... - -def test_number(value): - ... - -def test_sequence(value): - ... - -def test_equalto(value, other): - ... - -def test_sameas(value, other): - ... - -def test_iterable(value): - ... - -def test_escaped(value): - ... - -TESTS: Any diff --git a/manager/typings/jinja2/utils.pyi b/manager/typings/jinja2/utils.pyi deleted file mode 100644 index 9f971a2b2..000000000 --- a/manager/typings/jinja2/utils.pyi +++ /dev/null @@ -1,166 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -from typing import IO, Any, Callable, Iterable, Optional, Protocol, Text, Union - -from _typeshed import AnyPath -from markupsafe import Markup as Markup -from typing_extensions import Literal - -""" -This type stub file was generated by pyright. -""" -missing: Any -internal_code: Any -concat: Any -_CallableT = ... -class _ContextFunction(Protocol[_CallableT]): - contextfunction: Literal[True] - __call__: _CallableT - ... - - -class _EvalContextFunction(Protocol[_CallableT]): - evalcontextfunction: Literal[True] - __call__: _CallableT - ... - - -class _EnvironmentFunction(Protocol[_CallableT]): - environmentfunction: Literal[True] - __call__: _CallableT - ... - - -def contextfunction(f: _CallableT) -> _ContextFunction[_CallableT]: - ... - -def evalcontextfunction(f: _CallableT) -> _EvalContextFunction[_CallableT]: - ... - -def environmentfunction(f: _CallableT) -> _EnvironmentFunction[_CallableT]: - ... - -def internalcode(f: _CallableT) -> _CallableT: - ... - -def is_undefined(obj: object) -> bool: - ... - -def select_autoescape(enabled_extensions: Iterable[str] = ..., disabled_extensions: Iterable[str] = ..., default_for_string: bool = ..., default: bool = ...) -> Callable[[str], bool]: - ... - -def consume(iterable: Iterable[object]) -> None: - ... - -def clear_caches() -> None: - ... - -def import_string(import_name: str, silent: bool = ...) -> Any: - ... - -def open_if_exists(filename: AnyPath, mode: str = ...) -> Optional[IO[Any]]: - ... - -def object_type_repr(obj: object) -> str: - ... - -def pformat(obj: object, verbose: bool = ...) -> str: - ... - -def urlize(text: Union[Markup, Text], trim_url_limit: Optional[int] = ..., rel: Optional[Union[Markup, Text]] = ..., target: Optional[Union[Markup, Text]] = ...) -> str: - ... - -def generate_lorem_ipsum(n: int = ..., html: bool = ..., min: int = ..., max: int = ...) -> Union[Markup, str]: - ... - -def unicode_urlencode(obj: object, charset: str = ..., for_qs: bool = ...) -> str: - ... - -class LRUCache: - capacity: Any - def __init__(self, capacity) -> None: - ... - - def __getnewargs__(self): - ... - - def copy(self): - ... - - def get(self, key, default: Optional[Any] = ...): - ... - - def setdefault(self, key, default: Optional[Any] = ...): - ... - - def clear(self): - ... - - def __contains__(self, key): - ... - - def __len__(self): - ... - - def __getitem__(self, key): - ... - - def __setitem__(self, key, value): - ... - - def __delitem__(self, key): - ... - - def items(self): - ... - - def iteritems(self): - ... - - def values(self): - ... - - def itervalue(self): - ... - - def keys(self): - ... - - def iterkeys(self): - ... - - __iter__: Any - def __reversed__(self): - ... - - __copy__: Any - - -class Cycler: - items: Any - def __init__(self, *items) -> None: - ... - - pos: int - def reset(self): - ... - - @property - def current(self): - ... - - def __next__(self): - ... - - - -class Joiner: - sep: Any - used: bool - def __init__(self, sep: str = ...) -> None: - ... - - def __call__(self): - ... diff --git a/manager/typings/jinja2/visitor.pyi b/manager/typings/jinja2/visitor.pyi deleted file mode 100644 index 963062797..000000000 --- a/manager/typings/jinja2/visitor.pyi +++ /dev/null @@ -1,25 +0,0 @@ -""" -This type stub file was generated by pyright. -""" - -""" -This type stub file was generated by pyright. -""" -class NodeVisitor: - def get_visitor(self, node): - ... - - def visit(self, node, *args, **kwargs): - ... - - def generic_visit(self, node, *args, **kwargs): - ... - - - -class NodeTransformer(NodeVisitor): - def generic_visit(self, node, *args, **kwargs): - ... - - def visit_list(self, node, *args, **kwargs): - ...