uranusjr commented on code in PR #22688:
URL: https://github.com/apache/airflow/pull/22688#discussion_r844760624


##########
airflow/cli/commands/connection_command.py:
##########
@@ -133,6 +135,25 @@ def _valid_uri(uri: str) -> bool:
     return uri_parts.scheme != '' and uri_parts.netloc != ''
 
 
+@lru_cache(maxsize=None)
+def _get_connection_types():
+    """Returns connection types available."""
+    _connection_types = ['fs', 'mesos_framework-id', 'email', 'generic']
+    providers_manager = ProvidersManager()
+    for connection_type, provider_info in providers_manager.hooks.items():
+        if provider_info:
+            _connection_types.append(connection_type)
+    return _connection_types
+
+
+def _valid_conn_type(conn_type: str) -> bool:
+    is_valid = False
+    conn_types = _get_connection_types()
+    if conn_type in conn_types:
+        is_valid = True
+    return is_valid

Review Comment:
   ```suggestion
   def _valid_conn_type(conn_type: str) -> bool:
       return conn_type in _get_connection_types()
   ```
   
   (Do we still need this function now it’s simplied to just one line?)



##########
airflow/cli/commands/connection_command.py:
##########
@@ -133,6 +135,25 @@ def _valid_uri(uri: str) -> bool:
     return uri_parts.scheme != '' and uri_parts.netloc != ''
 
 
+@lru_cache(maxsize=None)

Review Comment:
   Use `@cache` from `airflow.compat` instead



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to