potiuk commented on code in PR #36186:
URL: https://github.com/apache/airflow/pull/36186#discussion_r1424629695


##########
airflow/io/__init__.py:
##########
@@ -86,7 +93,13 @@ def get_fs(
         raise ValueError(f"No filesystem registered for scheme {scheme}") from 
None
 
     options = storage_options or {}
-    return fs(conn_id, options)
+    # MyPy does not recognize dynamic parameters inspection when we call the 
method, and we have to do
+    # it for compatibility reasons with already released providers, that's why 
we need to ignore
+    # mypy errors here
+    parameters = inspect.signature(fs).parameters
+    if len(parameters) == 1:
+        return fs(conn_id)  # type: ignore[call-arg]
+    return fs(conn_id, options)  # type: ignore[call-arg]

Review Comment:
   yeah - it's a bit more expensive, but It happens only once at discovery. 
   
   I thought about it too but I decided dointg it more explicitly is better. It 
is much better to handle (potential) patterns where we add more parameters 
(which might happen). In this case we will just add `elif len() ==2`  - it 
would be difficult to distinguish those cases with exception.



-- 
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: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to