You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Taragolis (via GitHub)" <gi...@apache.org> on 2023/09/10 21:56:10 UTC

[GitHub] [airflow] Taragolis commented on a diff in pull request #34260: Remove unnecessary call to keys() method on dictionaries

Taragolis commented on code in PR #34260:
URL: https://github.com/apache/airflow/pull/34260#discussion_r1320867479


##########
airflow/providers/google/cloud/utils/field_validator.py:
##########
@@ -443,7 +443,7 @@ def validate(self, body_to_validate: dict) -> None:
                     and nested_union_spec.get("api_version") != self._api_version
                 ]
             )
-        for field_name in body_to_validate.keys():
+        for field_name in body_to_validate:

Review Comment:
   Everything fine in refactoring itself, for me a bit confusing original test which was written years ago
   
   https://github.com/apache/airflow/blob/dd4804e05bb7e994a3782feacf47c89d2e9481f3/tests/providers/google/cloud/utils/test_field_validator.py#L37-L44
   
   I not familiar with such body in GCP, but I guess if we expect that only dict is valid here then we need to fix a bit of logic from raise TypeError in case if got not a dict, because it also might confuse end users if they got Attribute error



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org