jmcarp commented on a change in pull request #4926: [AIRFLOW-4104] Add type
annotations to common classes.
URL: https://github.com/apache/airflow/pull/4926#discussion_r267152078
##########
File path: airflow/models/__init__.py
##########
@@ -4290,7 +4291,13 @@ def setdefault(cls, key, default,
deserialize_json=False):
@classmethod
@provide_session
- def get(cls, key, default_var=__NO_DEFAULT_SENTINEL,
deserialize_json=False, session=None):
+ def get(
+ cls,
+ key, # type: str
+ default_var=__NO_DEFAULT_SENTINEL, # type: Any
+ deserialize_json=False, # type: bool
+ session=None
Review comment:
Either way works. From https://mypy.readthedocs.io/en/latest/python2.html,
we can annotate a function like this:
```python
def hello(): # type: () -> None
print 'hello'
```
In this case, the arguments and the type annotation wouldn't fit on a single
line, so I thought it made sense to split the arguments up, but I'd be happy to
reformat.
----------------------------------------------------------------
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