Submitter | timeless@mozdev.org |
---|---|
Date | March 30, 2016, 9:24 a.m. |
Message ID | <9bdba93f0afd6ffe0876.1459329844@waste.org> |
Download | mbox | patch |
Permalink | /patch/14181/ |
State | Changes Requested |
Delegated to: | Yuya Nishihara |
Headers | show |
Comments
On Wed, 30 Mar 2016 04:24:04 -0500, timeless wrote: > # HG changeset patch > # User timeless <timeless@mozdev.org> > # Date 1459325315 0 > # Wed Mar 30 08:08:35 2016 +0000 > # Node ID 9bdba93f0afd6ffe087663510f5198fdb8e40536 > # Parent b051243155761ace5b23e98f8dd7a1b527ed1077 > import-checker: check topname in stdlib_modules > > ctypes.util was being rejected, which is silly. > > diff --git a/contrib/import-checker.py b/contrib/import-checker.py > --- a/contrib/import-checker.py > +++ b/contrib/import-checker.py > @@ -407,8 +407,9 @@ > > lastname = name > > + topname = name.split('.')[0] > # stdlib imports should be before local imports. > - stdlib = name in stdlib_modules > + stdlib = topname in stdlib_modules or name in stdlib_modules Do you mean ctypes.util isn't included in stdlib_modules? That sounds like a bug of list_stdlib_modules().
Patch
diff --git a/contrib/import-checker.py b/contrib/import-checker.py --- a/contrib/import-checker.py +++ b/contrib/import-checker.py @@ -407,8 +407,9 @@ lastname = name + topname = name.split('.')[0] # stdlib imports should be before local imports. - stdlib = name in stdlib_modules + stdlib = topname in stdlib_modules or name in stdlib_modules if stdlib and seenlocal and node.col_offset == root_col_offset: yield msg('stdlib import "%s" follows local import: %s', name, seenlocal) @@ -417,7 +418,6 @@ seenlocal = name # Import of sibling modules should use relative imports. - topname = name.split('.')[0] if topname == topmodule: yield msg('import should be relative: %s', name)