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

Remove various deprecations #351

Merged
merged 1 commit into from
Feb 7, 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
6 changes: 1 addition & 5 deletions apischema/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"order",
"properties",
"schema",
"schema_ref",
"serialization_default",
"serialization_method",
"serialize",
Expand All @@ -35,7 +34,6 @@
json_schema,
metadata,
objects,
skip,
tagged_unions,
validation,
)
Expand All @@ -55,7 +53,7 @@
)
from .serialization.serialized_methods import serialized
from .settings import settings
from .type_names import schema_ref, type_name
from .type_names import type_name
from .types import Undefined, UndefinedType
from .utils import identity
from .validation import ValidationError, validator
Expand Down Expand Up @@ -84,8 +82,6 @@ def __getattr__(name):
"GraphQL feature requires graphql-core library\n"
"Run `pip install apischema[graphql]` to install it"
)
if name == "skip":
warnings.warn("apischema.skip module is deprecated")
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")


Expand Down
23 changes: 0 additions & 23 deletions apischema/conversions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,11 @@
"as_names",
"as_str",
"catch_value_error",
"dataclass_input_wrapper",
"deserializer",
"reset_deserializers",
"reset_serializer",
"serializer",
]

import sys
import warnings

from .conversions import AnyConversion, Conversion, LazyConversion
from .converters import (
as_names,
Expand All @@ -25,21 +20,3 @@
reset_serializer,
serializer,
)
from .wrappers import dataclass_input_wrapper

if sys.version_info >= (3, 7):

def __getattr__(name):
if name == "identity":
from apischema.utils import identity # noqa: F811

warnings.warn(
"apischema.conversions.identity is deprecated, "
"use apischema.identity instead",
DeprecationWarning,
)
return identity
raise AttributeError(f"module {__name__} has no attribute {name}")

else:
from apischema.utils import identity # noqa: F401
5 changes: 1 addition & 4 deletions apischema/conversions/conversions.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from apischema.methods import is_method, method_class, method_wrapper
from apischema.types import AnyType
from apischema.typing import is_type_var
from apischema.utils import deprecate_kwargs, identity
from apischema.utils import identity

if TYPE_CHECKING:
pass
Expand All @@ -37,9 +37,6 @@ class Conversion(Generic[ConvOrProp]):
inherited: Optional[bool] = None


deprecate_kwargs({"sub_conversions": "sub_conversion"})(Conversion)


@dataclass(frozen=True)
class LazyConversion:
get: Callable[[], Optional["AnyConversion"]]
Expand Down
92 changes: 0 additions & 92 deletions apischema/conversions/dataclass_models.py

This file was deleted.

57 changes: 0 additions & 57 deletions apischema/conversions/wrappers.py

This file was deleted.

12 changes: 0 additions & 12 deletions apischema/dependent_required.py

This file was deleted.

8 changes: 0 additions & 8 deletions apischema/deserialization/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@
CollectionOrPredicate,
Lazy,
as_predicate,
deprecate_kwargs,
get_origin_or_type,
literal_values,
opt_or,
Expand Down Expand Up @@ -866,13 +865,6 @@ def deserialize(
...


@deprecate_kwargs(
{
"coercion": "coerce",
"conversions": "conversion",
"default_fallback": "fall_back_on_default",
}
)
def deserialize(
type: AnyType,
data: Any,
Expand Down
2 changes: 0 additions & 2 deletions apischema/graphql/resolvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
from apischema.typing import is_type
from apischema.utils import (
awaitable_origin,
deprecate_kwargs,
empty_dict,
get_args2,
get_origin_or_type2,
Expand Down Expand Up @@ -179,7 +178,6 @@ def resolver(
...


@deprecate_kwargs({"conversions": "conversion"})
def resolver(
__arg=None,
*,
Expand Down
2 changes: 0 additions & 2 deletions apischema/graphql/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
Lazy,
as_predicate,
context_setter,
deprecate_kwargs,
empty_dict,
get_args2,
get_origin2,
Expand Down Expand Up @@ -883,7 +882,6 @@ def wrapper(_, *args, **kwargs):
)


@deprecate_kwargs({"union_ref": "union_name"})
def graphql_schema(
*,
query: Iterable[Union[Callable, Query]] = (),
Expand Down
3 changes: 0 additions & 3 deletions apischema/json_schema/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
from apischema.typing import get_args, get_origin, is_typed_dict, is_union
from apischema.utils import (
context_setter,
deprecate_kwargs,
get_origin_or_type,
identity,
is_hashable,
Expand Down Expand Up @@ -619,7 +618,6 @@ def _schema(
return result


@deprecate_kwargs({"conversions": "conversion"})
def deserialization_schema(
tp: AnyType,
*,
Expand Down Expand Up @@ -650,7 +648,6 @@ def deserialization_schema(
)


@deprecate_kwargs({"conversions": "conversion"})
def serialization_schema(
tp: AnyType,
*,
Expand Down
20 changes: 0 additions & 20 deletions apischema/metadata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
"skip",
"validators",
]

import sys
import warnings

from apischema.aliases import alias
from apischema.ordering import order
from apischema.schemas import schema
Expand All @@ -35,19 +31,3 @@
skip,
validators,
)

if sys.version_info >= (3, 7):

def __getattr__(name):
for deprecated in ("merged", "flattened"):
if name == deprecated:
warnings.warn(
f"apischema.metadata.{deprecated} is deprecated, "
"use apischema.metadata.flatten instead",
DeprecationWarning,
)
return flatten
raise AttributeError(f"module {__name__} has no attribute {name}")

else:
from .implem import flattened, merged # noqa: F401
8 changes: 0 additions & 8 deletions apischema/schemas.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import re
import warnings
from dataclasses import dataclass, replace
from typing import (
Any,
Expand Down Expand Up @@ -107,13 +106,6 @@ def schema(
extra: Optional[Extra] = None,
override: bool = False,
) -> Schema:
if default is ...:
warnings.warn(
"default=... is deprecated as default value is now"
" automatically added to the schema",
DeprecationWarning,
)
default = Undefined
default = None if default is Undefined else (lambda d=default: d)
if pattern is not None:
pattern = re.compile(pattern)
Expand Down
Loading