Skip to content

Commit 1cd4d4e

Browse files
[gardening] Fix violations of non-controversial PEP8 rules
Fixes: * multiple statements on one line (colon) (E701) * missing whitespace around arithmetic operator (E226) * missing whitespace around operator (E225) * closing bracket does not match visual indentation (E124) * blank line contains whitespace (W293) * continuation line missing indentation or outdented (E122) * continuation line over-indented for hanging indent (E126) * missing expected blank line (E301) * trailing whitespace (W291) * unexpected spaces around keyword / parameter equals (E251) * whitespace after '(', '[' or '{' (E201) * whitespace before ')', ']' or '}' (E202) * whitespace before ',' or ':' (E203)
1 parent f0377be commit 1cd4d4e

29 files changed

+402
-388
lines changed

docs/conf.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@
101101
# documentation.
102102
html_theme_options = {
103103
# Red links are a bit too garish
104-
"linkcolor" : "#577492",
105-
"visitedlinkcolor" : "#577492",
106-
"hoverlinkcolor" : "#551A8B"
104+
"linkcolor": "#577492",
105+
"visitedlinkcolor": "#577492",
106+
"hoverlinkcolor": "#551A8B"
107107
}
108108

109109
# Add any paths that contain custom themes here, relative to this directory.
@@ -178,14 +178,14 @@
178178
# -- Options for LaTeX output --------------------------------------------------
179179

180180
latex_elements = {
181-
# The paper size ('letterpaper' or 'a4paper').
182-
#'papersize': 'letterpaper',
181+
# The paper size ('letterpaper' or 'a4paper').
182+
#'papersize': 'letterpaper',
183183

184-
# The font size ('10pt', '11pt' or '12pt').
185-
#'pointsize': '10pt',
184+
# The font size ('10pt', '11pt' or '12pt').
185+
#'pointsize': '10pt',
186186

187-
# Additional stuff for the LaTeX preamble.
188-
#'preamble': '',
187+
# Additional stuff for the LaTeX preamble.
188+
#'preamble': '',
189189
}
190190

191191
# Grouping the document tree into LaTeX files. List of tuples

docs/scripts/ns-html2rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,35 +18,35 @@ usage: nshtml2rst < NSString.html > NSString.rst
1818

1919
# Treat <div class="declaration>...</div> as <pre>...</pre>
2020
html = re.sub(
21-
r'<div\s+class="declaration">(.*?)</div>',
22-
r'<pre>\1</pre>',
21+
r'<div\s+class="declaration">(.*?)</div>',
22+
r'<pre>\1</pre>',
2323
html, flags=re.MULTILINE | re.DOTALL)
2424

2525
# Strip all attributes from <pre>...</pre> containing class="..."
2626
# The resulting classes confound ReST
2727
html = re.sub(
28-
r'<pre\s[^>]*class=[^>]*>(.*?)</pre>',
29-
r'<pre>\1</pre>',
28+
r'<pre\s[^>]*class=[^>]*>(.*?)</pre>',
29+
r'<pre>\1</pre>',
3030
html, flags=re.MULTILINE | re.DOTALL)
3131

3232
# Remove links from <code>...</code>, which doesn't have a rendering in ReST
3333
html = re.sub(
34-
r'<code>(.*?)<a[^>]*?>(.*?)</a>(.*?)</code>',
35-
r'<code>\1\2\3</code>',
34+
r'<code>(.*?)<a[^>]*?>(.*?)</a>(.*?)</code>',
35+
r'<code>\1\2\3</code>',
3636
html, flags=re.MULTILINE | re.DOTALL)
3737

3838
# Let pandoc do most of the hard work
3939
p = subprocess.Popen(
40-
args=['pandoc', '--reference-links', '-f', 'html', '-t', 'rst']
41-
, stdin=subprocess.PIPE
42-
, stdout=subprocess.PIPE
40+
args=['pandoc', '--reference-links', '-f', 'html', '-t', 'rst'],
41+
stdin=subprocess.PIPE,
42+
stdout=subprocess.PIPE
4343
)
4444
rst,stderr = p.communicate(html)
4545

