Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump mashumaro from 2.9 to 3.0.3 in /core #5118

Merged
merged 4 commits into from
Jul 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changes/unreleased/Under the Hood-20220720-115226.yaml
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"
2 changes: 1 addition & 1 deletion core/dbt/contracts/graph/manifest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import enum
from dataclasses import dataclass, field
from itertools import chain, islice
from mashumaro import DataClassMessagePackMixin
from mashumaro.mixins.msgpack import DataClassMessagePackMixin
from multiprocessing.synchronize import Lock
from typing import (
Dict,
Expand Down
3 changes: 2 additions & 1 deletion core/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"hologram>=0.0.14,<=0.0.15",
"isodate>=0.6,<0.7",
"logbook>=1.5,<1.6",
"mashumaro==2.9",
"mashumaro[msgpack]==3.0.3",
"minimal-snowplow-tracker==0.0.2",
"networkx>=2.3,<2.8.1;python_version<'3.8'",
"networkx>=2.3,<3;python_version>='3.8'",
Expand All @@ -69,6 +69,7 @@
"requests<3.0.0",
"idna>=2.5,<4",
"cffi>=1.9,<2.0.0",
"pyyaml>=6.0",
],
zip_safe=False,
classifiers=[
Expand Down
7 changes: 3 additions & 4 deletions third-party-stubs/mashumaro/__init__.pyi
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
25 changes: 23 additions & 2 deletions third-party-stubs/mashumaro/config.pyi
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]] = ...
13 changes: 13 additions & 0 deletions third-party-stubs/mashumaro/core/const.pyi
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
3 changes: 3 additions & 0 deletions third-party-stubs/mashumaro/core/helpers.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import datetime

def parse_timezone(s: str) -> datetime.timezone: ...
115 changes: 115 additions & 0 deletions third-party-stubs/mashumaro/core/meta/builder.pyi
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: ...
37 changes: 37 additions & 0 deletions third-party-stubs/mashumaro/core/meta/helpers.pyi
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: ...
7 changes: 7 additions & 0 deletions third-party-stubs/mashumaro/dialect.pyi
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.
5 changes: 5 additions & 0 deletions third-party-stubs/mashumaro/dialects/msgpack.pyi
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 = ...
31 changes: 30 additions & 1 deletion third-party-stubs/mashumaro/exceptions.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from mashumaro.meta.helpers import type_name as type_name
from mashumaro.core.meta.helpers import type_name as type_name
from typing import Any, Optional

class MissingField(LookupError):
Expand Down Expand Up @@ -26,6 +26,16 @@ class UnserializableField(UnserializableDataError):
@property
def holder_class_name(self): ...

class UnsupportedSerializationEngine(UnserializableField):
def __init__(
self, field_name: Any, field_type: Any, holder_class: Any, engine: Any
) -> None: ...

class UnsupportedDeserializationEngine(UnserializableField):
def __init__(
self, field_name: Any, field_type: Any, holder_class: Any, engine: Any
) -> None: ...

class InvalidFieldValue(ValueError):
field_name: Any = ...
field_type: Any = ...
Expand All @@ -44,3 +54,22 @@ class InvalidFieldValue(ValueError):
def field_type_name(self): ...
@property
def holder_class_name(self): ...

class BadHookSignature(TypeError): ...

class ThirdPartyModuleNotFoundError(ModuleNotFoundError):
module_name: Any = ...
field_name: Any = ...
holder_class: Any = ...
def __init__(self, module_name: Any, field_name: Any, holder_class: Any) -> None: ...
@property
def holder_class_name(self): ...

class UnresolvedTypeReferenceError(NameError):
holder_class: Any = ...
name: Any = ...
def __init__(self, holder_class: Any, unresolved_type_name: Any) -> None: ...
@property
def holder_class_name(self): ...

class BadDialect(ValueError): ...
24 changes: 24 additions & 0 deletions third-party-stubs/mashumaro/helper.pyi
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
11 changes: 0 additions & 11 deletions third-party-stubs/mashumaro/meta/helpers.pyi

This file was deleted.

6 changes: 0 additions & 6 deletions third-party-stubs/mashumaro/meta/macros.pyi

This file was deleted.

Empty file.
15 changes: 15 additions & 0 deletions third-party-stubs/mashumaro/mixins/dict.pyi
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]: ...
19 changes: 19 additions & 0 deletions third-party-stubs/mashumaro/mixins/json.pyi
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: ...
Loading