Closed taion closed 6 years ago
I've been unsure about this approach (not a namespace special case), but I can't see any obvious downsides so I'll merge this and follow up with a commit making some cosmetic changes.
Thanks for merging this and cleaning it up!
I agree with you that my use case is a bit weird. I think ultimately it is a bit neater to not try to resolve imports when just trying to validate ordering, though.
Thanks again.
This is a different stab at https://github.com/PyCQA/flake8-import-order/pull/126 or https://github.com/PyCQA/flake8-import-order/commit/79540957450b20e7a8a382f6827f0f0a4c2c64cc, per https://github.com/PyCQA/flake8-import-order/issues/111#issuecomment-319143763, and it has Python 2 support.
Instead of caring about namespace packages per se, we just walk up the chain of all the parent packages, and take the first "hit". That way if you specify
foo.bar
inapplication_package_names
andfoo
inapplication_import_names
,foo.bar.baz
will get picked up underIMPORT_APP_PACKAGE
without reference to whatfoo.bar
actually is.I haven't updated the changelog or the other docs from https://github.com/PyCQA/flake8-import-order/commit/79540957450b20e7a8a382f6827f0f0a4c2c64cc. Want to hear if this is reasonable first.