Add prefer_global_from_import
Description
Adding a prefer_global_from_import configuration option for pick the "global" form of import over the module one.
- from pkg import mod1
- mod1.AClass()
+ from pkg.mod1 import AClass
+ AClass()
Checklist (delete if not relevant):
- [x] I have added tests that prove my fix is effective or that my feature works
- [x] I have updated CHANGELOG.md
Hi @nicoolas25, thank you for the contribution.
Adding this configuration would imply that there will be two conflicting configuration options with the prefer_module_from_imports and prefer_global_from_imports and both can't be set to True at the same time.
I think the config options should've been merged.
The prefer_module_from_imports config option should be deprecated and the new config option, e.g. preferred_import_style should have string values like auto, normal-import, from-module, from-global, etc. This new config option should take precedence over the legacy value.