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/13 17:22:28 UTC

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

o-nikolas commented on a change in pull request #17325:
URL: https://github.com/apache/airflow/pull/17325#discussion_r688668942



##########
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:
       I agree with @uranusjr, I don't see a reason to make this code more cryptic in this particular case, just to save a few lines. I'd use the same cascading if statements that were present before your changes (and that @uranusjr is suggesting).




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