BasPH commented on a change in pull request #5327: [AIRFLOW-4205] Replace type 
comments by native Python typing
URL: https://github.com/apache/airflow/pull/5327#discussion_r287570939
 
 

 ##########
 File path: airflow/models/baseoperator.py
 ##########
 @@ -238,40 +238,40 @@ class derived from this one results in the creation of a 
task object,
     @apply_defaults
     def __init__(
         self,
-        task_id,  # type: str
-        owner=configuration.conf.get('operators', 'DEFAULT_OWNER'),  # type: 
str
-        email=None,  # type: Optional[str]
-        email_on_retry=True,  # type: bool
-        email_on_failure=True,  # type: bool
-        retries=0,  # type: int
-        retry_delay=timedelta(seconds=300),  # type: timedelta
-        retry_exponential_backoff=False,  # type: bool
-        max_retry_delay=None,  # type: Optional[datetime]
-        start_date=None,  # type: Optional[datetime]
-        end_date=None,  # type: Optional[datetime]
+        task_id: str,
+        owner: str = configuration.conf.get('operators', 'DEFAULT_OWNER'),
+        email: Optional[str] = None,
 
 Review comment:
   I agree it seems sensible to remove the optionals. However when reading the 
docs (https://docs.python.org/3/library/typing.html#typing.Optional), it says 
the Optional is appropriate:
   
   > ... if an explicit value of None is allowed, the use of Optional is 
appropriate, whether the argument is optional or not. For example:
   > 
   > ```python
   > def foo(arg: Optional[int] = None) -> None:
   >     ...
   > ```

----------------------------------------------------------------
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

Reply via email to