Skip to content

Commit 0cbc7e5

Browse files
committed
Run flake8-lazy over package sources in tox
flake8-lazy ships no pytest plugin, so invoke its CLI from the primary Avoid test dirs where lazy-import hygiene is irrelevant (if easy to exclude).
1 parent 5b543ed commit 0cbc7e5

46 files changed

Lines changed: 126 additions & 109 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎distutils/_modified.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
__lazy_modules__ = {
66
"collections",
77
"collections.abc",
8-
f"{__spec__.parent}.errors",
98
"jaraco",
109
"jaraco.functools",
10+
f"{__spec__.parent}.errors",
1111
}
1212

1313
import functools

‎distutils/archive_util.py‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,11 @@
88
__lazy_modules__ = {
99
"collections",
1010
"collections.abc",
11+
"types",
1112
f"{__spec__.parent}._log",
1213
f"{__spec__.parent}.dir_util",
1314
f"{__spec__.parent}.errors",
1415
f"{__spec__.parent}.spawn",
15-
"grp",
16-
"pwd",
17-
"types",
18-
"zipfile",
1916
}
2017

2118
import contextlib
@@ -31,13 +28,13 @@
3128

3229
zipfile: ModuleType | None = None
3330
with contextlib.suppress(ImportError):
34-
import zipfile
31+
import zipfile # noqa: LZY101
3532

3633
grp: ModuleType | None = None
3734
pwd: ModuleType | None = None
3835
with contextlib.suppress(ImportError):
39-
import grp
40-
import pwd
36+
import grp # noqa: LZY101
37+
import pwd # noqa: LZY101
4138

4239

4340
def _get_gid(name):

‎distutils/cmd.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99
__lazy_modules__ = {
1010
"collections",
1111
"collections.abc",
12+
"re",
1213
f"{__spec__.parent}._log",
1314
f"{__spec__.parent}.errors",
14-
"logging",
15-
"re",
1615
}
1716

1817
import logging

‎distutils/command/bdist.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
__lazy_modules__ = {
99
"collections",
1010
"collections.abc",
11-
f"{(__spec__.parent or '').rsplit('.', 1)[0]}.errors",
12-
f"{(__spec__.parent or '').rsplit('.', 1)[0]}.util",
1311
"warnings",
12+
f"{(__spec__.parent or '').rsplit('.', 1)[0]}.errors",
1413
}
1514

1615
import os

‎distutils/command/bdist_dumb.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@
66

77
__lazy_modules__ = {
88
"distutils._log",
9+
"typing",
910
f"{(__spec__.parent or '').rsplit('.', 1)[0]}.dir_util",
1011
f"{(__spec__.parent or '').rsplit('.', 1)[0]}.errors",
1112
f"{(__spec__.parent or '').rsplit('.', 1)[0]}.sysconfig",
12-
f"{(__spec__.parent or '').rsplit('.', 1)[0]}.util",
13-
"typing",
1413
}
1514

1615
import os

‎distutils/command/bdist_rpm.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55

66
__lazy_modules__ = {
77
"distutils._log",
8+
"subprocess",
9+
"typing",
810
f"{(__spec__.parent or '').rsplit('.', 1)[0]}.debug",
911
f"{(__spec__.parent or '').rsplit('.', 1)[0]}.errors",
1012
f"{(__spec__.parent or '').rsplit('.', 1)[0]}.file_util",
1113
f"{(__spec__.parent or '').rsplit('.', 1)[0]}.sysconfig",
12-
"subprocess",
13-
"typing",
1414
}
1515

1616
import os

‎distutils/command/build.py‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@
77
__lazy_modules__ = {
88
"collections",
99
"collections.abc",
10-
f"{(__spec__.parent or '').rsplit('.', 1)[0]}.ccompiler",
11-
f"{(__spec__.parent or '').rsplit('.', 1)[0]}.errors",
12-
f"{(__spec__.parent or '').rsplit('.', 1)[0]}.util",
1310
"sysconfig",
1411
"typing",
12+
f"{(__spec__.parent or '').rsplit('.', 1)[0]}.errors",
1513
}
1614

1715
import os

‎distutils/command/build_clib.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,9 @@
1818
"collections",
1919
"collections.abc",
2020
"distutils._log",
21-
f"{(__spec__.parent or '').rsplit('.', 1)[0]}.ccompiler",
21+
"typing",
2222
f"{(__spec__.parent or '').rsplit('.', 1)[0]}.errors",
2323
f"{(__spec__.parent or '').rsplit('.', 1)[0]}.sysconfig",
24-
"typing",
2524
}
2625

2726
import os

‎distutils/command/build_ext.py‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,12 @@
99
__lazy_modules__ = {
1010
"collections",
1111
"collections.abc",
12-
"contextlib",
1312
"distutils._log",
13+
"typing",
1414
f"{(__spec__.parent or '').rsplit('.', 1)[0]}._modified",
15-
f"{(__spec__.parent or '').rsplit('.', 1)[0]}.ccompiler",
1615
f"{(__spec__.parent or '').rsplit('.', 1)[0]}.errors",
1716
f"{(__spec__.parent or '').rsplit('.', 1)[0]}.extension",
1817
f"{(__spec__.parent or '').rsplit('.', 1)[0]}.sysconfig",
19-
f"{(__spec__.parent or '').rsplit('.', 1)[0]}.util",
20-
"typing",
2118
}
2219

2320
import contextlib

‎distutils/command/build_py.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
__lazy_modules__ = {
66
"distutils._log",
7-
f"{(__spec__.parent or '').rsplit('.', 1)[0]}.errors",
8-
f"{(__spec__.parent or '').rsplit('.', 1)[0]}.util",
97
"glob",
108
"importlib",
119
"importlib.util",
1210
"typing",
11+
f"{(__spec__.parent or '').rsplit('.', 1)[0]}.errors",
12+
f"{(__spec__.parent or '').rsplit('.', 1)[0]}.util",
1313
}
1414

1515
import glob

0 commit comments

Comments
 (0)