Skip to content

Commit 39d3078

Browse files
Merge pull request #2357 from practicalswift/flake8-fixes-20160501
[gardening] PEP-8 fixes.
2 parents c22ac4d + 6cf5f9d commit 39d3078

File tree

7 files changed

+29
-26
lines changed

7 files changed

+29
-26
lines changed

.pep8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[flake8]
2-
filename = *.py,80+-check,Benchmark_Driver,Benchmark_DTrace.in,Benchmark_GuardMalloc.in,Benchmark_RuntimeLeaksRunner.in,build-script,gyb,line-directive,ns-html2rst,recursive-lipo,rth,submit-benchmark-results,update-checkout,viewcfg
2+
filename = *.py,80+-check,Benchmark_Driver,Benchmark_DTrace.in,Benchmark_GuardMalloc.in,Benchmark_RuntimeLeaksRunner.in,build-script,gyb,line-directive,mock-distcc,ns-html2rst,recursive-lipo,rth,split-generated-tests,submit-benchmark-results,update-checkout,viewcfg

utils/build-script

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ from __future__ import print_function
1414
import argparse
1515
import multiprocessing
1616
import os
17+
import pipes
1718
import platform
1819
import re
20+
import shlex
1921
import shutil
2022
import sys
21-
import pipes
22-
import shlex
2323

2424
# FIXME: Instead of modifying the system path in order to enable imports from
2525
# other directories, all Python modules related to the build script

utils/gyb_stdlib_support.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010

1111
TRAVERSALS = ['Forward', 'Bidirectional', 'RandomAccess']
1212

13-
def collectionForTraversal(traversal):
13+
14+
def collectionForTraversal(traversal): # noqa (N802 function name should be lowercase)
1415
if traversal == 'Forward':
1516
return 'Collection'
1617
if traversal == 'Bidirectional':
@@ -19,28 +20,30 @@ def collectionForTraversal(traversal):
1920
return 'RandomAccessCollection'
2021
assert False, 'unknown traversal'
2122

22-
def sliceTypeName(traversal, mutable, rangeReplaceable):
23+
24+
def sliceTypeName(traversal, mutable, rangeReplaceable): # noqa (N802)
2325
name = collectionForTraversal(traversal).replace('Collection', 'Slice')
2426
if rangeReplaceable:
2527
name = 'RangeReplaceable' + name
2628
if mutable:
2729
name = 'Mutable' + name
2830
return name
2931

30-
def protocolsForCollectionFeatures(traversal, mutable, rangeReplaceable):
32+
33+
def protocolsForCollectionFeatures(traversal, mutable, rangeReplaceable): # noqa (N802)
3134
protocols = [collectionForTraversal(traversal)]
3235
if mutable:
3336
protocols.append('MutableCollection')
3437
if rangeReplaceable:
3538
protocols.append('RangeReplaceableCollection')
3639
return protocols
3740

38-
def defaultIndicesForTraversal(traversal):
41+
42+
def defaultIndicesForTraversal(traversal): # noqa (N802)
3943
if traversal == 'Forward':
4044
return 'DefaultIndices'
4145
if traversal == 'Bidirectional':
4246
return 'DefaultBidirectionalIndices'
4347
if traversal == 'RandomAccess':
4448
return 'DefaultRandomAccessIndices'
4549
assert False, 'unknown traversal'
46-

utils/gyb_stdlib_unittest_support.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,3 @@
1616
stackTrace = 'stackTrace.pushIf(showFrame, file: file, line: line)'
1717

1818
trace = 'message(),\n stackTrace: ' + stackTrace
19-

utils/split-generated-tests

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,35 +12,35 @@ from __future__ import print_function
1212

1313
import sys
1414

15+
1516
def main():
1617
with open(sys.argv[1], 'r') as f:
1718
content = f.readlines()
1819

1920
while len(content) != 0:
20-
startIndex = -1
21-
endIndex = -1
22-
testFilename = ''
21+
start_index = -1
22+
end_index = -1
23+
test_filename = ''
2324
for i, line in enumerate(content):
2425
if line.startswith('// Start of file: '):
25-
testFilename = line[18:].strip()
26-
startIndex = i
26+
test_filename = line[18:].strip()
27+
start_index = i
2728
break
28-
if startIndex == -1:
29+
if start_index == -1:
2930
return 0
3031
for i, line in enumerate(content):
3132
if line.startswith('// End of file: '):
32-
assert line[16:].strip() == testFilename
33-
endIndex = i
33+
assert line[16:].strip() == test_filename
34+
end_index = i
3435
break
35-
testContent = content[startIndex+1:endIndex]
36+
test_content = content[start_index+1:end_index]
3637

37-
with open(testFilename, 'w') as testFile:
38-
for line in testContent:
39-
if not '###sourceLocation' in line:
38+
with open(test_filename, 'w') as testFile:
39+
for line in test_content:
40+
if '###sourceLocation' not in line:
4041
testFile.write(line)
4142

42-
content = content[endIndex+1:]
43+
content = content[end_index+1:]
4344

4445
if __name__ == "__main__":
4546
sys.exit(main())
46-

utils/swift_build_support/swift_build_support/cmake.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@
1414
#
1515
# ----------------------------------------------------------------------------
1616

17-
from numbers import Number
1817
import platform
1918
import subprocess
2019

20+
from numbers import Number
21+
2122
from . import xcrun
2223
from .which import which
2324

utils/swift_build_support/tests/test_cmake.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
from argparse import Namespace
1414

1515
from swift_build_support.cmake import (
16-
host_cmake,
17-
CMakeOptions,
1816
CMake,
17+
CMakeOptions,
18+
host_cmake,
1919
)
2020

2121

0 commit comments

Comments
 (0)