Skip to content

Commit

Permalink
[TIDY FIRST] Fix type hinting of mashumaro/core/meta/helpers.pyi (#184
Browse files Browse the repository at this point in the history
)

* Fix all typing issues in `third-party-stubs/mashumaro/core/meta/helpers.py` with liberal use of `Any`

* Update `helpers.pyi` to no longer import all of `typing`

* Fixup linting of mashumaro helper stubs
  • Loading branch information
QMalcolm authored Aug 16, 2024
1 parent c9cc99e commit 3521bd8
Showing 1 changed file with 59 additions and 47 deletions.
106 changes: 59 additions & 47 deletions third-party-stubs/mashumaro/core/meta/helpers.pyi
Original file line number Diff line number Diff line change
@@ -1,58 +1,70 @@
import typing
from typing import Any, Dict, Optional, Sequence, Tuple, Type
from typing import (
Any,
Callable,
Dict,
Iterable,
Iterator,
Optional,
Sequence,
Tuple,
Type,
)

def get_type_origin(typ: Type) -> Type: ...
def get_generic_name(typ: Type, short: bool = ...) -> str: ...
def get_args(typ: Optional[Type]) -> Tuple[Type, ...]: ...
def get_literal_values(typ: Type) -> Tuple[Any, ...]: ...
def get_type_origin(typ: Type[Any]) -> Type[Any]: ...
def get_generic_name(typ: Type[Any], short: bool = ...) -> str: ...
def get_args(typ: Optional[Type[Any]]) -> Tuple[Type[Any], ...]: ...
def get_literal_values(typ: Type[Any]) -> Tuple[Any, ...]: ...
def type_name(
typ: Optional[Type],
typ: Optional[Type[Any]],
short: bool = ...,
resolved_type_params: Optional[Dict[Type, Type]] = ...,
resolved_type_params: Optional[Dict[Type[Any], Type[Any]]] = ...,
is_type_origin: bool = ...,
none_type_as_none: bool = ...,
) -> str: ...
def is_special_typing_primitive(typ: Any) -> bool: ...
def is_generic(typ: Type) -> bool: ...
def is_typed_dict(typ: Type) -> bool: ...
def is_named_tuple(typ: Type) -> bool: ...
def is_new_type(typ: Type) -> bool: ...
def is_union(typ: Type) -> bool: ...
def is_optional(typ: Type, resolved_type_params: Optional[Dict[Type, Type]] = ...) -> bool: ...
def is_annotated(typ: Type) -> bool: ...
def get_type_annotations(typ: Type) -> Sequence[Any]: ...
def is_literal(typ: Type) -> bool: ...
def is_generic(typ: Type[Any]) -> bool: ...
def is_typed_dict(typ: Type[Any]) -> bool: ...
def is_named_tuple(typ: Type[Any]) -> bool: ...
def is_new_type(typ: Type[Any]) -> bool: ...
def is_union(typ: Type[Any]) -> bool: ...
def is_optional(
typ: Type[Any], resolved_type_params: Optional[Dict[Type[Any], Type[Any]]] = ...
) -> bool: ...
def is_annotated(typ: Type[Any]) -> bool: ...
def get_type_annotations(typ: Type[Any]) -> Sequence[Any]: ...
def is_literal(typ: Type[Any]) -> bool: ...
def not_none_type_arg(
type_args: Tuple[Type, ...], resolved_type_params: Optional[Dict[Type, Type]] = ...
) -> Optional[Type]: ...
def is_type_var(typ: Type) -> bool: ...
def is_type_var_any(typ: Type) -> bool: ...
def is_class_var(typ: Type) -> bool: ...
def is_final(typ: Type) -> bool: ...
def is_init_var(typ: Type) -> bool: ...
def get_class_that_defines_method(method_name: str, cls: Type) -> Optional[Type]: ...
def get_class_that_defines_field(field_name: str, cls: Type) -> Optional[Type]: ...
def is_dataclass_dict_mixin(typ: Type) -> bool: ...
def is_dataclass_dict_mixin_subclass(typ: Type) -> bool: ...
def collect_type_params(typ: Type) -> Sequence[Type]: ...
type_args: Tuple[Type[Any], ...],
resolved_type_params: Optional[Dict[Type[Any], Type[Any]]] = ...,
) -> Optional[Type[Any]]: ...
def is_type_var(typ: Type[Any]) -> bool: ...
def is_type_var_any(typ: Type[Any]) -> bool: ...
def is_class_var(typ: Type[Any]) -> bool: ...
def is_final(typ: Type[Any]) -> bool: ...
def is_init_var(typ: Type[Any]) -> bool: ...
def get_class_that_defines_method(method_name: str, cls: Type[Any]) -> Optional[Type[Any]]: ...
def get_class_that_defines_field(field_name: str, cls: Type[Any]) -> Optional[Type[Any]]: ...
def is_dataclass_dict_mixin(typ: Type[Any]) -> bool: ...
def is_dataclass_dict_mixin_subclass(typ: Type[Any]) -> bool: ...
def collect_type_params(typ: Type[Any]) -> Sequence[Type[Any]]: ...
def resolve_type_params(
typ: Type, type_args: Sequence[Type] = ..., include_bases: bool = ...
) -> Dict[Type, Dict[Type, Type]]: ...
def substitute_type_params(typ: Type, substitutions: Dict[Type, Type]) -> Type: ...
typ: Type[Any], type_args: Sequence[Type[Any]] = ..., include_bases: bool = ...
) -> Dict[Type[Any], Dict[Type[Any], Type[Any]]]: ...
def substitute_type_params(
typ: Type[Any], substitutions: Dict[Type[Any], Type[Any]]
) -> Type[Any]: ...
def get_name_error_name(e: NameError) -> str: ...
def is_dialect_subclass(typ: Type) -> bool: ...
def is_self(typ: Type) -> bool: ...
def is_required(typ: Type) -> bool: ...
def is_not_required(typ: Type) -> bool: ...
def is_dialect_subclass(typ: Type[Any]) -> bool: ...
def is_self(typ: Type[Any]) -> bool: ...
def is_required(typ: Type[Any]) -> bool: ...
def is_not_required(typ: Type[Any]) -> bool: ...
def get_function_arg_annotation(
function: typing.Callable[[Any], Any],
arg_name: typing.Optional[str] = ...,
arg_pos: typing.Optional[int] = ...,
) -> typing.Type: ...
def get_function_return_annotation(
function: typing.Callable[[typing.Any], typing.Any]
) -> typing.Type: ...
def is_unpack(typ: Type) -> bool: ...
def is_type_var_tuple(typ: Type) -> bool: ...
def hash_type_args(type_args: typing.Iterable[typing.Type]) -> str: ...
def iter_all_subclasses(cls) -> typing.Iterator[Type]: ...
function: Callable[[Any], Any],
arg_name: Optional[str] = ...,
arg_pos: Optional[int] = ...,
) -> Type[Any]: ...
def get_function_return_annotation(function: Callable[[Any], Any]) -> Type[Any]: ...
def is_unpack(typ: Type[Any]) -> bool: ...
def is_type_var_tuple(typ: Type[Any]) -> bool: ...
def hash_type_args(type_args: Iterable[Type[Any]]) -> str: ...
def iter_all_subclasses(cls: Type[Any]) -> Iterator[Type[Any]]: ...

0 comments on commit 3521bd8

Please sign in to comment.