Use collections.Counter instea of itertools.groupby to group together all

instances, not just consecutive instaces (mixed_unicode.py)
This commit is contained in:
jesopo 2018-11-20 20:30:48 +00:00
parent 60acf02cee
commit 957b5413dc

View file

@ -1,4 +1,4 @@
import enum, itertools import collections, enum
from src import ModuleManager, utils from src import ModuleManager, utils
class Script(enum.Enum): class Script(enum.Enum):
@ -78,8 +78,8 @@ class Module(ModuleManager.BaseModule):
score = len(reasons) score = len(reasons)
reasons_s = [] reasons_s = []
for reason, group in itertools.groupby(reasons): for reason, count in collections.Counter(reasons).items:
reasons_s.append("%s: %s" % (reason, len(list(group)))) reasons_s.append("%s: %s" % (reason, count))
if score > 0: if score > 0:
self.log.trace( self.log.trace(