hussein-awala commented on code in PR #70225:
URL: https://github.com/apache/airflow/pull/70225#discussion_r4406901730


##########
providers/standard/src/airflow/providers/standard/sensors/asset.py:
##########
@@ -0,0 +1,282 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+import contextlib
+from datetime import timedelta
+from typing import TYPE_CHECKING, Any, ClassVar, Literal, Protocol, cast
+
+from pydantic import BaseModel
+
+from airflow.providers.common.compat.sdk import (
+    AirflowOptionalProviderFeatureException,
+    BaseSensorOperator,
+    PokeReturnValue,
+)
+from airflow.providers.standard.version_compat import AIRFLOW_V_3_2_PLUS, 
AIRFLOW_V_3_4_PLUS
+
+if not AIRFLOW_V_3_2_PLUS:
+    raise AirflowOptionalProviderFeatureException("AssetEventSensor needs 
Airflow 3.2+.")
+
+if TYPE_CHECKING:
+    from collections.abc import Callable, Sequence
+    from datetime import datetime
+
+    from airflow.providers.common.compat.sdk import Context
+    from airflow.sdk.definitions.asset import Asset, AssetAlias, AssetRef
+    from airflow.sdk.execution_time.comms import AssetEventResult
+    from airflow.sdk.execution_time.context import InletEventsAccessor
+
+
+def _serialize_events(events: list[Any]) -> list[Any]:
+    """
+    Convert asset events Pydantic models to JSON-compatible dicts.
+
+    This keeps the XCom value plain JSON, rather than relying on how XCom
+    serializes pydantic models.
+    """
+    return [e.model_dump(mode="json") if isinstance(e, BaseModel) else e for e 
in events]
+
+
+class AssetEventTimeBound(Protocol):

Review Comment:
   I extended the provider tests to cover plain objects and protocol subclasses 
for both after and before. They exercise template rendering and polling with 
datetime and ISO string results. The tests also cover mapped custom resolvers. 
These cases pass with released Airflow 3.2.2.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to