Skip to content

Commit

Permalink
Merge pull request #407 from larryzju/coverage-fix
Browse files Browse the repository at this point in the history
fix #406
  • Loading branch information
iberryful authored Sep 28, 2020
2 parents 5711ea2 + c0ceada commit e9614af
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/pyinfraboxutils/coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import json
import os
import xml.etree.ElementTree
import itertools, functools

class File(object):
def __init__(self, name):
Expand Down Expand Up @@ -305,14 +306,8 @@ def parse_dir(self):
self.files += p.files

tmp_files = []
while self.files != []:
f1 = self.files.pop(0)

for f in self.files:
if f.name == f1.name:
f1 = f1 + f
self.files.remove(f)

tmp_files.append(f1)
get_filename = lambda f: f.name
for _, group in itertools.groupby(sorted(self.files, key=get_filename), key=get_filename):
tmp_files.append(functools.reduce(lambda a,b : a+b, group))

self.files = tmp_files

0 comments on commit e9614af

Please sign in to comment.