kaxil commented on a change in pull request #5965: [AIRFLOW-5359] Update type
annotations in BaseOperator
URL: https://github.com/apache/airflow/pull/5965#discussion_r319719664
##########
File path: airflow/models/baseoperator.py
##########
@@ -262,38 +262,38 @@ def __init__(
self,
task_id: str,
owner: str = configuration.conf.get('operators', 'DEFAULT_OWNER'),
- email: Optional[str] = None,
+ email: str = None,
email_on_retry: bool = True,
email_on_failure: bool = True,
retries: int = None,
retry_delay: timedelta = timedelta(seconds=300),
retry_exponential_backoff: bool = False,
- max_retry_delay: Optional[datetime] = None,
- start_date: Optional[datetime] = None,
- end_date: Optional[datetime] = None,
+ max_retry_delay: datetime = None,
+ start_date: datetime = None,
+ end_date: datetime = None,
schedule_interval=None, # not hooked as of now
depends_on_past: bool = False,
wait_for_downstream: bool = False,
- dag: Optional[DAG] = None,
- params: Optional[Dict] = None,
- default_args: Optional[Dict] = None,
+ dag: DAG = None,
+ params: Dict = None,
+ default_args: Dict = None,
priority_weight: int = 1,
weight_rule: str = WeightRule.DOWNSTREAM,
queue: str = configuration.conf.get('celery', 'default_queue'),
pool: str = Pool.DEFAULT_POOL_NAME,
- sla: Optional[timedelta] = None,
- execution_timeout: Optional[timedelta] = None,
- on_failure_callback: Optional[Callable] = None,
- on_success_callback: Optional[Callable] = None,
- on_retry_callback: Optional[Callable] = None,
Review comment:
Thanks @potiuk for that link.
>Following discussion in python/typing#275, there is a consensus that it is
better to require optional types to be made explicit. This PR changes the
wording of PEP 484 to allow, but not require, type checkers to treat a None
default as implicitly making an argument Optional.
So please let's not change this
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services