diff --git a/pylib/gyp/MSVSProject.py b/pylib/gyp/MSVSProject.py index f0cfabe8..629f3f61 100644 --- a/pylib/gyp/MSVSProject.py +++ b/pylib/gyp/MSVSProject.py @@ -79,7 +79,7 @@ def __init__(self, project_path, version, name, guid=None, platforms=None): self.files_section = ["Files"] # Keep a dict keyed on filename to speed up access. - self.files_dict = dict() + self.files_dict = {} def AddToolFile(self, path): """Adds a tool file to the project. diff --git a/pylib/gyp/generator/analyzer.py b/pylib/gyp/generator/analyzer.py index 810d181a..1d04d3fc 100644 --- a/pylib/gyp/generator/analyzer.py +++ b/pylib/gyp/generator/analyzer.py @@ -440,7 +440,7 @@ def _GetUnqualifiedToTargetMapping(all_targets, to_find): result[extracted[1]] = all_targets[target_name] if not to_find: return result, [] - return result, [x for x in to_find] + return result, list(to_find) def _DoesTargetDependOnMatchingTargets(target): @@ -683,11 +683,9 @@ def find_matching_test_target_names(self): ) test_target_names_contains_all = "all" in self._test_target_names if test_target_names_contains_all: - test_targets = [ - x for x in (set(test_targets_no_all) | set(self._root_targets)) - ] + test_targets = list(set(test_targets_no_all) | set(self._root_targets)) else: - test_targets = [x for x in test_targets_no_all] + test_targets = list(test_targets_no_all) print("supplied test_targets") for target_name in self._test_target_names: print("\t", target_name) @@ -702,9 +700,9 @@ def find_matching_test_target_names(self): if matching_test_targets_contains_all: # Remove any of the targets for all that were not explicitly supplied, # 'all' is subsequentely added to the matching names below. - matching_test_targets = [ - x for x in (set(matching_test_targets) & set(test_targets_no_all)) - ] + matching_test_targets = list( + set(matching_test_targets) & set(test_targets_no_all) + ) print("matched test_targets") for target in matching_test_targets: print("\t", target.name) @@ -729,9 +727,7 @@ def find_matching_compile_target_names(self): self._supplied_target_names_no_all(), self._unqualified_mapping ) if "all" in self._supplied_target_names(): - supplied_targets = [ - x for x in (set(supplied_targets) | set(self._root_targets)) - ] + supplied_targets = list(set(supplied_targets) | set(self._root_targets)) print("Supplied test_targets & compile_targets") for target in supplied_targets: print("\t", target.name) diff --git a/pylib/gyp/generator/compile_commands_json.py b/pylib/gyp/generator/compile_commands_json.py index d4541291..39e85f5a 100644 --- a/pylib/gyp/generator/compile_commands_json.py +++ b/pylib/gyp/generator/compile_commands_json.py @@ -93,7 +93,7 @@ def resolve(filename): gyp.common.EncodePOSIXShellArgument(file), ) ) - commands.append(dict(command=command, directory=output_dir, file=file)) + commands.append({"command": command, "directory": output_dir, "file": file}) def GenerateOutput(target_list, target_dicts, data, params): diff --git a/pylib/gyp/generator/msvs.py b/pylib/gyp/generator/msvs.py index a98dd9a1..fddd8a0b 100644 --- a/pylib/gyp/generator/msvs.py +++ b/pylib/gyp/generator/msvs.py @@ -281,7 +281,7 @@ def _ToolSetOrAppend(tools, tool_name, setting, value, only_if_unset=False): else: value = [i.replace("/", "\\") for i in value] if not tools.get(tool_name): - tools[tool_name] = dict() + tools[tool_name] = {} tool = tools[tool_name] if setting == "CompileAsWinRT": return @@ -1186,7 +1186,7 @@ def _AddConfigurationToMSVSProject(p, spec, config_type, config_name, config): precompiled_header = config.get("msvs_precompiled_header") # Prepare the list of tools as a dictionary. - tools = dict() + tools = {} # Add in user specified msvs_settings. msvs_settings = config.get("msvs_settings", {}) MSVSSettings.ValidateMSVSSettings(msvs_settings) @@ -1810,7 +1810,7 @@ def _GetPathDict(root, path): parent, folder = os.path.split(path) parent_dict = _GetPathDict(root, parent) if folder not in parent_dict: - parent_dict[folder] = dict() + parent_dict[folder] = {} return parent_dict[folder] diff --git a/pyproject.toml b/pyproject.toml index 0e030cd7..c08f3481 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -87,8 +87,6 @@ select = [ # "TRY", # tryceratops ] ignore = [ - "C408", - "C416", "PLC1901", "PLR0402", "PLR2004", diff --git a/tools/pretty_sln.py b/tools/pretty_sln.py index 6ca0cd12..cf0638a2 100755 --- a/tools/pretty_sln.py +++ b/tools/pretty_sln.py @@ -34,10 +34,10 @@ def BuildProject(project, built, projects, deps): def ParseSolution(solution_file): # All projects, their clsid and paths. - projects = dict() + projects = {} # A list of dependencies associated with a project. - dependencies = dict() + dependencies = {} # Regular expressions that matches the SLN format. # The first line of a project definition. diff --git a/tools/pretty_vcproj.py b/tools/pretty_vcproj.py index 00d32deb..72c65d7f 100755 --- a/tools/pretty_vcproj.py +++ b/tools/pretty_vcproj.py @@ -21,7 +21,7 @@ __author__ = "nsylvain (Nicolas Sylvain)" ARGUMENTS = None -REPLACEMENTS = dict() +REPLACEMENTS = {} def cmp(x, y):