def _resolveSpecialSegment(self, segmentB, specialResolutionMethods): resolutionMethodExecutor = _compileRules(specialResolutionMethods, 3) for (resolutionMethod, args) in resolutionMethodExecutor[True]: iterables = [] for arg in args: iterables.append(itertools.repeat(arg)) resolutions = imap(resolutionMethod, self.allCorrectSinglePossibilities(), *iterables) correctAB = izip(self.allCorrectSinglePossibilities(), resolutions) correctAB = ifilter( lambda possibAB: possibility.pitchesWithinLimit( possibA=possibAB[1], maxPitch=segmentB._maxPitch), correctAB) if self.fbRules.applyConsecutivePossibRulesToResolution: correctAB = ifilter( lambda possibAB: self._isCorrectConsecutivePossibility( possibA=possibAB[0], possibB=possibAB[1]), correctAB) if self.fbRules.applySinglePossibRulesToResolution: segmentB._singlePossibilityRuleChecking = _compileRules( segmentB.singlePossibilityRules(segmentB.fbRules)) correctAB = ifilter( lambda possibAB: segmentB._isCorrectSinglePossibility( possibA=possibAB[1]), correctAB) return correctAB raise SegmentException("No standard resolution available.")
def _resolveSpecialSegment(self, segmentB, specialResolutionMethods): resolutionMethodExecutor = _compileRules(specialResolutionMethods, 3) for (resolutionMethod, args) in resolutionMethodExecutor[True]: iterables = [] for arg in args: iterables.append(itertools.repeat(arg)) resolutions = imap(resolutionMethod, self.allCorrectSinglePossibilities(), *iterables) correctAB = izip(self.allCorrectSinglePossibilities(), resolutions) correctAB = ifilter(lambda possibAB: possibility.pitchesWithinLimit( possibA=possibAB[1], maxPitch=segmentB._maxPitch), correctAB) if self.fbRules.applyConsecutivePossibRulesToResolution: correctAB = ifilter(lambda possibAB: self._isCorrectConsecutivePossibility( possibA=possibAB[0], possibB=possibAB[1]), correctAB) if self.fbRules.applySinglePossibRulesToResolution: segmentB._singlePossibilityRuleChecking = _compileRules( segmentB.singlePossibilityRules(segmentB.fbRules)) correctAB = ifilter(lambda possibAB: segmentB._isCorrectSinglePossibility( possibA=possibAB[1]), correctAB) return correctAB raise SegmentException("No standard resolution available.")