Skip to content

Commit 87bcd45

Browse files
[Python] Fix recently introduced PEP 8 regressions.
After this commit: $ flake8 $ (No PEP 8 warnings or errors left in the repo.)
1 parent 9ff84e1 commit 87bcd45

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

benchmark/scripts/Benchmark_DTrace.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class DTraceResult(perf_test_driver.Result):
4040
@classmethod
4141
def data_format(cls, max_test_len):
4242
non_name_headers = DTraceResult.data_headers()[1:]
43-
fmt = ('{:<%d}' % (max_test_len+5)) + ''.join(['{:<%d}' % (len(h)+2) for h in non_name_headers])
43+
fmt = ('{:<%d}' % (max_test_len + 5)) + ''.join(['{:<%d}' % (len(h) + 2) for h in non_name_headers])
4444
return fmt
4545

4646
@classmethod
@@ -63,7 +63,7 @@ class DTraceBenchmarkDriver(perf_test_driver.BenchmarkDriver):
6363
def __init__(self, binary, xfail_list, csv_output):
6464
perf_test_driver.BenchmarkDriver.__init__(self, binary, xfail_list,
6565
enable_parallel=False,
66-
opt_levels = ['O'])
66+
opt_levels=['O'])
6767
self.csv_output = csv_output
6868

6969
def print_data_header(self, max_test_len):
@@ -81,7 +81,7 @@ class DTraceBenchmarkDriver(perf_test_driver.BenchmarkDriver):
8181
p = subprocess.Popen(['sudo', 'dtrace', '-s', DTRACE_PATH, '-c', '%s %s %s' % (data['path'], data['test_name'], '--num-iters=%d' % iters)],
8282
stdout=subprocess.PIPE, stderr=open('/dev/null', 'w'))
8383
results = [x for x in p.communicate()[0].split("\n") if len(x) > 0]
84-
return [x.split(',')[1] for x in results[results.index('DTRACE RESULTS')+1:]]
84+
return [x.split(',')[1] for x in results[results.index('DTRACE RESULTS') + 1:]]
8585
iter_2_results = get_results_with_iters(2)
8686
iter_3_results = get_results_with_iters(3)
8787

utils/omit-needless-words.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -117,26 +117,30 @@ def dump_module_api((cmd, extra_dump_args, output_dir, module, quiet)):
117117
return
118118

119119
def pretty_sdk_name(sdk):
120-
if sdk.find("macosx") == 0: return 'OSX'
121-
if sdk.find("iphoneos") == 0: return 'iOS'
122-
if sdk.find("watchos") == 0: return 'watchOS'
123-
if sdk.find("appletvos") == 0: return 'tvOS'
120+
if sdk.find("macosx") == 0:
121+
return 'OSX'
122+
if sdk.find("iphoneos") == 0:
123+
return 'iOS'
124+
if sdk.find("watchos") == 0:
125+
return 'watchOS'
126+
if sdk.find("appletvos") == 0:
127+
return 'tvOS'
124128
return 'unknownOS'
125129

126-
# Collect the set of frameworks we should dump
130+
# Collect the set of frameworks we should dump
127131
def collect_frameworks(sdk):
128132
(exitcode, sdk_path, err) = run_command(["xcrun", "--show-sdk-path", "-sdk", sdk])
129133
if exitcode != 0:
130134
print('error: framework collection failed with error %d' % (exitcode))
131135
return ()
132136
sdk_path = sdk_path.rstrip()
133-
137+
134138
(exitcode, sdk_version, err) = run_command(["xcrun", "--show-sdk-version", "-sdk", sdk])
135139
if exitcode != 0:
136140
print('error: framework collection failed with error %d' % (exitcode))
137141
return ()
138142
sdk_version = sdk_version.rstrip()
139-
143+
140144
print('Collecting frameworks from %s %s at %s' % (pretty_sdk_name(sdk), sdk_version, sdk_path))
141145

142146
# Collect all of the framework names
@@ -147,7 +151,7 @@ def collect_frameworks(sdk):
147151
match = framework_matcher.match(entry)
148152
if match:
149153
framework = match.group(1)
150-
if not framework in SKIPPED_FRAMEWORKS:
154+
if framework not in SKIPPED_FRAMEWORKS:
151155
frameworks.add(framework)
152156

153157
return (sorted(list(frameworks)), sdk_path)
@@ -201,7 +205,7 @@ def main():
201205
# Execute the API dumps
202206
pool = multiprocessing.Pool(processes=args.jobs)
203207
pool.map(dump_module_api, jobs)
204-
208+
205209
# Remove the .swift file we fed into swift-ide-test
206210
subprocess.call(['rm', '-f', source_filename])
207211

0 commit comments

Comments
 (0)