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 2019/07/30 08:03:36 UTC

[GitHub] [airflow] potiuk commented on a change in pull request #5674: [AIRFLOW-5057] Provide bucket name to functions in S3 Hook when none is specified

potiuk commented on a change in pull request #5674: [AIRFLOW-5057] Provide bucket name to functions in S3 Hook when none is specified
URL: https://github.com/apache/airflow/pull/5674#discussion_r308583071
 
 

 ##########
 File path: airflow/hooks/S3_hook.py
 ##########
 @@ -16,15 +16,46 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+
+# pylint: disable=invalid-name
+"""
+Interact with AWS S3, using the boto3 library.
+"""
+import fnmatch
+import re
+from functools import wraps
+from urllib.parse import urlparse
+
 from botocore.exceptions import ClientError
+from six import BytesIO
 
-from airflow.exceptions import AirflowException
 from airflow.contrib.hooks.aws_hook import AwsHook
+from airflow.exceptions import AirflowException
 
-from six import BytesIO
-from urllib.parse import urlparse
-import re
-import fnmatch
+
+def provide_bucket_name(func):
+    """
+    Function decorator that provides a bucket name taken from the connection
+    in case no bucket name has been passed to the function and, if available, also no key has been passed.
+    """
+
+    @wraps(func)
+    def wrapper(*args, **kwargs):
+        func_params = func.__code__.co_varnames
+
+        def has_arg(name):
 
 Review comment:
   Nice!

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services