4646
# HACKETY HACK HACK: Our html documents apparently contain some
4747
# bogus heading level nesting. Just fix up the one we know about
4848
# so that ReST doesn't complain later.
49-
rst = re.sub("(^|\n)('+)($|\n)",
49+
rst = re.sub("(^|\n)('+)($|\n)",
5050
lambda m: m.group(1) + len(m.group(2)) * '^' + m.group(3),
5151
rst, flags=re.MULTILINE)
5252

stdlib/public/SDK/Darwin/tgmath.swift.gyb

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -45,43 +45,51 @@ def cFuncSuffix(bits):
4545

4646
# (T) -> T
4747
# These functions do not have a corresponding LLVM intrinsic
48-
UnaryFunctions = ['acos', 'asin', 'atan', 'tan',
49-
'acosh', 'asinh', 'atanh', 'cosh', 'sinh', 'tanh',
50-
'expm1',
51-
'log1p', 'logb',
52-
'cbrt', 'sqrt', 'erf', 'erfc', 'tgamma',
53-
]
48+
UnaryFunctions = [
49+
'acos', 'asin', 'atan', 'tan',
50+
'acosh', 'asinh', 'atanh', 'cosh', 'sinh', 'tanh',
51+
'expm1',
52+
'log1p', 'logb',
53+
'cbrt', 'sqrt', 'erf', 'erfc', 'tgamma',
54+
]
5455

5556
# These functions have a corresponding LLVM intrinsic
5657
# We call this intrinsic via the Builtin method so keep this list in
5758
# sync with core/BuiltinMath.swift.gyb
58-
UnaryIntrinsicFunctions = ['cos', 'sin',
59-
'exp', 'exp2',
60-
'log', 'log10', 'log2',
61-
'fabs',
62-
'ceil', 'floor', 'nearbyint', 'rint', 'round', 'trunc',
63-
]
59+
UnaryIntrinsicFunctions = [
60+
'cos', 'sin',
61+
'exp', 'exp2',
62+
'log', 'log10', 'log2',
63+
'fabs',
64+
'ceil', 'floor', 'nearbyint', 'rint', 'round', 'trunc',
65+
]
6466

6567
# (T, T) -> T
66-
BinaryFunctions = ['atan2', 'hypot', 'pow', 'fmod',
67-
'remainder', 'copysign', 'nextafter', 'fdim', 'fmax', 'fmin']
68+
BinaryFunctions = [
69+
'atan2', 'hypot', 'pow', 'fmod',
70+
'remainder', 'copysign', 'nextafter', 'fdim', 'fmax', 'fmin'
71+
]
6872

6973
# These functions have special implementations.
70-
OtherFunctions = ['fpclassify',
71-
'isnormal', 'isfinite', 'isinf', 'isnan', 'signbit',
72-
'modf', 'ldexp', 'frexp', 'ilogb', 'scalbn', 'lgamma',
73-
'remquo', 'nan', 'fma',
74-
'jn', 'yn']
74+
OtherFunctions = [
75+
'fpclassify',
76+
'isnormal', 'isfinite', 'isinf', 'isnan', 'signbit',
77+
'modf', 'ldexp', 'frexp', 'ilogb', 'scalbn', 'lgamma',
78+
'remquo', 'nan', 'fma',
79+
'jn', 'yn'
80+
]
7581

7682
# These functions are imported correctly as-is.
7783
OkayFunctions = ['j0', 'j1', 'y0', 'y1']
7884

7985
# These functions are not supported for various reasons.
80-
UnhandledFunctions = ['math_errhandling', 'scalbln',
81-
'lrint', 'lround', 'llrint', 'llround', 'nexttoward',
82-
'isgreater', 'isgreaterequal', 'isless', 'islessequal',
83-
'islessgreater', 'isunordered', '__exp10',
84-
'__sincos', '__cospi', '__sinpi', '__tanpi', '__sincospi']
86+
UnhandledFunctions = [
87+
'math_errhandling', 'scalbln',
88+
'lrint', 'lround', 'llrint', 'llround', 'nexttoward',
89+
'isgreater', 'isgreaterequal', 'isless', 'islessequal',
90+
'islessgreater', 'isunordered', '__exp10',
91+
'__sincos', '__cospi', '__sinpi', '__tanpi', '__sincospi'
92+
]
8593

8694

8795
def AllFloatTypes():

stdlib/public/common/MirrorBoilerplate.gyb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@
3131
%sys.path = [os.path.split(inspect.getframeinfo(inspect.currentframe()).filename)[0] or '.'] + sys.path
3232
%import MirrorCommon
3333
%genericArgString = MirrorCommon.getGenericArgString(
34-
% genericArgs if 'genericArgs' in locals() else None,
35-
% genericConstraints if 'genericConstraints' in locals() else None)
34+
% genericArgs if 'genericArgs' in locals() else None,
35+
% genericConstraints if 'genericConstraints' in locals() else None)
3636
%disposition = MirrorCommon.getDisposition(
37-
% disposition if 'disposition' in locals() else None)
37+
% disposition if 'disposition' in locals() else None)
3838
var _value: ${introspecteeType}${genericArgString}
3939

