Skip to content

Commit bd4491a

Browse files
authored
chore(ci): Fix ruff v0.13.0 adds ruff rule RUF059 (#316)
1 parent b80180b commit bd4491a

File tree

10 files changed

+21
-21
lines changed

10 files changed

+21
-21
lines changed

pylib/gyp/generator/android.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ def WriteRules(self, rules, extra_sources, extra_outputs):
378378
inputs = rule.get("inputs")
379379
for rule_source in rule.get("rule_sources", []):
380380
(rule_source_dirname, rule_source_basename) = os.path.split(rule_source)
381-
(rule_source_root, rule_source_ext) = os.path.splitext(
381+
(rule_source_root, _rule_source_ext) = os.path.splitext(
382382
rule_source_basename
383383
)
384384

pylib/gyp/generator/compile_commands_json.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def resolve(filename):
100100
def GenerateOutput(target_list, target_dicts, data, params):
101101
per_config_commands = {}
102102
for qualified_target, target in target_dicts.items():
103-
build_file, target_name, toolset = gyp.common.ParseQualifiedTarget(
103+
build_file, _target_name, _toolset = gyp.common.ParseQualifiedTarget(
104104
qualified_target
105105
)
106106
if IsMac(params):

pylib/gyp/generator/gypd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
def GenerateOutput(target_list, target_dicts, data, params):
7474
output_files = {}
7575
for qualified_target in target_list:
76-
[input_file, target] = gyp.common.ParseQualifiedTarget(qualified_target)[0:2]
76+
[input_file, _target] = gyp.common.ParseQualifiedTarget(qualified_target)[0:2]
7777

7878
if input_file[-4:] != ".gyp":
7979
continue

pylib/gyp/generator/make.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1169,7 +1169,7 @@ def WriteRules(
11691169
for rule_source in rule.get("rule_sources", []):
11701170
dirs = set()
11711171
(rule_source_dirname, rule_source_basename) = os.path.split(rule_source)
1172-
(rule_source_root, rule_source_ext) = os.path.splitext(
1172+
(rule_source_root, _rule_source_ext) = os.path.splitext(
11731173
rule_source_basename
11741174
)
11751175

pylib/gyp/generator/msvs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1666,7 +1666,7 @@ def _HandlePreCompiledHeaders(p, sources, spec):
16661666
p.AddFileConfig(
16671667
source, _ConfigFullName(config_name, config), {}, tools=[tool]
16681668
)
1669-
basename, extension = os.path.splitext(source)
1669+
_basename, extension = os.path.splitext(source)
16701670
if extension == ".c":
16711671
extensions_excluded_from_precompile = [".cc", ".cpp", ".cxx"]
16721672
else:
@@ -1677,7 +1677,7 @@ def DisableForSourceTree(source_tree):
16771677
if isinstance(source, MSVSProject.Filter):
16781678
DisableForSourceTree(source.contents)
16791679
else:
1680-
basename, extension = os.path.splitext(source)
1680+
_basename, extension = os.path.splitext(source)
16811681
if extension in extensions_excluded_from_precompile:
16821682
for config_name, config in spec["configurations"].items():
16831683
tool = MSVSProject.Tool(
@@ -3579,7 +3579,7 @@ def _AddSources2(
35793579
# If the precompiled header is generated by a C source,
35803580
# we must not try to use it for C++ sources,
35813581
# and vice versa.
3582-
basename, extension = os.path.splitext(precompiled_source)
3582+
_basename, extension = os.path.splitext(precompiled_source)
35833583
if extension == ".c":
35843584
extensions_excluded_from_precompile = [
35853585
".cc",

pylib/gyp/generator/xcode.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ def AddSourceToTarget(source, type, pbxp, xct):
531531
library_extensions = ["a", "dylib", "framework", "o"]
532532

533533
basename = posixpath.basename(source)
534-
(root, ext) = posixpath.splitext(basename)
534+
(_root, ext) = posixpath.splitext(basename)
535535
if ext:
536536
ext = ext[1:].lower()
537537

@@ -696,7 +696,7 @@ def GenerateOutput(target_list, target_dicts, data, params):
696696
xcode_targets = {}
697697
xcode_target_to_target_dict = {}
698698
for qualified_target in target_list:
699-
[build_file, target_name, toolset] = gyp.common.ParseQualifiedTarget(
699+
[build_file, target_name, _toolset] = gyp.common.ParseQualifiedTarget(
700700
qualified_target
701701
)
702702

@@ -1215,7 +1215,7 @@ def GenerateOutput(target_list, target_dicts, data, params):
12151215

12161216
# Add "sources".
12171217
for source in spec.get("sources", []):
1218-
(source_root, source_extension) = posixpath.splitext(source)
1218+
(_source_root, source_extension) = posixpath.splitext(source)
12191219
if source_extension[1:] not in rules_by_ext:
12201220
# AddSourceToTarget will add the file to a root group if it's not
12211221
# already there.
@@ -1227,7 +1227,7 @@ def GenerateOutput(target_list, target_dicts, data, params):
12271227
# it's a bundle of any type.
12281228
if is_bundle:
12291229
for resource in tgt_mac_bundle_resources:
1230-
(resource_root, resource_extension) = posixpath.splitext(resource)
1230+
(_resource_root, resource_extension) = posixpath.splitext(resource)
12311231
if resource_extension[1:] not in rules_by_ext:
12321232
AddResourceToTarget(resource, pbxp, xct)
12331233
else:

pylib/gyp/input.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2757,7 +2757,7 @@ def ValidateRulesInTarget(target, target_dict, extra_sources_for_rules):
27572757
source_keys.extend(extra_sources_for_rules)
27582758
for source_key in source_keys:
27592759
for source in target_dict.get(source_key, []):
2760-
(source_root, source_extension) = os.path.splitext(source)
2760+
(_source_root, source_extension) = os.path.splitext(source)
27612761
if source_extension.startswith("."):
27622762
source_extension = source_extension[1:]
27632763
if source_extension == rule_extension:

pylib/gyp/xcode_ninja.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
def _WriteWorkspace(main_gyp, sources_gyp, params):
2424
"""Create a workspace to wrap main and sources gyp paths."""
25-
(build_file_root, build_file_ext) = os.path.splitext(main_gyp)
25+
(build_file_root, _build_file_ext) = os.path.splitext(main_gyp)
2626
workspace_path = build_file_root + ".xcworkspace"
2727
options = params["options"]
2828
if options.generator_output:

pylib/gyp/xcodeproj_file.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ def Children(self):
487487

488488
children = []
489489
for property, attributes in self._schema.items():
490-
(is_list, property_type, is_strong) = attributes[0:3]
490+
(is_list, _property_type, is_strong) = attributes[0:3]
491491
if is_strong and property in self._properties:
492492
if not is_list:
493493
children.append(self._properties[property])
@@ -913,7 +913,7 @@ def VerifyHasRequiredProperties(self):
913913
# TODO(mark): A stronger verification mechanism is needed. Some
914914
# subclasses need to perform validation beyond what the schema can enforce.
915915
for property, attributes in self._schema.items():
916-
(is_list, property_type, is_strong, is_required) = attributes[0:4]
916+
(_is_list, _property_type, _is_strong, is_required) = attributes[0:4]
917917
if is_required and property not in self._properties:
918918
raise KeyError(self.__class__.__name__ + " requires " + property)
919919

@@ -923,7 +923,7 @@ def _SetDefaultsFromSchema(self):
923923

924924
defaults = {}
925925
for property, attributes in self._schema.items():
926-
(is_list, property_type, is_strong, is_required) = attributes[0:4]
926+
(_is_list, _property_type, _is_strong, is_required) = attributes[0:4]
927927
if (
928928
is_required
929929
and len(attributes) >= 5
@@ -1616,7 +1616,7 @@ def __init__(self, properties=None, id=None, parent=None):
16161616
prop_name = "lastKnownFileType"
16171617
else:
16181618
basename = posixpath.basename(self._properties["path"])
1619-
(root, ext) = posixpath.splitext(basename)
1619+
(_root, ext) = posixpath.splitext(basename)
16201620
# Check the map using a lowercase extension.
16211621
# TODO(mark): Maybe it should try with the original case first and fall
16221622
# back to lowercase, in case there are any instances where case
@@ -2010,7 +2010,7 @@ def Name(self):
20102010
return "Frameworks"
20112011

20122012
def FileGroup(self, path):
2013-
(root, ext) = posixpath.splitext(path)
2013+
(_root, ext) = posixpath.splitext(path)
20142014
if ext != "":
20152015
ext = ext[1:].lower()
20162016
if ext == "o":

tools/graphviz.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def WriteGraph(edges):
4747
# Bucket targets by file.
4848
files = collections.defaultdict(list)
4949
for src, dst in edges.items():
50-
build_file, target_name, toolset = ParseTarget(src)
50+
build_file, target_name, _toolset = ParseTarget(src)
5151
files[build_file].append(src)
5252

5353
print("digraph D {")
@@ -62,14 +62,14 @@ def WriteGraph(edges):
6262
# If there's only one node for this file, simplify
6363
# the display by making it a box without an internal node.
6464
target = targets[0]
65-
build_file, target_name, toolset = ParseTarget(target)
65+
build_file, target_name, _toolset = ParseTarget(target)
6666
print(f' "{target}" [shape=box, label="{filename}\\n{target_name}"]')
6767
else:
6868
# Group multiple nodes together in a subgraph.
6969
print(' subgraph "cluster_%s" {' % filename)
7070
print(' label = "%s"' % filename)
7171
for target in targets:
72-
build_file, target_name, toolset = ParseTarget(target)
72+
build_file, target_name, _toolset = ParseTarget(target)
7373
print(f' "{target}" [label="{target_name}"]')
7474
print(" }")
7575

0 commit comments

Comments
 (0)