jason810496 commented on code in PR #62259:
URL: https://github.com/apache/airflow/pull/62259#discussion_r3001090228


##########
providers/standard/src/airflow/providers/standard/operators/trigger_dagrun.py:
##########
@@ -453,3 +476,42 @@ def _trigger_dag_run_af_2_execute_complete(
                 f"{self.trigger_dag_id} return {state} which is not in 
{self.failed_states}"
                 f" or {self.allowed_states}"
             )
+
+
+@overload
+def _validate_datetime_param(name: str, value: ArgNotSet) -> ArgNotSet: ...
+@overload
+def _validate_datetime_param(name: str, value: None) -> None: ...
+@overload
+def _validate_datetime_param(name: str, value: str) -> str: ...
+@overload
+def _validate_datetime_param(name: str, value: datetime.datetime) -> 
datetime.datetime: ...
+
+
+def _validate_datetime_param(
+    name: str,
+    value: object,
+) -> str | datetime.datetime | None | ArgNotSet:
+    if value is NOTSET:
+        return NOTSET
+    if value is None or isinstance(value, (str, datetime.datetime)):

Review Comment:
   MyPy _should_ be able to respect the `NOTSET` if we change the input type 
annotation from `: object` to  `str | datetime.datetime | None | ArgNotSet`
   
   ```python
   def _validate_datetime_param(
       name: str,
       value: str | datetime.datetime | None | ArgNotSet,
   ) -> str | datetime.datetime | None | ArgNotSet:
   ```
   
   Btw, the `is_arg_set` helper might be more appropriate to distinguish the 
`NOTSET`:
   
   
https://github.com/apache/airflow/blob/d22505da575fe06b825e999ea03cde2291abf5b5/airflow-core/src/airflow/serialization/definitions/notset.py#L39-L40



-- 
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