-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cyclic-import warning detects a non-issue situation #6983
Comments
|
The thing is that we have to turn this warning ON or OFF, only because of this issue. While typically it provides useful info. |
See #850 |
#850 is similar, but not the same. We don't want to import inside functions. This is a legitimate import at the file top level. |
As I said this message is about style we're not going to change it. You need to be able to disable it locally though (in a function or elsewhere) without disabling for the whole project. |
To be able to do this, we'd have to switch to a function-local import, which is something we don't want to. |
@praiskup What @Pierre-Sassoulas is talking about is that we should fix It's in the spirit of the message to report on cases such as these, and as explained in the linked message it doesn't make a lot of sense to change the spirit of the message. After that has been merged you should be able to add a disable to module/lines where you want to use this pattern. |
Bug description
The problem is that this warning is currently printed by pylint:
While this technically is a cyclic-import, practically it should be a non-issue. Both the cyclic cross-module uses are delayed to the run-time, therefore all the module objects are correctly loaded when really needed.
Configuration
No response
Command used
Pylint output
pylint_mod/b.py:1:0: R0401: Cyclic import (pylint_mod.a -> pylint_mod.b) (cyclic-import)
Expected behavior
No error printed.
Pylint version
OS / Environment
No response
Additional dependencies
No response
The text was updated successfully, but these errors were encountered: