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

0 commit comments

Comments
 (0)