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/12/16 22:21:36 UTC
[GitHub] [airflow] josh-fell commented on a change in pull request #20034: Fix most MyPy errors for Airflow decorators
josh-fell commented on a change in pull request #20034:
URL: https://github.com/apache/airflow/pull/20034#discussion_r770960042
##########
File path: airflow/decorators/base.py
##########
@@ -101,22 +102,22 @@ class DecoratedOperator(BaseOperator):
:type kwargs_to_upstream: dict
"""
- template_fields: Iterable[str] = ('op_args', 'op_kwargs')
+ template_fields: Sequence[str] = ('op_args', 'op_kwargs')
template_fields_renderers = {"op_args": "py", "op_kwargs": "py"}
# since we won't mutate the arguments, we should just do the shallow copy
# there are some cases we can't deepcopy the objects (e.g protobuf).
- shallow_copy_attrs = ('python_callable',)
+ shallow_copy_attrs: Tuple[str, ...] = ('python_callable',)
Review comment:
The `Tuple` typing is consistent with `BaseOperator`. I can change both to `Sequence`. Otherwise MyPy cries if we just change `DecoratedOperator`:
```
airflow/decorators/base.py:110: error: Incompatible types in assignment (expression has type "Sequence[str]", base class "BaseOperator" defined the type as "Tuple[str, ...]")
shallow_copy_attrs: Sequence[str] = ('python_callable',)
```
--
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