Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jul 17, 2023
1 parent 214ea8e commit c053065
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 3 deletions.
1 change: 0 additions & 1 deletion apischema/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ def dependent_required(*groups: Collection[Any], owner: Optional[type] = None):
if owner is None:
return DependentRequiredDescriptor(fields, groups)
else:

dep_req = _dependent_requireds[owner]
for field, required in fields.items():
dep_req.append((field, required))
Expand Down
1 change: 0 additions & 1 deletion apischema/objects/conversions.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ def object_serialization(
fields_and_methods: Union[Iterable[Any], Callable[[], Iterable[Any]]],
*output_class_modifiers: Callable[[type], Any],
) -> Callable[[T], Any]:

generic, bases = cls, ()
if getattr(cls, "__parameters__", ()):
generic = cls[cls.__parameters__] # type: ignore
Expand Down
1 change: 0 additions & 1 deletion apischema/objects/visitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ def _default_fields(cls: type) -> Optional[Sequence[ObjectField]]:
def _override_fields(
self, tp: AnyType, fields: Sequence[ObjectField]
) -> Sequence[ObjectField]:

origin = get_origin_or_type(tp)
if isinstance(origin, type):
default_fields = self._default_fields(origin)
Expand Down
3 changes: 3 additions & 0 deletions examples/examples/inherited_deserializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

Foo_ = TypeVar("Foo_", bound="Foo")


# Use a dataclass in order to be easily testable with ==
@dataclass
class Foo:
Expand Down Expand Up @@ -47,6 +48,8 @@ class ForeignSubtype(ForeignType):


T = TypeVar("T")


# Recursive implementation of type.__subclasses__
def rec_subclasses(cls: type[T]) -> Iterator[type[T]]:
for sub_cls in cls.__subclasses__():
Expand Down
1 change: 1 addition & 0 deletions examples/examples/pydantic_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def default_schema(tp: Any) -> Schema | None:

settings.base_schema.type = default_schema


# No need to use settings.serialization because serializer is inherited
@serializer
def serialize_pydantic(obj: pydantic.BaseModel) -> Any:
Expand Down
1 change: 1 addition & 0 deletions examples/generic_type_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

T = TypeVar("T")


# Type name factory takes the type and its arguments as (positional) parameters
@type_name(lambda tp, arg: f"{arg.__name__}Resource")
@dataclass
Expand Down

0 comments on commit c053065

Please sign in to comment.