Skip to content

Commit

Permalink
Avoid lambda assignments (apache#44563)
Browse files Browse the repository at this point in the history
  • Loading branch information
uranusjr authored Dec 2, 2024
1 parent 06c3823 commit f38a1ed
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions airflow/serialization/serialized_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,12 @@ def encode_start_trigger_args(var: StartTriggerArgs) -> dict[str, Any]:
:meta private:
"""
serialize_kwargs = lambda key: (
BaseSerialization.serialize(getattr(var, key)) if getattr(var, key) is not None else None
)

def serialize_kwargs(key: str) -> Any:
if (val := getattr(var, key)) is None:
return None
return BaseSerialization.serialize(val)

return {
"__type": "START_TRIGGER_ARGS",
"trigger_cls": var.trigger_cls,
Expand All @@ -409,7 +412,11 @@ def decode_start_trigger_args(var: dict[str, Any]) -> StartTriggerArgs:
:meta private:
"""
deserialize_kwargs = lambda key: BaseSerialization.deserialize(var[key]) if var[key] is not None else None

def deserialize_kwargs(key: str) -> Any:
if (val := var[key]) is None:
return None
return BaseSerialization.deserialize(val)

return StartTriggerArgs(
trigger_cls=var["trigger_cls"],
Expand Down

0 comments on commit f38a1ed

Please sign in to comment.