Skip to content

Commit

Permalink
Stringify type hints, changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
Tinche committed Sep 7, 2024
1 parent d9a3791 commit a659714
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
5 changes: 5 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ The third number is for emergencies when we need to start branches for older rel

Our backwards-compatibility policy can be found [here](https://github.com/python-attrs/cattrs/blob/main/.github/SECURITY.md).

## 24.1.1 (UNRELEASED)

- Fix `BaseConverter.register_structure_hook_factory` and `BaseConverter.register_unstructure_hook_factory` type hints.
([#578](https://github.com/python-attrs/cattrs/issues/578) [#579](https://github.com/python-attrs/cattrs/pull/579))

## 24.1.0 (2024-08-28)

- **Potentially breaking**: Unstructuring hooks for `typing.Any` are consistent now: values are unstructured using their runtime type.
Expand Down
14 changes: 4 additions & 10 deletions src/cattrs/converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,13 @@
# This typevar for the BaseConverter.
AnyUnstructureHookFactoryBase = TypeVar(
"AnyUnstructureHookFactoryBase",
bound=Union[
HookFactory[UnstructureHook], ExtendedUnstructureHookFactory[BaseConverter]
],
bound="HookFactory[UnstructureHook] | ExtendedUnstructureHookFactory[BaseConverter]",
)

# This typevar for the Converter.
AnyUnstructureHookFactory = TypeVar(
"AnyUnstructureHookFactory",
bound=Union[
HookFactory[UnstructureHook], ExtendedUnstructureHookFactory[Converter]
],
bound="HookFactory[UnstructureHook] | ExtendedUnstructureHookFactory[Converter]",
)

StructureHookFactory = TypeVar("StructureHookFactory", bound=HookFactory[StructureHook])
Expand All @@ -128,15 +124,13 @@
# This typevar for the BaseConverter.
AnyStructureHookFactoryBase = TypeVar(
"AnyStructureHookFactoryBase",
bound=Union[
HookFactory[StructureHook], ExtendedStructureHookFactory[BaseConverter]
],
bound="HookFactory[StructureHook] | ExtendedStructureHookFactory[BaseConverter]",
)

# This typevar for the Converter.
AnyStructureHookFactory = TypeVar(
"AnyStructureHookFactory",
bound=Union[HookFactory[StructureHook], ExtendedStructureHookFactory[Converter]],
bound="HookFactory[StructureHook] | ExtendedStructureHookFactory[Converter]",
)


Expand Down

0 comments on commit a659714

Please sign in to comment.