Skip to content

Commit

Permalink
Fix MyPy issues in AWS Sensors (#20863)
Browse files Browse the repository at this point in the history
Part of apache/airflow#19891

Before:

```
root@12e9fcfb4678:/opt/airflow# mypy --namespace-packages  airflow/providers/amazon/aws/sensors
airflow/providers/amazon/aws/sensors/s3.py:182: error: Incompatible types in assignment (expression has type "function", variable has type "Callable[..., bool]")  [assignment]
            check_fn: Callable[..., bool] = self.check_fn_user if self.check_fn_user is not None else self.check_fn
                                            ^
Found 1 error in 1 file (checked 33 source files)
```

After:

```
root@12e9fcfb4678:/opt/airflow# mypy --namespace-packages  airflow/providers/amazon/aws/sensors
Success: no issues found in 33 source files
```
GitOrigin-RevId: b15027410b4a985c15b1d7b2b2a0eedf2173f416
  • Loading branch information
kaxil authored and Cloud Composer Team committed Jul 10, 2022
1 parent ea66ca7 commit bdc90dc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions airflow/providers/amazon/aws/sensors/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,9 @@ def poke(self, context: 'Context'):
s3_objects = self.get_files(s3_hook=self.get_hook())
if not s3_objects:
return False
check_fn = self.check_fn if self.check_fn_user is None else self.check_fn_user
return check_fn(s3_objects)
if self.check_fn_user is not None:
return self.check_fn_user(s3_objects)
return self.check_fn(s3_objects)

def get_files(self, s3_hook: S3Hook, delimiter: Optional[str] = '/') -> List:
"""Gets a list of files in the bucket"""
Expand Down

0 comments on commit bdc90dc

Please sign in to comment.