Skip to content

Commit 77a2e8f

Browse files
committed
Fix mixed indentations
The code uses both spaces and tab in the same file. According to PEP-8, use spaces only. Change-Id: I5ac3512395ad6bd30c820ca1d549ad2acab2dc8f Signed-off-by: Baohua Yang <[email protected]>
1 parent f9e8f3b commit 77a2e8f

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

bddtests/steps/coverage.py

+27-27
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@
88

99

1010
def testCoverage():
11-
#First save the coverage files
12-
saveCoverageFiles("coverage","scenario_1", ["bddtests_vp0_1","bddtests_vp1_1","bddtests_vp2_1","bddtests_vp3_1",], "cov")
11+
#First save the coverage files
12+
saveCoverageFiles("coverage","scenario_1", ["bddtests_vp0_1","bddtests_vp1_1","bddtests_vp2_1","bddtests_vp3_1",], "cov")
1313

1414
# Now collect the filenames for coverage files.
15-
files = glob.glob(os.path.join('coverage','*.cov'))
15+
files = glob.glob(os.path.join('coverage','*.cov'))
1616

1717
#Create the aggregate coverage file
18-
coverageContents = createCoverageFile(files)
18+
coverageContents = createCoverageFile(files)
1919

2020
#Ouput the aggregate coverage file
21-
with open('coverage.total', 'w') as outfile:
22-
outfile.write(coverageContents)
23-
outfile.close()
21+
with open('coverage.total', 'w') as outfile:
22+
outfile.write(coverageContents)
23+
outfile.close()
2424

2525
def createCoverageAggregate():
2626
# Now collect the filenames for coverage files.
@@ -39,10 +39,10 @@ def saveCoverageFiles(folderName, rootName, containerNames, extension):
3939
'Will save the converage files to folderName'
4040
# Make the directory
4141
try:
42-
os.makedirs(folderName)
42+
os.makedirs(folderName)
4343
except OSError as exception:
44-
if exception.errno != errno.EEXIST:
45-
raise
44+
if exception.errno != errno.EEXIST:
45+
raise
4646
for containerName in containerNames:
4747
srcPath = "{0}:/opt/gopath/src/github.com/hyperledger/fabric/coverage.cov".format(containerName)
4848
print("sourcepath = {0}".format(srcPath))
@@ -68,27 +68,27 @@ def createCoverageFile(filenames):
6868
#with open('coverage.total', 'w') as outfile:
6969
for fname in filenames:
7070
with open(fname) as infile:
71-
firstLine = True
72-
for line in infile:
73-
if firstLine:
74-
firstLine = False
75-
continue
76-
else:
77-
# Split the line based upon white space
78-
lineParts = line.split()
79-
if lineParts[0] in linesMap:
80-
# Found, keep the greater
81-
newCount = long(lineParts[2])
82-
oldCount = long(linesMap[lineParts[0]].split()[2])
83-
if newCount > oldCount:
84-
linesMap[lineParts[0]] = line
85-
else:
86-
linesMap[lineParts[0]] = line
71+
firstLine = True
72+
for line in infile:
73+
if firstLine:
74+
firstLine = False
75+
continue
76+
else:
77+
# Split the line based upon white space
78+
lineParts = line.split()
79+
if lineParts[0] in linesMap:
80+
# Found, keep the greater
81+
newCount = long(lineParts[2])
82+
oldCount = long(linesMap[lineParts[0]].split()[2])
83+
if newCount > oldCount:
84+
linesMap[lineParts[0]] = line
85+
else:
86+
linesMap[lineParts[0]] = line
8787
# Now sort the output
8888
od = OrderedDict(sorted(linesMap.items(), key=lambda i: i[1]))
8989

9090
for (key, line) in od.items():
91-
output.write(line)
91+
output.write(line)
9292
contents = output.getvalue()
9393
output.close()
9494
return contents

0 commit comments

Comments
 (0)