Skip to content

Commit af9c1bb

Browse files
authored
Merge pull request #60770 from YOCKOW/W291
[Gardening] Remove trailing whitespaces in Python scripts. (W291)
2 parents 63b2290 + c1e154a commit af9c1bb

File tree

15 files changed

+31
-34
lines changed

15 files changed

+31
-34
lines changed

.flake8

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ ignore =
5151
# compliant (https://github.com/psf/black#slices).
5252
E203,
5353

54-
# FIXME: We should not have trailing whitespace.
55-
W291,
56-
5754
# Line breaks before binary operators are not explicitly disallowed in
5855
# PEP8, rather it should be consistent throughout the project. The black
5956
# tool puts them on new lines which is to be considered a best practice

benchmark/scripts/create_benchmark.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def create_benchmark_file(name):
6161

6262

6363
def add_import_benchmark(name):
64-
"""Adds an `import` statement to the `main.swift` file for the new
64+
"""Adds an `import` statement to the `main.swift` file for the new
6565
benchmark.
6666
"""
6767
relative_path = create_relative_path("../utils/main.swift")

utils/build_swift/build_swift/driver_arguments.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ def create_argument_parser():
352352
help='enable code coverage analysis in Swift (false, not-merged, '
353353
'merged).')
354354

355-
option('--swift-disable-dead-stripping', toggle_true,
355+
option('--swift-disable-dead-stripping', toggle_true,
356356
help="Turn off Darwin-specific dead stripping for Swift host tools")
357357

358358
option('--build-subdir', store,

utils/build_swift/build_swift/presets.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,9 +352,9 @@ def _get_preset(self, name):
352352
def _interpolate_preset_vars(self, preset, vars):
353353
interpolated_options = []
354354
for (name, value) in preset.options:
355-
# If the option is a key-value pair, e.g.
355+
# If the option is a key-value pair, e.g.
356356
# install-destdir=%(install_dir)s
357-
# interpolate the value. If it is a raw option, e.g.
357+
# interpolate the value. If it is a raw option, e.g.
358358
# %(some_flag)s
359359
# is a raw option without a value, expand the name.
360360
if value:

utils/gyb_syntax_support/CommonNodes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
Child('LeftBrace', kind='LeftBraceToken'),
6060
Child('Statements', kind='CodeBlockItemList',
6161
collection_element_name='Statement', is_indented=True),
62-
Child('RightBrace', kind='RightBraceToken',
62+
Child('RightBrace', kind='RightBraceToken',
6363
requires_leading_newline=True),
6464
]),
6565

utils/gyb_syntax_support/ExprNodes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@
446446

447447
Node('ClosureSignature', kind='Syntax',
448448
children=[
449-
Child('Attributes', kind='AttributeList',
449+
Child('Attributes', kind='AttributeList',
450450
collection_element_name='Attribute', is_optional=True),
451451
Child('Capture', kind='ClosureCaptureSignature',
452452
is_optional=True),
@@ -568,7 +568,7 @@
568568
traits=['Parenthesized'],
569569
children=[
570570
Child('Backslash', kind='BackslashToken'),
571-
Child('Delimiter', kind='RawStringDelimiterToken',
571+
Child('Delimiter', kind='RawStringDelimiterToken',
572572
is_optional=True),
573573
Child('LeftParen', kind='LeftParenToken',
574574
classification='StringInterpolationAnchor',
@@ -581,7 +581,7 @@
581581
# e.g. "abc \(foo()) def"
582582
Node('StringLiteralExpr', kind='Expr',
583583
children=[
584-
Child('OpenDelimiter', kind='RawStringDelimiterToken',
584+
Child('OpenDelimiter', kind='RawStringDelimiterToken',
585585
is_optional=True),
586586
Child('OpenQuote', kind='Token',
587587
token_choices=[
@@ -595,7 +595,7 @@
595595
'StringQuoteToken',
596596
'MultilineStringQuoteToken',
597597
]),
598-
Child('CloseDelimiter', kind='RawStringDelimiterToken',
598+
Child('CloseDelimiter', kind='RawStringDelimiterToken',
599599
is_optional=True),
600600
]),
601601

utils/gyb_syntax_support/Node.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Node(object):
1313

1414
def __init__(self, name, description=None, kind=None, traits=None,
1515
children=[], element=None, element_name=None,
16-
element_choices=None, omit_when_empty=False,
16+
element_choices=None, omit_when_empty=False,
1717
elements_separated_by_newline=False):
1818
self.syntax_kind = name
1919
self.element_name = element_name
@@ -24,7 +24,7 @@ def __init__(self, name, description=None, kind=None, traits=None,
2424

2525
self.traits = traits or []
2626
self.children = []
27-
# Add implicitly generated UnexpectedNodes children in between any two
27+
# Add implicitly generated UnexpectedNodes children in between any two
2828
# defined children
2929
if kind != 'SyntaxCollection':
3030
for i in range(2 * len(children)):
@@ -35,8 +35,8 @@ def __init__(self, name, description=None, kind=None, traits=None,
3535
name = 'UnexpectedBetween%sAnd%s' % \
3636
(children[int(i / 2) - 1].name, children[int(i / 2)].name)
3737
self.children.append(Child(
38-
name,
39-
kind='UnexpectedNodes',
38+
name,
39+
kind='UnexpectedNodes',
4040
collection_element_name=name,
4141
is_optional=True
4242
))

utils/gyb_syntax_support/StmtNodes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,14 @@
7575
Child('GuardResult', kind='Expr'),
7676
]),
7777

78-
# for-in-stmt -> label? ':'?
78+
# for-in-stmt -> label? ':'?
7979
# 'for' 'try'? 'await'? 'case'? pattern 'in' expr 'where'?
8080
# expr code-block ';'?
8181
Node('ForInStmt', kind='Stmt',
8282
traits=['WithCodeBlock'],
8383
children=[
8484
Child('ForKeyword', kind='ForToken'),
85-
Child('TryKeyword', kind='TryToken',
85+
Child('TryKeyword', kind='TryToken',
8686
is_optional=True),
8787
Child('AwaitKeyword', kind='IdentifierToken',
8888
classification='Keyword',

utils/gyb_syntax_support/Token.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ def macro_name(self):
232232
serialization_code=92),
233233
Punctuator('RightSquareBracket', 'r_square', text=']',
234234
serialization_code=93),
235-
Punctuator('LeftAngle', 'l_angle', text='<', requires_leading_space=True,
235+
Punctuator('LeftAngle', 'l_angle', text='<', requires_leading_space=True,
236236
requires_trailing_space=True, serialization_code=94),
237237
Punctuator('RightAngle', 'r_angle', text='>', requires_leading_space=True,
238238
requires_trailing_space=True, serialization_code=95),
@@ -253,7 +253,7 @@ def macro_name(self):
253253
Punctuator('Pound', 'pound', text='#', serialization_code=81),
254254

255255
Punctuator('PrefixAmpersand', 'amp_prefix', text='&',
256-
requires_leading_space=True, requires_trailing_space=True,
256+
requires_leading_space=True, requires_trailing_space=True,
257257
serialization_code=96),
258258
Punctuator('Arrow', 'arrow', text='->', requires_leading_space=True,
259259
requires_trailing_space=True, serialization_code=78),

utils/gyb_syntax_support/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def make_missing_swift_child(child):
129129
elif child.syntax_kind in SYNTAX_BASE_KINDS:
130130
missing_kind = f"missing{child.syntax_kind}"
131131
else:
132-
missing_kind = child.swift_syntax_kind
132+
missing_kind = child.swift_syntax_kind
133133
return f'RawSyntax.makeEmptyLayout(kind: SyntaxKind.{missing_kind}, ' + \
134134
'arena: .default)'
135135

utils/scale-test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def run_once_with_primary(args, ast, rng, primary_idx):
173173
if not args.save_temps:
174174
shutil.rmtree(d)
175175

176-
return {k: v for (k, v) in r.items() if args.select in k and
176+
return {k: v for (k, v) in r.items() if args.select in k and
177177
not (args.exclude_timers and k.startswith('time.'))}
178178

179179

utils/swift_build_support/swift_build_support/build_script_invocation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ def compute_product_pipelines(self):
636636
builder.add_product(products.SwiftDocC,
637637
is_enabled=self.args.build_swiftdocc)
638638
builder.add_product(products.SwiftDocCRender,
639-
is_enabled=self.args.install_swiftdocc)
639+
is_enabled=self.args.install_swiftdocc)
640640

641641
# Keep SwiftDriver at last.
642642
# swift-driver's integration with the build scripts is not fully

utils/swift_build_support/swift_build_support/products/swiftsyntax.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def build(self, host_target):
7878
self.run_swiftsyntax_build_script(target=host_target,
7979
command='verify-source-code')
8080

81-
self.run_swiftsyntax_build_script(target=host_target,
81+
self.run_swiftsyntax_build_script(target=host_target,
8282
command='build')
8383

8484
def should_test(self, host_target):
@@ -91,18 +91,18 @@ def test(self, host_target):
9191
self.run_swiftsyntax_build_script(target=host_target,
9292
command='test',
9393
additional_params=[
94-
'--filecheck-exec',
95-
os.path.join(llvm_build_dir,
96-
'bin',
94+
'--filecheck-exec',
95+
os.path.join(llvm_build_dir,
96+
'bin',
9797
'FileCheck')
9898
])
9999

100100
def should_install(self, host_target):
101101
return self.args.install_swiftsyntax
102102

103103
def install(self, target_name):
104-
# SwiftSyntax doesn't produce any products thate should be installed
105-
# into the toolchein. All tools using it link against SwiftSyntax
104+
# SwiftSyntax doesn't produce any products thate should be installed
105+
# into the toolchein. All tools using it link against SwiftSyntax
106106
# statically.
107107
pass
108108

utils/update_checkout/tests/test_update_worktree.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ def setup_worktree(workspace_path, local_path, worktree_name):
2929
for project in os.listdir(local_path):
3030
local_project_path = os.path.join(local_path, project)
3131
worktree_project_path = os.path.join(worktree_path, project)
32-
call_quietly(['git',
33-
'-C', local_project_path,
32+
call_quietly(['git',
33+
'-C', local_project_path,
3434
'worktree', 'add', worktree_project_path])
3535

3636

@@ -39,8 +39,8 @@ def teardown_worktree(workspace_path, local_path, worktree_name):
3939
for project in os.listdir(local_path):
4040
local_project_path = os.path.join(local_path, project)
4141
worktree_project_path = os.path.join(worktree_path, project)
42-
call_quietly(['git',
43-
'-C', local_project_path,
42+
call_quietly(['git',
43+
'-C', local_project_path,
4444
'worktree', 'remove', worktree_project_path])
4545

4646

utils/update_checkout/update_checkout/update_checkout.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ def main():
509509
action="append")
510510
parser.add_argument(
511511
"--all-repositories",
512-
help="""Includes repositories not required for current platform.
512+
help="""Includes repositories not required for current platform.
513513
This will not override '--skip-repositories'""",
514514
action='store_true')
515515
parser.add_argument(

0 commit comments

Comments
 (0)