Skip to content

Commit

Permalink
Drop cattrs from legacy (de)serialization (apache#34672)
Browse files Browse the repository at this point in the history
  • Loading branch information
Taragolis authored Oct 5, 2023
1 parent 0c8e30e commit e5238c2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
11 changes: 6 additions & 5 deletions airflow/serialization/serialized_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from inspect import signature
from typing import TYPE_CHECKING, Any, Collection, Iterable, Mapping, NamedTuple, Union

import cattr
import attrs
import lazy_object_proxy
import pendulum
from dateutil import relativedelta
Expand Down Expand Up @@ -1214,7 +1214,8 @@ def _deserialize_operator_extra_links(cls, encoded_op_links: list) -> dict[str,
log.error("Operator Link class %r not registered", _operator_link_class_path)
return {}

op_predefined_extra_link: BaseOperatorLink = cattr.structure(data, single_op_link_class)
op_link_parameters = {param: cls.deserialize(value) for param, value in data.items()}
op_predefined_extra_link: BaseOperatorLink = single_op_link_class(**op_link_parameters)

op_predefined_extra_links.update({op_predefined_extra_link.name: op_predefined_extra_link})

Expand All @@ -1234,9 +1235,9 @@ def _serialize_operator_extra_links(cls, operator_extra_links: Iterable[BaseOper
"""
serialize_operator_extra_links = []
for operator_extra_link in operator_extra_links:
op_link_arguments = cattr.unstructure(operator_extra_link)
if not isinstance(op_link_arguments, dict):
op_link_arguments = {}
op_link_arguments = {
param: cls.serialize(value) for param, value in attrs.asdict(operator_extra_link).items()
}

module_path = (
f"{operator_extra_link.__class__.__module__}.{operator_extra_link.__class__.__name__}"
Expand Down
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ install_requires =
asgiref
attrs>=22.1.0
blinker
cattrs>=22.1.0
# Colorlog 6.x merges TTYColoredFormatter into ColoredFormatter, breaking backwards compatibility with 4.x
# Update CustomTTYColoredFormatter to remove
colorlog>=4.0.2, <5.0
Expand Down

0 comments on commit e5238c2

Please sign in to comment.