This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 73ab0ed  Fix MyPy Errors for Alibaba provider. (#20393)
73ab0ed is described below

commit 73ab0edce58d996e2854d478f054b25c4bb627c4
Author: Dmytro Kazanzhy <[email protected]>
AuthorDate: Sat Dec 18 11:57:56 2021 +0200

    Fix MyPy Errors for Alibaba provider. (#20393)
---
 airflow/providers/alibaba/cloud/example_dags/example_oss_bucket.py | 6 +++---
 airflow/providers/alibaba/cloud/example_dags/example_oss_object.py | 6 +++++-
 airflow/providers/alibaba/cloud/hooks/oss.py                       | 2 +-
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/airflow/providers/alibaba/cloud/example_dags/example_oss_bucket.py 
b/airflow/providers/alibaba/cloud/example_dags/example_oss_bucket.py
index 1ca52c8..29ceb55 100644
--- a/airflow/providers/alibaba/cloud/example_dags/example_oss_bucket.py
+++ b/airflow/providers/alibaba/cloud/example_dags/example_oss_bucket.py
@@ -23,15 +23,15 @@ from airflow.providers.alibaba.cloud.operators.oss import 
OSSCreateBucketOperato
 with DAG(
     dag_id='oss_bucket_dag',
     start_date=datetime(2021, 1, 1),
-    default_args={'region': 'your region', 'bucket_name': 'your bucket'},
+    default_args={'bucket_name': 'your bucket'},
     max_active_runs=1,
     tags=['example'],
     catchup=False,
 ) as dag:
 
-    create_bucket = OSSCreateBucketOperator(task_id='task1')
+    create_bucket = OSSCreateBucketOperator(task_id='task1', region='your 
region')
 
-    delete_bucket = OSSDeleteBucketOperator(task_id='task2')
+    delete_bucket = OSSDeleteBucketOperator(task_id='task2', region='your 
region')
 
     create_bucket >> delete_bucket
 # [END howto_operator_oss_bucket]
diff --git a/airflow/providers/alibaba/cloud/example_dags/example_oss_object.py 
b/airflow/providers/alibaba/cloud/example_dags/example_oss_object.py
index 92afaf7..76875ac 100644
--- a/airflow/providers/alibaba/cloud/example_dags/example_oss_object.py
+++ b/airflow/providers/alibaba/cloud/example_dags/example_oss_object.py
@@ -28,7 +28,7 @@ from airflow.providers.alibaba.cloud.operators.oss import (
 with DAG(
     dag_id='oss_object_dag',
     start_date=datetime(2021, 1, 1),
-    default_args={'region': 'your region', 'bucket_name': 'your bucket'},
+    default_args={'bucket_name': 'your bucket'},
     max_active_runs=1,
     tags=['example'],
     catchup=False,
@@ -38,22 +38,26 @@ with DAG(
         file='your local file',
         key='your oss key',
         task_id='task1',
+        region='your region',
     )
 
     download_object = OSSDownloadObjectOperator(
         file='your local file',
         key='your oss key',
         task_id='task2',
+        region='your region',
     )
 
     delete_object = OSSDeleteObjectOperator(
         key='your oss key',
         task_id='task3',
+        region='your region',
     )
 
     delete_batch_object = OSSDeleteBatchObjectOperator(
         keys=['obj1', 'obj2', 'obj3'],
         task_id='task4',
+        region='your region',
     )
 
     create_object >> download_object >> delete_object >> delete_batch_object
diff --git a/airflow/providers/alibaba/cloud/hooks/oss.py 
b/airflow/providers/alibaba/cloud/hooks/oss.py
index c318857..76725a2 100644
--- a/airflow/providers/alibaba/cloud/hooks/oss.py
+++ b/airflow/providers/alibaba/cloud/hooks/oss.py
@@ -65,7 +65,7 @@ def unify_bucket_name_and_key(func: T) -> T:
     def wrapper(*args, **kwargs) -> T:
         bound_args = function_signature.bind(*args, **kwargs)
 
-        def get_key() -> Optional[str]:
+        def get_key() -> str:
             if 'key' in bound_args.arguments:
                 return 'key'
             raise ValueError('Missing key parameter!')

Reply via email to