-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bump mashumaro from 2.9 to 3.0.3 in /core (#5118)
* add pyyaml as a setup requirement
- Loading branch information
Showing
32 changed files
with
361 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
kind: Under the Hood | ||
body: Update mashumaro to 3.0.3 | ||
time: 2022-07-20T11:52:26.210876-04:00 | ||
custom: | ||
Author: gshank | ||
Issue: "4940" | ||
PR: "5118" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
from mashumaro.exceptions import MissingField as MissingField | ||
from mashumaro.serializer.base.dict import DataClassDictMixin as DataClassDictMixin | ||
from mashumaro.serializer.json import DataClassJSONMixin as DataClassJSONMixin | ||
from mashumaro.serializer.msgpack import DataClassMessagePackMixin as DataClassMessagePackMixin | ||
from mashumaro.serializer.yaml import DataClassYAMLMixin as DataClassYAMLMixin | ||
from mashumaro.helper import field_options as field_options, pass_through as pass_through | ||
from mashumaro.mixins.dict import DataClassDictMixin as DataClassDictMixin | ||
from mashumaro.mixins.msgpack import DataClassMessagePackMixin as DataClassMessagePackMixin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,31 @@ | ||
from mashumaro.types import SerializationStrategy as SerializationStrategy | ||
from typing import Any, Callable, Dict, List, Union | ||
from mashumaro.dialect import Dialect | ||
from mashumaro.types import SerializationStrategy | ||
from typing import Any, Callable, Dict, List, Optional, Type, Union | ||
from mashumaro.core.const import PEP_586_COMPATIBLE | ||
|
||
if PEP_586_COMPATIBLE: | ||
from typing import Literal # type: ignore | ||
else: | ||
from typing_extensions import Literal # type: ignore | ||
|
||
TO_DICT_ADD_BY_ALIAS_FLAG: str | ||
TO_DICT_ADD_OMIT_NONE_FLAG: str | ||
ADD_DIALECT_SUPPORT: str | ||
|
||
CodeGenerationOption = Literal[ | ||
"TO_DICT_ADD_BY_ALIAS_FLAG", | ||
"TO_DICT_ADD_OMIT_NONE_FLAG", | ||
"ADD_DIALECT_SUPPORT", | ||
] | ||
|
||
SerializationStrategyValueType = Union[SerializationStrategy, Dict[str, Union[str, Callable]]] | ||
|
||
class BaseConfig: | ||
debug: bool = ... | ||
code_generation_options: List[str] = ... | ||
serialization_strategy: Dict[Any, SerializationStrategyValueType] = ... | ||
aliases: Dict[str, str] = ... | ||
serialize_by_alias: bool = ... | ||
namedtuple_as_dict: bool = ... | ||
allow_postponed_evaluation: bool = ... | ||
dialect: Optional[Type[Dialect]] = ... |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from typing import Any | ||
|
||
PY_36: Any | ||
PY_37: Any | ||
PY_38: Any | ||
PY_39: Any | ||
PY_310: Any | ||
PY_37_MIN: Any | ||
PY_38_MIN: Any | ||
PY_39_MIN: Any | ||
PY_310_MIN = PY_310 | ||
PEP_585_COMPATIBLE = PY_39_MIN | ||
PEP_586_COMPATIBLE = PY_38_MIN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import datetime | ||
|
||
def parse_timezone(s: str) -> datetime.timezone: ... |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
from mashumaro.core.helpers import * | ||
import types | ||
import typing | ||
from base64 import decodebytes as decodebytes, encodebytes as encodebytes | ||
from dataclasses import Field | ||
from mashumaro.config import ( | ||
ADD_DIALECT_SUPPORT as ADD_DIALECT_SUPPORT, | ||
BaseConfig as BaseConfig, | ||
TO_DICT_ADD_BY_ALIAS_FLAG as TO_DICT_ADD_BY_ALIAS_FLAG, | ||
TO_DICT_ADD_OMIT_NONE_FLAG as TO_DICT_ADD_OMIT_NONE_FLAG, | ||
) | ||
from mashumaro.core.const import PY_39_MIN as PY_39_MIN | ||
from mashumaro.core.meta.helpers import ( | ||
get_args as get_args, | ||
get_class_that_defines_field as get_class_that_defines_field, | ||
get_class_that_defines_method as get_class_that_defines_method, | ||
get_literal_values as get_literal_values, | ||
get_name_error_name as get_name_error_name, | ||
get_type_origin as get_type_origin, | ||
is_class_var as is_class_var, | ||
is_dataclass_dict_mixin as is_dataclass_dict_mixin, | ||
is_dataclass_dict_mixin_subclass as is_dataclass_dict_mixin_subclass, | ||
is_dialect_subclass as is_dialect_subclass, | ||
is_generic as is_generic, | ||
is_init_var as is_init_var, | ||
is_literal as is_literal, | ||
is_named_tuple as is_named_tuple, | ||
is_new_type as is_new_type, | ||
is_optional as is_optional, | ||
is_special_typing_primitive as is_special_typing_primitive, | ||
is_type_var as is_type_var, | ||
is_type_var_any as is_type_var_any, | ||
is_typed_dict as is_typed_dict, | ||
is_union as is_union, | ||
not_none_type_arg as not_none_type_arg, | ||
resolve_type_vars as resolve_type_vars, | ||
type_name as type_name, | ||
) | ||
from mashumaro.core.meta.patch import patch_fromisoformat as patch_fromisoformat | ||
from mashumaro.dialect import Dialect as Dialect | ||
from mashumaro.exceptions import ( | ||
BadDialect as BadDialect, | ||
BadHookSignature as BadHookSignature, | ||
InvalidFieldValue as InvalidFieldValue, | ||
MissingField as MissingField, | ||
ThirdPartyModuleNotFoundError as ThirdPartyModuleNotFoundError, | ||
UnresolvedTypeReferenceError as UnresolvedTypeReferenceError, | ||
UnserializableDataError as UnserializableDataError, | ||
UnserializableField as UnserializableField, | ||
UnsupportedDeserializationEngine as UnsupportedDeserializationEngine, | ||
UnsupportedSerializationEngine as UnsupportedSerializationEngine, | ||
) | ||
from mashumaro.helper import pass_through as pass_through | ||
from mashumaro.types import ( | ||
GenericSerializableType as GenericSerializableType, | ||
SerializableType as SerializableType, | ||
SerializationStrategy as SerializationStrategy, | ||
) | ||
from typing import Any | ||
|
||
NoneType: Any | ||
__PRE_SERIALIZE__: str | ||
__PRE_DESERIALIZE__: str | ||
__POST_SERIALIZE__: str | ||
__POST_DESERIALIZE__: str | ||
|
||
class CodeLines: | ||
def __init__(self) -> None: ... | ||
def append(self, line: str) -> None: ... | ||
def indent(self) -> typing.Generator[None, None, None]: ... | ||
def as_text(self) -> str: ... | ||
def reset(self) -> None: ... | ||
|
||
class CodeBuilder: | ||
cls: Any = ... | ||
lines: Any = ... | ||
globals: Any = ... | ||
type_vars: Any = ... | ||
field_classes: Any = ... | ||
initial_arg_types: Any = ... | ||
dialect: Any = ... | ||
allow_postponed_evaluation: Any = ... | ||
def __init__( | ||
self, | ||
cls: Any, | ||
arg_types: typing.Tuple = ..., | ||
dialect: typing.Optional[typing.Type[Dialect]] = ..., | ||
first_method: str = ..., | ||
allow_postponed_evaluation: bool = ..., | ||
) -> None: ... | ||
def reset(self) -> None: ... | ||
@property | ||
def namespace(self) -> typing.Dict[typing.Any, typing.Any]: ... | ||
@property | ||
def annotations(self) -> typing.Dict[str, typing.Any]: ... | ||
@property | ||
def field_types(self) -> typing.Dict[str, typing.Any]: ... | ||
@property | ||
def dataclass_fields(self) -> typing.Dict[str, Field]: ... | ||
@property | ||
def metadatas(self) -> typing.Dict[str, typing.Mapping[str, typing.Any]]: ... | ||
def get_field_default(self, name: str) -> typing.Any: ... | ||
def ensure_module_imported(self, module: types.ModuleType) -> None: ... | ||
def add_line(self, line: str) -> None: ... | ||
def indent(self) -> typing.Generator[None, None, None]: ... | ||
def compile(self) -> None: ... | ||
def get_declared_hook(self, method_name: str) -> typing.Any: ... | ||
def add_from_dict(self) -> None: ... | ||
def get_config(self, cls: Any = ...) -> typing.Type[BaseConfig]: ... | ||
def get_to_dict_flags(self, cls: Any = ...) -> str: ... | ||
def get_from_dict_flags(self, cls: Any = ...) -> str: ... | ||
def get_to_dict_default_flag_values(self, cls: Any = ...) -> str: ... | ||
def get_from_dict_default_flag_values(self, cls: Any = ...) -> str: ... | ||
def is_code_generation_option_enabled(self, option: str, cls: Any = ...) -> bool: ... | ||
def add_to_dict(self) -> None: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import typing | ||
from typing import Any | ||
|
||
def get_type_origin(t: Any): ... | ||
def get_generic_name(t: Any, short: bool = ...) -> str: ... | ||
def get_args(t: typing.Any) -> typing.Tuple[typing.Any, ...]: ... | ||
def get_literal_values(t: typing.Any) -> Any: ... | ||
def type_name( | ||
t: typing.Any, | ||
short: bool = ..., | ||
type_vars: typing.Dict[str, typing.Any] = ..., | ||
is_type_origin: bool = ..., | ||
none_type_as_none: bool = ..., | ||
) -> str: ... | ||
def is_special_typing_primitive(t: Any) -> bool: ... | ||
def is_generic(t: Any): ... | ||
def is_typed_dict(t: Any) -> bool: ... | ||
def is_named_tuple(t: Any) -> bool: ... | ||
def is_new_type(t: Any) -> bool: ... | ||
def is_union(t: Any): ... | ||
def is_optional(t: Any, type_vars: typing.Dict[str, typing.Any] = ...) -> bool: ... | ||
def is_annotated(t: Any) -> bool: ... | ||
def is_literal(t: Any) -> bool: ... | ||
def not_none_type_arg( | ||
args: typing.Tuple[typing.Any, ...], type_vars: typing.Dict[str, typing.Any] = ... | ||
) -> Any: ... | ||
def is_type_var(t: Any) -> bool: ... | ||
def is_type_var_any(t: Any) -> bool: ... | ||
def is_class_var(t: Any) -> bool: ... | ||
def is_init_var(t: Any) -> bool: ... | ||
def get_class_that_defines_method(method_name: Any, cls: Any): ... | ||
def get_class_that_defines_field(field_name: Any, cls: Any): ... | ||
def is_dataclass_dict_mixin(t: Any) -> bool: ... | ||
def is_dataclass_dict_mixin_subclass(t: Any) -> bool: ... | ||
def resolve_type_vars(cls, arg_types: Any = ..., is_cls_created: bool = ...): ... | ||
def get_name_error_name(e: NameError) -> str: ... | ||
def is_dialect_subclass(t: Any) -> bool: ... |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from mashumaro.types import SerializationStrategy | ||
from typing import Any, Callable, Dict, Union | ||
|
||
SerializationStrategyValueType = Union[SerializationStrategy, Dict[str, Union[str, Callable]]] | ||
|
||
class Dialect: | ||
serialization_strategy: Dict[Any, SerializationStrategyValueType] = ... |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from mashumaro.dialect import Dialect | ||
from typing import Any | ||
|
||
class MessagePackDialect(Dialect): | ||
serialization_strategy: Any = ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from mashumaro.types import SerializationStrategy | ||
from typing import Any, Callable, Optional, Union | ||
from typing_extensions import Literal | ||
|
||
NamedTupleDeserializationEngine = Literal["as_dict", "as_list"] | ||
DateTimeDeserializationEngine = Literal["ciso8601", "pendulum"] | ||
AnyDeserializationEngine = Literal[NamedTupleDeserializationEngine, DateTimeDeserializationEngine] | ||
|
||
NamedTupleSerializationEngine = Literal["as_dict", "as_list"] | ||
AnySerializationEngine = NamedTupleSerializationEngine | ||
|
||
def field_options( | ||
serialize: Optional[Union[AnySerializationEngine, Callable[[Any], Any]]] = ..., | ||
deserialize: Optional[Union[AnyDeserializationEngine, Callable[[Any], Any]]] = ..., | ||
serialization_strategy: Optional[SerializationStrategy] = ..., | ||
alias: Optional[str] = ..., | ||
) -> Any: ... | ||
|
||
class _PassThrough(SerializationStrategy): | ||
def __call__(self, *args: Any, **kwargs: Any) -> None: ... | ||
def serialize(self, value: Any): ... | ||
def deserialize(self, value: Any): ... | ||
|
||
pass_through: Any |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from typing import Any, Dict, Mapping, Type, TypeVar | ||
|
||
T = TypeVar("T", bound="DataClassDictMixin") | ||
|
||
class DataClassDictMixin: | ||
def __init_subclass__(cls: Type[T], **kwargs: Any) -> None: ... | ||
def to_dict(self, omit_none: bool = True, validate: bool = False) -> dict: ... | ||
@classmethod | ||
def from_dict(cls, d: Mapping, validate=True) -> Any: ... | ||
@classmethod | ||
def __pre_deserialize__(cls: Type[T], d: Dict[Any, Any]) -> Dict[Any, Any]: ... | ||
@classmethod | ||
def __post_deserialize__(cls: Type[T], obj: T) -> T: ... | ||
def __pre_serialize__(self) -> T: ... | ||
def __post_serialize__(self, d: Dict[Any, Any]) -> Dict[Any, Any]: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from mashumaro.mixins.dict import DataClassDictMixin as DataClassDictMixin | ||
from typing import Any, Dict, Type, TypeVar, Union | ||
from typing_extensions import Protocol as Protocol | ||
|
||
EncodedData = Union[str, bytes, bytearray] | ||
T = TypeVar("T", bound="DataClassJSONMixin") | ||
|
||
class Encoder: | ||
def __call__(self, obj: Any, **kwargs: Any) -> EncodedData: ... | ||
|
||
class Decoder: | ||
def __call__(self, s: EncodedData, **kwargs: Any) -> Dict[Any, Any]: ... | ||
|
||
class DataClassJSONMixin(DataClassDictMixin): | ||
def to_json(self, encoder: Encoder = ..., **to_dict_kwargs: Any) -> EncodedData: ... | ||
@classmethod | ||
def from_json( | ||
cls: Type[T], data: EncodedData, decoder: Decoder = ..., **from_dict_kwargs: Any | ||
) -> T: ... |
Oops, something went wrong.