This is an archive of the discontinued Mercurial Phabricator instance.

import-checker: allow relative import a module being checked
ClosedPublic

Authored by quark on Aug 28 2017, 9:06 PM.

Details

Summary

This would make the checker more friendly for 3rd-party code. For example,

In remotefilelog/x.py, it may have:

from . import shallowutils

That could trigger "relative import of stdlib module" if
"remotefilelog" was installed in the system. If the module being checked
conflicts with the system module, it makes sense to not treat that module as
system module. This patch makes it so.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

quark created this revision.Aug 28 2017, 9:06 PM
quark edited the summary of this revision. (Show Details)Aug 28 2017, 9:09 PM
ryanmce added inline comments.
tests/test-imports-checker.t
128–140

Shallow? Do you mean "allow"?

quark added inline comments.Aug 29 2017, 8:41 AM
tests/test-imports-checker.t
128–140

Good catch. Should be "shadowing". Will change.

quark updated this revision to Diff 1411.Aug 29 2017, 3:27 PM
quark updated this revision to Diff 1517.Aug 31 2017, 5:57 PM
yuja accepted this revision.Sep 1 2017, 9:06 AM
yuja added a subscriber: yuja.

Queued, thanks.

This revision is now accepted and ready to land.Sep 1 2017, 9:06 AM
This revision was automatically updated to reflect the committed changes.