You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/08/03 04:41:20 UTC

[GitHub] [airflow] uranusjr commented on a change in pull request #17325: s3 unify_bucket_name_and_key simplify

uranusjr commented on a change in pull request #17325:
URL: https://github.com/apache/airflow/pull/17325#discussion_r681428602



##########
File path: airflow/providers/amazon/aws/hooks/s3.py
##########
@@ -75,15 +75,10 @@ def unify_bucket_name_and_key(func: T) -> T:
     def wrapper(*args, **kwargs) -> T:
         bound_args = function_signature.bind(*args, **kwargs)
 
-        def get_key_name() -> Optional[str]:
-            if 'wildcard_key' in bound_args.arguments:
-                return 'wildcard_key'
-            if 'key' in bound_args.arguments:
-                return 'key'
+        key_name = 'wildcard_key' if 'wildcard_key' in bound_args.arguments else 'key'
+        if key_name not in bound_args.arguments:

Review comment:
       ```python
           if 'wildcard_key' in bound_args.arguments:
               key_name = 'wildcard_key'
           elif 'key' in bound_args.arguments:
               key_name = 'key'
           else:
               raise ValueError('Missing key parameter!')
   ```
   
   Would this be easier to follow?




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