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

 ##########
 File path: airflow/hooks/base_hook.py
 ##########
 @@ -72,15 +72,16 @@ def get_connections(cls, conn_id):  # type: (str) -> 
Iterable[Connection]
         return conns
 
     @classmethod
-    def get_connection(cls, conn_id):  # type: (str) -> Connection
+    def get_connection(cls, conn_id: str) -> Connection:
         conn = random.choice(list(cls.get_connections(conn_id)))
         if conn.host:
             log = LoggingMixin().log
             log.info("Using connection to: %s", conn.debug_info())
         return conn
 
     @classmethod
-    def get_hook(cls, conn_id):  # type: (str) -> BaseHook
+    def get_hook(cls, conn_id: str) -> "BaseHook":
 
 Review comment:
   It's a bummer. But maybe we could consider moving this method out of 
BaseHook module. It is used in just a handful of places, and maybe simply we 
could define an auto_hook.py (or similar) module with just one get_hook() 
method - importing base_hook from the base_hook.py ? That would solve the 
string future reference problem. 

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