Patchwork [1,of,5] import-checker: force 'logging' to stdlib module

login
register
mail settings
Submitter Gregory Szorc
Date Dec. 23, 2015, 8:46 p.m.
Message ID <fa41eef558351442bb82.1450903603@7.1.168.192.in-addr.arpa>
Download mbox | patch
Permalink /patch/12314/
State Accepted
Delegated to: Yuya Nishihara
Headers show

Comments

Gregory Szorc - Dec. 23, 2015, 8:46 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1450902444 28800
#      Wed Dec 23 12:27:24 2015 -0800
# Node ID fa41eef558351442bb828ef8b573f3b450bd05c5
# Parent  e2aa9c4030c4109e5efa50462ffc6048ca30106f
import-checker: force 'logging' to stdlib module

Not sure why this isn't getting picked up. Perhaps we're not handling
stdlib paths that have sub-modules? Something to investigate for another
day...
Yuya Nishihara - Dec. 27, 2015, 2:51 p.m.
On Wed, 23 Dec 2015 12:46:43 -0800, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc@gmail.com>
> # Date 1450902444 28800
> #      Wed Dec 23 12:27:24 2015 -0800
> # Node ID fa41eef558351442bb828ef8b573f3b450bd05c5
> # Parent  e2aa9c4030c4109e5efa50462ffc6048ca30106f
> import-checker: force 'logging' to stdlib module

Pushed 1, 2, 4 and 5 to the clowncopter, thanks.

> Not sure why this isn't getting picked up. Perhaps we're not handling
> stdlib paths that have sub-modules? Something to investigate for another
> day...

Yep, it ignores __init__.py directory. I'll fix it.

Patch

diff --git a/contrib/import-checker.py b/contrib/import-checker.py
--- a/contrib/import-checker.py
+++ b/contrib/import-checker.py
@@ -179,9 +179,9 @@  def list_stdlib_modules():
     # consider them stdlib.
     for m in ['msvcrt', '_winreg']:
         yield m
     # These get missed too
-    for m in 'ctypes', 'ctypes.util', 'email', 'multiprocessing':
+    for m in 'ctypes', 'ctypes.util', 'email', 'logging', 'multiprocessing':
         yield m
     yield 'builtins' # python3 only
     for m in 'fcntl', 'grp', 'pwd', 'termios':  # Unix only
         yield m