Use collections.Counter
instea of itertools.groupby
to group together all
instances, not just consecutive instaces (mixed_unicode.py)
This commit is contained in:
parent
60acf02cee
commit
957b5413dc
1 changed files with 3 additions and 3 deletions
|
@ -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(
|
||||||
|
|
Loading…
Reference in a new issue