4040
init(_ x: ${introspecteeType}${genericArgString}) {

stdlib/public/core/BuiltinMath.swift.gyb

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,13 @@ def cFuncSuffix(bits):
4545

4646
# These functions have a corresponding LLVM intrinsic
4747
# Note, keep this up to date with Darwin/tgmath.swift.gyb
48-
UnaryIntrinsicFunctions = ['cos', 'sin',
49-
'exp', 'exp2',
50-
'log', 'log10', 'log2',
51-
'fabs',
52-
'ceil', 'floor', 'nearbyint', 'rint', 'round', 'trunc',
53-
]
48+
UnaryIntrinsicFunctions = [
49+
'cos', 'sin',
50+
'exp', 'exp2',
51+
'log', 'log10', 'log2',
52+
'fabs',
53+
'ceil', 'floor', 'nearbyint', 'rint', 'round', 'trunc',
54+
]
5455

5556
def TypedUnaryIntrinsicFunctions():
5657
for ufunc in UnaryIntrinsicFunctions:

tools/SourceKit/bindings/python/sourcekitd/capi.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ def __repr__(self):
398398
[Response],
399399
c_bool),
400400

401-
# ("sourcekitd_send_request",
401+
# ("sourcekitd_send_request",
402402

403403
("sourcekitd_send_request_sync",
404404
[Object],
@@ -469,19 +469,19 @@ def __repr__(self):
469469
("sourcekitd_variant_dictionary_get_int64",
470470
[Variant, UIdent],
471471
c_int64),
472-
472+
473473
("sourcekitd_variant_dictionary_get_string",
474474
[Variant, UIdent],
475475
c_char_p),
476-
476+
477477
("sourcekitd_variant_dictionary_get_value",
478478
[Variant, UIdent],
479479
Variant),
480-
480+
481481
("sourcekitd_variant_dictionary_get_uid",
482482
[Variant, UIdent],
483483
c_object_p),
484-
484+
485485
("sourcekitd_variant_get_type",
486486
[Variant],
487487
VariantType.from_id),

tools/SourceKit/bindings/python/sourcekitd/request.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@ def __str__(self):
2727
return "%s (%s)" % (self.msg, self.kind)
2828

2929
def syntax_annotate_text(text):
30-
req = { 'key.request': capi.UIdent('source.request.editor.open'),
31-
'key.sourcetext': text,
32-
'key.name': "annotate-source-text",
33-
'key.enablesyntaxmap': True }
30+
req = {
31+
'key.request': capi.UIdent('source.request.editor.open'),
32+
'key.sourcetext': text,
33+
'key.name': "annotate-source-text",
34+
'key.enablesyntaxmap': True
35+
}
3436
resp = request_sync(req)
3537
return resp.get_payload().to_python_object()
3638

0 commit comments

Comments
 (0)