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

After Change


        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 = []
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

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: 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: deepchem/deepchem
Commit Name: 763f8721952e8042d6086b103deb2450334be4b3
Time: 2017-03-09
Author: lilleswing@gmail.com
File Name: deepchem/dock/pose_generation.py
Class Name: VinaPoseGenerator
Method Name: generate_poses


Project Name: HyperGAN/HyperGAN
Commit Name: cf6b0e8378642f2b25a3b8cf8615fa135fb421d2
Time: 2018-07-15
Author: mikkel@255bits.com
File Name: hypergan/trainers/gang_trainer.py
Class Name: GangTrainer
Method Name: nash_mixture_from_payoff