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_r268934073
 
 

 ##########
 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:
   I think this is a little unwieldy for one line:
   
   ```python
   def get(cls, key, default_var=__NO_DEFAULT_SENTINEL, deserialize=False, 
session=None):  # type: (str, Any, bool, Any) -> Any
   ```
   
   We could split the definition over a few lines, but then we're getting close 
to the original formatting:
   
   ```python
   def get(
       cls, key, default_var=__NO_DEFAULT_SENTINEL, deserialize=False, 
session=None
   ):  # type: (str, Any, bool, Any) -> Any
   ```
   
   I don't have a strong preference between the second example and the current 
code. But I think it would be even better to adopt 
https://cwiki.apache.org/confluence/display/AIRFLOW/AIP-6+Enforce+the+usage+of+a+code+formatter
 and avoid having these conversations.

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