dirrao commented on code in PR #37722:
URL: https://github.com/apache/airflow/pull/37722#discussion_r1503646847


##########
airflow/providers/google/cloud/operators/cloud_storage_transfer_service.py:
##########
@@ -546,28 +547,29 @@ def __init__(
     ) -> None:
         # To preserve backward compatibility
         # TODO: remove one day
+        _filter = kwargs.pop("filter", None)
         if request_filter is None:
-            if "filter" in kwargs:
-                request_filter = kwargs["filter"]
-                AirflowProviderDeprecationWarning(
-                    "Use 'request_filter' instead 'filter' to pass the 
argument."
-                )
-            else:
-                TypeError("__init__() missing 1 required positional argument: 
'request_filter'")
-
+            if not _filter:
+                raise ValueError("'request_filter' should be set")
+            request_filter = _filter
+            warnings.warn(
+                "Use 'request_filter' instead 'filter' to pass the argument.",
+                AirflowProviderDeprecationWarning,
+                stacklevel=2,
+            )
         super().__init__(**kwargs)
         self.filter = request_filter
         self.project_id = project_id
         self.gcp_conn_id = gcp_conn_id
         self.api_version = api_version
         self.google_impersonation_chain = google_impersonation_chain
-        self._validate_inputs()
 
     def _validate_inputs(self) -> None:
         if not self.filter:
             raise AirflowException("The required parameter 'filter' is empty 
or None")
 
     def execute(self, context: Context) -> list[dict]:
+        self._validate_inputs()

Review Comment:
   Small clarification. Why we moved _validate_inputs from init to execute 
method?



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