potiuk commented on code in PR #36186:
URL: https://github.com/apache/airflow/pull/36186#discussion_r1424966653
##########
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:
Also, this is pretty common pattern in Airflow already. We use inspect and
looking at parameters and comparing signatures of methods in quite a numer of
places already. I personally see it as much more explicit. But of course
nothing prevents us from changing it in the future if we agree it's a better
solution, this part is internal and can be changed any time.
--
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]