Skip to content

Commit e3bcaa3

Browse files
authored
Correct typo in GCSObjectsWtihPrefixExistenceSensor (#14179)
Rename GCSObjectsWtihPrefixExistenceSensor to GCSObjectsWithPrefixExistenceSensor
1 parent 6dc6339 commit e3bcaa3

File tree

7 files changed

+31
-13
lines changed

7 files changed

+31
-13
lines changed

β€ŽUPDATING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1262,7 +1262,7 @@ The following table shows changes in import paths.
12621262
|airflow.contrib.sensors.gcp_transfer_sensor.GCPTransferServiceWaitForJobStatusSensor |airflow.providers.google.cloud.sensors.cloud_storage_transfer_service.DataTransferServiceJobStatusSensor |
12631263
|airflow.contrib.sensors.gcs_sensor.GoogleCloudStorageObjectSensor |airflow.providers.google.cloud.sensors.gcs.GCSObjectExistenceSensor |
12641264
|airflow.contrib.sensors.gcs_sensor.GoogleCloudStorageObjectUpdatedSensor |airflow.providers.google.cloud.sensors.gcs.GCSObjectUpdateSensor |
1265-
|airflow.contrib.sensors.gcs_sensor.GoogleCloudStoragePrefixSensor |airflow.providers.google.cloud.sensors.gcs.GCSObjectsWtihPrefixExistenceSensor |
1265+
|airflow.contrib.sensors.gcs_sensor.GoogleCloudStoragePrefixSensor |airflow.providers.google.cloud.sensors.gcs.GCSObjectsWithPrefixExistenceSensor |
12661266
|airflow.contrib.sensors.gcs_sensor.GoogleCloudStorageUploadSessionCompleteSensor |airflow.providers.google.cloud.sensors.gcs.GCSUploadSessionCompleteSensor |
12671267
|airflow.contrib.sensors.pubsub_sensor.PubSubPullSensor |airflow.providers.google.cloud.sensors.pubsub.PubSubPullSensor |
12681268

β€Žairflow/contrib/sensors/gcs_sensor.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
from airflow.providers.google.cloud.sensors.gcs import (
2323
GCSObjectExistenceSensor,
24-
GCSObjectsWtihPrefixExistenceSensor,
24+
GCSObjectsWithPrefixExistenceSensor,
2525
GCSObjectUpdateSensor,
2626
GCSUploadSessionCompleteSensor,
2727
)
@@ -65,16 +65,16 @@ def __init__(self, *args, **kwargs):
6565
super().__init__(*args, **kwargs)
6666

6767

68-
class GoogleCloudStoragePrefixSensor(GCSObjectsWtihPrefixExistenceSensor):
68+
class GoogleCloudStoragePrefixSensor(GCSObjectsWithPrefixExistenceSensor):
6969
"""
7070
This class is deprecated.
71-
Please use `airflow.providers.google.cloud.sensors.gcs.GCSObjectsWtihPrefixExistenceSensor`.
71+
Please use `airflow.providers.google.cloud.sensors.gcs.GCSObjectsWithPrefixExistenceSensor`.
7272
"""
7373

7474
def __init__(self, *args, **kwargs):
7575
warnings.warn(
7676
"""This class is deprecated.
77-
Please use `airflow.providers.google.cloud.sensors.gcs.GCSObjectsWtihPrefixExistenceSensor`.""",
77+
Please use `airflow.providers.google.cloud.sensors.gcs.GCSObjectsWithPrefixExistenceSensor`.""",
7878
DeprecationWarning,
7979
stacklevel=3,
8080
)

β€Žairflow/providers/google/BACKPORT_PROVIDER_README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ in [Naming conventions for provider packages](https://github.com/apache/airflow/
605605
| [cloud.sensors.cloud_storage_transfer_service.CloudDataTransferServiceJobStatusSensor](https://github.com/apache/airflow/blob/master/airflow/providers/google/cloud/sensors/cloud_storage_transfer_service.py) | [contrib.sensors.gcp_transfer_sensor.GCPTransferServiceWaitForJobStatusSensor](https://github.com/apache/airflow/blob/v1-10-stable/airflow/contrib/sensors/gcp_transfer_sensor.py) |
606606
| [cloud.sensors.gcs.GCSObjectExistenceSensor](https://github.com/apache/airflow/blob/master/airflow/providers/google/cloud/sensors/gcs.py) | [contrib.sensors.gcs_sensor.GoogleCloudStorageObjectSensor](https://github.com/apache/airflow/blob/v1-10-stable/airflow/contrib/sensors/gcs_sensor.py) |
607607
| [cloud.sensors.gcs.GCSObjectUpdateSensor](https://github.com/apache/airflow/blob/master/airflow/providers/google/cloud/sensors/gcs.py) | [contrib.sensors.gcs_sensor.GoogleCloudStorageObjectUpdatedSensor](https://github.com/apache/airflow/blob/v1-10-stable/airflow/contrib/sensors/gcs_sensor.py) |
608-
| [cloud.sensors.gcs.GCSObjectsWtihPrefixExistenceSensor](https://github.com/apache/airflow/blob/master/airflow/providers/google/cloud/sensors/gcs.py) | [contrib.sensors.gcs_sensor.GoogleCloudStoragePrefixSensor](https://github.com/apache/airflow/blob/v1-10-stable/airflow/contrib/sensors/gcs_sensor.py) |
608+
| [cloud.sensors.gcs.GCSObjectsWithPrefixExistenceSensor](https://github.com/apache/airflow/blob/master/airflow/providers/google/cloud/sensors/gcs.py) | [contrib.sensors.gcs_sensor.GoogleCloudStoragePrefixSensor](https://github.com/apache/airflow/blob/v1-10-stable/airflow/contrib/sensors/gcs_sensor.py) |
609609
| [cloud.sensors.gcs.GCSUploadSessionCompleteSensor](https://github.com/apache/airflow/blob/master/airflow/providers/google/cloud/sensors/gcs.py) | [contrib.sensors.gcs_sensor.GoogleCloudStorageUploadSessionCompleteSensor](https://github.com/apache/airflow/blob/v1-10-stable/airflow/contrib/sensors/gcs_sensor.py) |
610610
| [cloud.sensors.pubsub.PubSubPullSensor](https://github.com/apache/airflow/blob/master/airflow/providers/google/cloud/sensors/pubsub.py) | [contrib.sensors.pubsub_sensor.PubSubPullSensor](https://github.com/apache/airflow/blob/v1-10-stable/airflow/contrib/sensors/pubsub_sensor.py) |
611611

β€Žairflow/providers/google/cloud/sensors/gcs.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"""This module contains Google Cloud Storage sensors."""
1919

2020
import os
21+
import warnings
2122
from datetime import datetime
2223
from typing import Callable, List, Optional, Sequence, Set, Union
2324

@@ -167,7 +168,7 @@ def poke(self, context: dict) -> bool:
167168
return hook.is_updated_after(self.bucket, self.object, self.ts_func(context))
168169

169170

170-
class GCSObjectsWtihPrefixExistenceSensor(BaseSensorOperator):
171+
class GCSObjectsWithPrefixExistenceSensor(BaseSensorOperator):
171172
"""
172173
Checks for the existence of GCS objects at a given prefix, passing matches via XCom.
173174
@@ -239,6 +240,22 @@ def execute(self, context: dict) -> List[str]:
239240
return self._matches
240241

241242

243+
class GCSObjectsWtihPrefixExistenceSensor(GCSObjectsWithPrefixExistenceSensor):
244+
"""
245+
This class is deprecated.
246+
Please use `airflow.providers.google.cloud.sensors.gcs.GCSObjectsWithPrefixExistenceSensor`.
247+
"""
248+
249+
def __init__(self, *args, **kwargs):
250+
warnings.warn(
251+
"""This class is deprecated.
252+
Please use `airflow.providers.google.cloud.sensors.gcs.GCSObjectsWithPrefixExistenceSensor`.""",
253+
DeprecationWarning,
254+
stacklevel=3,
255+
)
256+
super().__init__(*args, **kwargs)
257+
258+
242259
def get_time():
243260
"""
244261
This is just a wrapper of datetime.datetime.now to simplify mocking in the

β€Žtests/always/test_project_structure.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ class TestGoogleProviderProjectStructure(unittest.TestCase):
220220
'airflow.providers.google.cloud.operators.compute.ComputeEngineBaseOperator',
221221
'airflow.providers.google.cloud.sensors.gcs.GCSObjectExistenceSensor',
222222
'airflow.providers.google.cloud.sensors.gcs.GCSObjectUpdateSensor',
223+
'airflow.providers.google.cloud.sensors.gcs.GCSObjectsWithPrefixExistenceSensor',
223224
'airflow.providers.google.cloud.sensors.gcs.GCSObjectsWtihPrefixExistenceSensor',
224225
'airflow.providers.google.cloud.sensors.gcs.GCSUploadSessionCompleteSensor',
225226
}

β€Žtests/deprecated_classes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1416,7 +1416,7 @@
14161416
"airflow.contrib.sensors.gcs_sensor.GoogleCloudStorageObjectUpdatedSensor",
14171417
),
14181418
(
1419-
"airflow.providers.google.cloud.sensors.gcs.GCSObjectsWtihPrefixExistenceSensor",
1419+
"airflow.providers.google.cloud.sensors.gcs.GCSObjectsWithPrefixExistenceSensor",
14201420
"airflow.contrib.sensors.gcs_sensor.GoogleCloudStoragePrefixSensor",
14211421
),
14221422
(

β€Žtests/providers/google/cloud/sensors/test_gcs.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from airflow.models.dag import DAG, AirflowException
2626
from airflow.providers.google.cloud.sensors.gcs import (
2727
GCSObjectExistenceSensor,
28-
GCSObjectsWtihPrefixExistenceSensor,
28+
GCSObjectsWithPrefixExistenceSensor,
2929
GCSObjectUpdateSensor,
3030
GCSUploadSessionCompleteSensor,
3131
ts_function,
@@ -131,7 +131,7 @@ def test_should_pass_argument_to_hook(self, mock_hook):
131131
class TestGoogleCloudStoragePrefixSensor(TestCase):
132132
@mock.patch("airflow.providers.google.cloud.sensors.gcs.GCSHook")
133133
def test_should_pass_arguments_to_hook(self, mock_hook):
134-
task = GCSObjectsWtihPrefixExistenceSensor(
134+
task = GCSObjectsWithPrefixExistenceSensor(
135135
task_id="task-id",
136136
bucket=TEST_BUCKET,
137137
prefix=TEST_PREFIX,
@@ -152,7 +152,7 @@ def test_should_pass_arguments_to_hook(self, mock_hook):
152152

153153
@mock.patch("airflow.providers.google.cloud.sensors.gcs.GCSHook")
154154
def test_should_return_false_on_empty_list(self, mock_hook):
155-
task = GCSObjectsWtihPrefixExistenceSensor(
155+
task = GCSObjectsWithPrefixExistenceSensor(
156156
task_id="task-id",
157157
bucket=TEST_BUCKET,
158158
prefix=TEST_PREFIX,
@@ -166,7 +166,7 @@ def test_should_return_false_on_empty_list(self, mock_hook):
166166

167167
@mock.patch('airflow.providers.google.cloud.sensors.gcs.GCSHook')
168168
def test_execute(self, mock_hook):
169-
task = GCSObjectsWtihPrefixExistenceSensor(
169+
task = GCSObjectsWithPrefixExistenceSensor(
170170
task_id="task-id",
171171
bucket=TEST_BUCKET,
172172
prefix=TEST_PREFIX,
@@ -190,7 +190,7 @@ def test_execute(self, mock_hook):
190190

191191
@mock.patch('airflow.providers.google.cloud.sensors.gcs.GCSHook')
192192
def test_execute_timeout(self, mock_hook):
193-
task = GCSObjectsWtihPrefixExistenceSensor(
193+
task = GCSObjectsWithPrefixExistenceSensor(
194194
task_id="task-id", bucket=TEST_BUCKET, prefix=TEST_PREFIX, poke_interval=0, timeout=1
195195
)
196196
mock_hook.return_value.list.return_value = []

0 commit comments

Comments
 (0)