1fffcec16578e6bea8de6e685632b3f56713a438,explainshell/matcher.py,matcher,_mergeadjacent,#matcher#Any#,233
Before Change
merged = []
resultindex = self._resultindex()
it = util.peekable(iter(matches))
curr = it.next()
while it.hasnext():
next = it.peek()
// we have to make sure that there"s no matchresult from another group
// between curr and next
if curr.text != next.text or (resultindex[curr] != resultindex[next] - 1):
merged.append(curr)
curr = it.next()
else:
After Change
def _mergeadjacent(self, matches):
merged = []
resultindex = self._resultindex()
sametext = itertools.groupby(matches, lambda m: m.text)
for text, ll in sametext:
for l in util.groupcontinuous(ll, key=lambda m: resultindex[m]):
if len(l) == 1:
merged.append(l[0])
else:
start = l[0].start
end = l[-1].end
endindex = resultindex[l[-1]]
for mr in l:
del resultindex[mr]
merged.append(matchresult(start, end, text, None))
resultindex[merged[-1]] = endindex
return merged
def _mergeunknowns(self, matches):
merged = []
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 9
Instances Project Name: idank/explainshell
Commit Name: 1fffcec16578e6bea8de6e685632b3f56713a438
Time: 2013-09-07
Author: idankk86@gmail.com
File Name: explainshell/matcher.py
Class Name: matcher
Method Name: _mergeadjacent
Project Name: GoogleCloudPlatform/PerfKitBenchmarker
Commit Name: 874170dad8d905dcae3513b7a9cf7f95803480a2
Time: 2015-12-03
Author: carlos.torres@rackspace.com
File Name: perfkitbenchmarker/providers/openstack/os_disk.py
Class Name: OpenStackDisk
Method Name: Attach
Project Name: GoogleCloudPlatform/PerfKitBenchmarker
Commit Name: df4ac0ed8a1f42b864b49d45056ad8dc95b3510c
Time: 2015-12-08
Author: carlos.torres@rackspace.com
File Name: perfkitbenchmarker/providers/openstack/os_disk.py
Class Name: OpenStackDisk
Method Name: Attach