Skip to content

Commit bd3594e

Browse files
authored
Merge pull request #5287 from Avasam/Configuring-lint.flake8-comprehensions.allow-dict-calls-with-keyword-arguments-instead-of-disabling-C408
Configuring lint.flake8-comprehensions.allow-dict-calls-with-keyword-arguments instead of disabling C408
2 parents e9904b0 + c55f52b commit bd3594e

4 files changed

Lines changed: 8 additions & 9 deletions

File tree

‎ruff.toml‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ ignore = [
4646
"COM812",
4747
"COM819",
4848

49-
# unnecessary-collection-call: retain the dict(a=1) call style rather than
50-
# forcing string-keyed literals. See jaraco/skeleton#210.
51-
"C408",
52-
5349
# local
5450
"PERF203", # try-except-in-loop, micro-optimisation with many false-positive. Worth checking but don't block CI
5551
"PT007", # temporarily disabled, TODO: configure and standardize to preference
@@ -78,6 +74,9 @@ sections.delayed = ["distutils"]
7874
[lint.flake8-annotations]
7975
ignore-fully-untyped = true
8076

77+
[lint.flake8-comprehensions]
78+
allow-dict-calls-with-keyword-arguments = true
79+
8180
[format]
8281
# Enable preview to get hugged parenthesis unwrapping and other nice surprises
8382
# See https://github.com/jaraco/skeleton/pull/133#issuecomment-2239538373

‎setuptools/command/build_clib.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def build_libraries(self, libraries) -> None:
4040
# Make sure everything is the correct type.
4141
# obj_deps should be a dictionary of keys as sources
4242
# and a list/tuple of files that are its dependencies.
43-
obj_deps = build_info.get('obj_deps', dict())
43+
obj_deps = build_info.get('obj_deps', {})
4444
if not isinstance(obj_deps, dict):
4545
raise DistutilsSetupError(
4646
f"in 'libraries' option (library '{lib_name}'), "
@@ -51,7 +51,7 @@ def build_libraries(self, libraries) -> None:
5151

5252
# Get the global dependencies that are specified by the '' key.
5353
# These will go into every source's dependency list.
54-
global_deps = obj_deps.get('', list())
54+
global_deps = obj_deps.get('', [])
5555
if not isinstance(global_deps, (list, tuple)):
5656
raise DistutilsSetupError(
5757
f"in 'libraries' option (library '{lib_name}'), "
@@ -64,7 +64,7 @@ def build_libraries(self, libraries) -> None:
6464
for source in sources:
6565
src_deps = [source]
6666
src_deps.extend(global_deps)
67-
extra_deps = obj_deps.get(source, list())
67+
extra_deps = obj_deps.get(source, [])
6868
if not isinstance(extra_deps, (list, tuple)):
6969
raise DistutilsSetupError(
7070
f"in 'libraries' option (library '{lib_name}'), "

‎setuptools/msvc.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class winreg:
3838
HKEY_LOCAL_MACHINE = None
3939
HKEY_CLASSES_ROOT = None
4040

41-
environ: dict[str, str] = dict()
41+
environ: dict[str, str] = {}
4242

4343

4444
class PlatformInfo:

‎setuptools/tests/environment.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def run_setup_py(cmd, pypath=None, path=None, data_stream=0, env=None):
4949
code directly to prevent accidental behavior issues
5050
"""
5151
if env is None:
52-
env = dict()
52+
env = {}
5353
for envname in os.environ:
5454
env[envname] = os.environ[envname]
5555

0 commit comments

Comments
 (0)