§
    ƒØjy²  ã                  ó¨  — U d dl mZ d dlZd dlZd dlZd dlZd dlmZ d dlmZ d dlm	Z	 d dlm
Z
 d dlmZ d dlmZ d d	lmZ d d
lmZ d dlmZ d dlmZ dZddiZded<    G d„ d¦  «        Z G d„ de¦  «        Z	 	 	 d&d'd„Zd„ Zd„ Zd(d„Zd(d „Z G d!„ d"e	j        ¦  «        Z G d#„ d$ej        ¦  «        Ze d%k    rd dlZ ej!        e¦  «         dS dS ))é    )ÚannotationsN)Úchord)Úenvironment)Úexceptions21)Únote)Úpitch)Úscale)Úpossibility)ÚrealizerScale)Ú
resolution)ÚruleszfiguredBass.segmentr	   z0dict[str, realizerScale.FiguredBassScale | None]Ú_defaultRealizerScalec                  ó¢   — e Zd ZU g d¢ZdddddddœZd	ed
<   	 	 	 	 	 	 	 d(d)d„Zd*d„Zd*d„Zd*d„Z	d„ Z
d+d„Zd „ Zd!„ Zd"„ Zd#„ Zd$„ Zd%„ Zd&„ Zd'„ ZdS ),ÚSegment)	ÚallSinglePossibilitiesÚsinglePossibilityRulesÚallCorrectSinglePossibilitiesÚconsecutivePossibilityRulesÚspecialResolutionRulesÚ"allCorrectConsecutivePossibilitiesÚresolveDominantSeventhSegmentÚresolveDiminishedSeventhSegmentÚresolveAugmentedSixthSegmentzZA :class:`~music21.note.Note` whose pitch
             forms the bass of each possibility.zÓThe number of parts (including the bass) that possibilities
             should contain, which
             comes directly from :attr:`~music21.figuredBass.rules.Rules.numParts`
             in the Rules object.zÂA list of allowable pitch names.
             This is derived from bassNote.pitch and notationString
             using :meth:`~music21.figuredBass.realizerScale.FiguredBassScale.getPitchNames`.a|  A list of allowable pitches in the upper parts of a possibility.
             This is derived using
             :meth:`~music21.figuredBass.segment.getPitches`, providing bassNote.pitch,
             :attr:`~music21.figuredBass.rules.Rules.maxPitch`
             from the Rules object, and
             :attr:`~music21.figuredBass.segment.Segment.pitchNamesInChord` as arguments.z}:attr:`~music21.figuredBass.segment.Segment.allPitchesAboveBass`
             represented as a :class:`~music21.chord.Chord`.zLA deepcopy of the :class:`~music21.figuredBass.rules.Rules` object provided.)ÚbassNoteÚnumPartsÚpitchNamesInChordÚallPitchesAboveBassÚsegmentChordÚfbRuleszdict[str, str]Ú	_DOC_ATTRÚC3Né   ÚB5r   ústr | note.NoteÚnotationStringú
str | NoneÚfbScaleú%realizerScale.FiguredBassScale | Noner   úrules.Rules | NoneÚmaxPitchústr | pitch.Pitchc                ó  — t          |t          ¦  «        rt          j        |¦  «        }t          |t          ¦  «        rt	          j        |¦  «        }|€5t          d         €t          j        ¦   «         t          d<   t          d         }|€J ‚|€t          j
        ¦   «         | _        nt          j        |¦  «        | _        d| _        d| _        d| _        || _        || _        || _        |€
|�|| _        n%|                     | j        j        |¦  «        | _        t-          | j        | j        j        | j        ¦  «        | _        t1          j        | j        |j        ¬¦  «        | _        t9          j        t<          ¦  «        | _        dS )aV  
        A Segment corresponds to a 1:1 realization of a bassNote and notationString
        of a :class:`~music21.figuredBass.realizer.FiguredBassLine`.
        It is created by passing six arguments: a
        :class:`~music21.figuredBass.realizerScale.FiguredBassScale`, a bassNote, a notationString,
        a :class:`~music21.figuredBass.rules.Rules` object, a number of parts and a maximum pitch.
        Realizations of a Segment are represented
        as possibility tuples (see :mod:`~music21.figuredBass.possibility` for more details).

        Methods in Python's `itertools`
        module are used extensively. Methods
        which generate possibilities or possibility progressions return iterators,
        which are turned into lists in the examples
        for display purposes only.

        if fbScale is None, a realizerScale.FiguredBassScale() is created

        if fbRules is None, a rules.Rules() instance is created.  Each Segment gets
        its own deepcopy of the one given.

        Here, a Segment is created using the default values: a FiguredBassScale in C,
        a bassNote of C3, an empty notationString, and a default
        Rules object.

        >>> from music21.figuredBass import segment
        >>> s1 = segment.Segment()
        >>> s1.bassNote
        <music21.note.Note C>
        >>> s1.numParts
        4
        >>> s1.pitchNamesInChord
        ['C', 'E', 'G']
        >>> [str(p) for p in s1.allPitchesAboveBass]
        ['C3', 'E3', 'G3', 'C4', 'E4', 'G4', 'C5', 'E5', 'G5']
        >>> s1.segmentChord
        <music21.chord.Chord C3 E3 G3 C4 E4 G4 C5 E5 G5>
        Nr	   )ÚquarterLength) Ú
isinstanceÚstrr   ÚNoter   ÚPitchr   r   ÚFiguredBassScaler   ÚRulesr   ÚcopyÚdeepcopyÚ_specialResolutionRuleCheckingÚ_singlePossibilityRuleCheckingÚ#_consecutivePossibilityRuleCheckingr   r   Ú	_maxPitchr   ÚgetPitchNamesÚ
getPitchesr   r   ÚChordr-   r   r   ÚEnvironmentÚ_MODÚ_environRules)Úselfr   r%   r'   r   r   r*   ÚlistOfPitchess           ú�/Users/tedpeters/Documents/Projects/Claude Projects/Misc Tools/notename-sheets/.venv/lib/python3.11/site-packages/music21/figuredBass/segment.pyÚ__init__zSegment.__init__B   so  € õZ �h¥Ñ$Ô$ð 	+Ý”y Ñ*Ô*ˆHÝ�h¥Ñ$Ô$ð 	-Ý”{ 8Ñ,Ô,ˆHàˆ?Ý$ WÔ-Ð5Ý1>Ô1OÑ1QÔ1QÕ% gÑ.Ý+¨GÔ4ˆGØÐ"Ð"Ð"àˆ?Ý œ;™=œ=ˆDŒLˆLåœ=¨Ñ1Ô1ˆDŒLà.2ˆÔ+Ø.2ˆÔ+Ø37ˆÔ0à ˆŒØ ˆŒØ!ˆŒØÐ! mÐ&?à%2ˆDÔ"Ð"ð &-×%:Ò%:¸4¼=Ô;NÐP^Ñ%_Ô%_ˆDÔ"å#-¨dÔ.DØ.2¬mÔ.AØ.2¬nñ$>ô $>ˆÔ õ "œK¨Ô(@Ø6>Ô6LðNñ Nô NˆÔå(Ô4µTÑ:Ô:ˆÔÐÐó    c                ó¸   — |€t          j        ¦   «         }|j        t          j        d| j        gfdt          j        d|j        gf|j        t          j	        dfg}|S )a±  
        A framework for storing single possibility rules and methods to be applied
        in :meth:`~music21.figuredBass.segment.Segment.allCorrectSinglePossibilities`.
        Takes in a :class:`~music21.figuredBass.rules.Rules` object, fbRules.
        If None then a new rules object is created.

        Items are added within this method in the following form:

        (willRunOnlyIfTrue, methodToRun, keepSolutionsWhichReturn, optionalArgs)

        These items are compiled internally when
        :meth:`~music21.figuredBass.segment.Segment.allCorrectSinglePossibilities`
        is called on a Segment. Here, the compilation of rules and
        methods bases on a default fbRules is shown.

        >>> from music21.figuredBass import segment
        >>> segmentA = segment.Segment()
        >>> allSingleRules = segmentA.singlePossibilityRules()
        >>> segment.printRules(allSingleRules)
        Will run:  Method:                       Keep solutions which return:  Arguments:
        True       isIncomplete                  False                         ['C', 'E', 'G']
        True       upperPartsWithinLimit         True                          12
        True       voiceCrossing                 False                         None

        Here, a modified fbRules is provided, which allows for incomplete possibilities.

        >>> from music21.figuredBass import rules
        >>> fbRules = rules.Rules()
        >>> fbRules.forbidIncompletePossibilities = False
        >>> allSingleRules = segmentA.singlePossibilityRules(fbRules)
        >>> segment.printRules(allSingleRules)
        Will run:  Method:                       Keep solutions which return:  Arguments:
        False      isIncomplete                  False                         ['C', 'E', 'G']
        True       upperPartsWithinLimit         True                          12
        True       voiceCrossing                 False                         None
        NFT)
r   r3   ÚforbidIncompletePossibilitiesr
   ÚisIncompleter   ÚupperPartsWithinLimitÚupperPartsMaxSemitoneSeparationÚforbidVoiceCrossingÚvoiceCrossing)r@   r   ÚsinglePossibRuless      rB   r   zSegment.singlePossibilityRules—   sv   € ðL ˆ?Ý”k‘m”mˆGð Ô2ÝÔ)ØØÔ(Ð)ð+ð ÝÔ2ØØÔ9Ð:ð<ð Ô(ÝÔ*Øðð
Ðð !Ð rD   c                óü  — |€t          j        ¦   «         }| j                             ¦   «         }dt          j        d|j        gf|j        t          j        df|j	        t          j
        dfdt          j        d|j        gf|j        t          j        df|j        t          j        df|j        t          j        df|j        t          j        df|j        o|t          j        dt/          | j        ¦  «        |j        gfg	}|S )a—  
        A framework for storing consecutive possibility rules and methods to be applied
        in :meth:`~music21.figuredBass.segment.Segment.allCorrectConsecutivePossibilities`.
        Takes in a :class:`~music21.figuredBass.rules.Rules` object, fbRules; if None
        then a new rules.Rules() object is created.

        Items are added within this method in the following form:

            (willRunOnlyIfTrue, methodToRun, keepSolutionsWhichReturn, optionalArgs)

        These items are compiled internally when
        :meth:`~music21.figuredBass.segment.Segment.allCorrectConsecutivePossibilities`
        is called on a Segment. Here, the compilation of rules and methods
        bases on a default fbRules is shown.

        >>> from music21.figuredBass import segment
        >>> segmentA = segment.Segment()
        >>> allConsecutiveRules = segmentA.consecutivePossibilityRules()

        >>> segment.printRules(allConsecutiveRules)
        Will run:  Method:                       Keep solutions which return:  Arguments:
        True       partsSame                     True                          []
        False      upperPartsSame                True                          None
        True       voiceOverlap                  False                         None
        True       partMovementsWithinLimits     True                          []
        True       parallelFifths                False                         None
        True       parallelOctaves               False                         None
        True       hiddenFifth                   False                         None
        True       hiddenOctave                  False                         None
        False      couldBeItalianA6Resolution    True           [<music21.pitch.Pitch C3>,
                                                                 <music21.pitch.Pitch C3>,
                                                                 <music21.pitch.Pitch E3>,
                                                                 <music21.pitch.Pitch G3>], True

        Now, a modified fbRules is provided, allowing hidden octaves and
        voice overlap, and limiting the soprano line to stepwise motion.

        >>> from music21.figuredBass import rules
        >>> fbRules = rules.Rules()
        >>> fbRules.forbidVoiceOverlap = False
        >>> fbRules.forbidHiddenOctaves = False
        >>> fbRules.partMovementLimits.append((1, 2))
        >>> allConsecutiveRules = segmentA.consecutivePossibilityRules(fbRules)
        >>> segment.printRules(allConsecutiveRules)
        Will run:  Method:                       Keep solutions which return:  Arguments:
        True       partsSame                     True                          []
        False      upperPartsSame                True                          None
        False      voiceOverlap                  False                         None
        True       partMovementsWithinLimits     True                          [(1, 2)]
        True       parallelFifths                False                         None
        True       parallelOctaves               False                         None
        True       hiddenFifth                   False                         None
        False      hiddenOctave                  False                         None
        False      couldBeItalianA6Resolution    True           [<music21.pitch.Pitch C3>,
                                                                 <music21.pitch.Pitch C3>,
                                                                 <music21.pitch.Pitch E3>,
                                                                 <music21.pitch.Pitch G3>], True
        NTF)r   r3   r   ÚisItalianAugmentedSixthr
   Ú	partsSameÚ_partsToCheckÚ_upperPartsRemainSameÚupperPartsSameÚforbidVoiceOverlapÚvoiceOverlapÚpartMovementsWithinLimitsÚpartMovementLimitsÚforbidParallelFifthsÚparallelFifthsÚforbidParallelOctavesÚparallelOctavesÚforbidHiddenFifthsÚhiddenFifthÚforbidHiddenOctavesÚhiddenOctaveÚresolveAugmentedSixthProperlyÚcouldBeItalianA6ResolutionÚ_unpackTriadÚ&restrictDoublingsInItalianA6Resolution)r@   r   rN   ÚconsecutivePossibRuless       rB   r   z#Segment.consecutivePossibilityRulesÐ   s÷   € ðx ˆ?Ý”k‘m”mˆGà"&Ô"3×"KÒ"KÑ"MÔ"MÐð •;Ô(¨$°Ô1FÐ0GÐHØÔ*­KÔ,FÈÐMØÔ'­Ô)AÀ5ÐIØ•;Ô8¸$ÀÔA[Ð@\Ð]ØÔ)­;Ô+EÀuÐMØÔ*­KÔ,GÈÐOØÔ'­Ô)@À%ÐHØÔ(­+Ô*BÀEÐJØÔ2ÐNÐ7NÝÔ6ØÝ˜dÔ/Ñ0Ô0°'Ô2`Ðaðcð"
Ðð &Ð%rD   c                ó2  — |€t          j        ¦   «         }| j                             ¦   «         }| j                             ¦   «         }| j                             ¦   «         }|j        o|| j        f|j        o|| j	        |j
        gf|j        o|| j        fg}|S )a2  
        A framework for storing methods which perform special resolutions
        on Segments. Unlike the methods in
        :meth:`~music21.figuredBass.segment.Segment.singlePossibilityRules` and
        :meth:`~music21.figuredBass.segment.Segment.consecutivePossibilityRules`,
        these methods deal with the Segment itself, and rely on submethods
        to resolve the individual possibilities accordingly depending on what
        the resolution Segment is.

        If fbRules is None, then a new rules.Rules() object is created.

        Items are added within this method in the following form:

        (willRunOnlyIfTrue, methodToRun, optionalArgs)

        These items are compiled internally
        when :meth:`~music21.figuredBass.segment.Segment.allCorrectConsecutivePossibilities`
        is called on a Segment. Here, the compilation of rules and methods
        based on a default fbRules is shown.

        >>> from music21.figuredBass import segment
        >>> segmentA = segment.Segment()
        >>> allSpecialResRules = segmentA.specialResolutionRules()
        >>> segment.printRules(allSpecialResRules, maxLength=3)
        Will run:  Method:                          Arguments:
        False      resolveDominantSeventhSegment    None
        False      resolveDiminishedSeventhSegment  False
        False      resolveAugmentedSixthSegment     None

        Dominant Seventh Segment:

        >>> segmentA = segment.Segment(bassNote=note.Note('B2'), notationString='6,5')
        >>> allSpecialResRules = segmentA.specialResolutionRules()
        >>> segment.printRules(allSpecialResRules, maxLength=3)
        Will run:  Method:                          Arguments:
        True       resolveDominantSeventhSegment    None
        False      resolveDiminishedSeventhSegment  False
        False      resolveAugmentedSixthSegment     None

        Fully-Diminished Seventh Segment:

        >>> segmentA = segment.Segment(bassNote=note.Note('B2'), notationString='-7')
        >>> allSpecialResRules = segmentA.specialResolutionRules()
        >>> segment.printRules(allSpecialResRules, maxLength=3)
        Will run:  Method:                          Arguments:
        False      resolveDominantSeventhSegment    None
        True       resolveDiminishedSeventhSegment  False
        False      resolveAugmentedSixthSegment     None

        Augmented Sixth Segment:

        >>> segmentA = segment.Segment(bassNote=note.Note('A-2'), notationString='#6,b5')
        >>> allSpecialResRules = segmentA.specialResolutionRules()
        >>> segment.printRules(allSpecialResRules, maxLength=3)
        Will run:  Method:                          Arguments:
        False      resolveDominantSeventhSegment    None
        False      resolveDiminishedSeventhSegment  False
        True       resolveAugmentedSixthSegment     None
        )r   r3   r   ÚisDominantSeventhÚisDiminishedSeventhÚisAugmentedSixthÚresolveDominantSeventhProperlyr   Ú resolveDiminishedSeventhProperlyr   ÚdoubledRootInDim7r_   r   )r@   r   re   rf   rg   ÚspecialResRuless         rB   r   zSegment.specialResolutionRules"  sµ   € ðx ˆ?Ý”k‘m”mˆGà Ô-×?Ò?ÑAÔAÐØ"Ô/×CÒCÑEÔEÐØÔ,×=Ò=Ñ?Ô?Ðð Ô3ÐIÐ8IØÔ/ð1àÔ5ÐMÐ:MØÔ4ØÔ*Ð+ð-ð Ô2ÐGÐ7GØÔ1ð3ð
ˆð ÐrD   c                óè  — | j         }|                     ¦   «         st          d¦  «        ‚t          |¦  «        }t	          j        ¦   «                              |¦  «        }|                     ¦   «         }|                     ¦   «         }| 	                    d¦  «        }| 	                    d¦  «        }| 	                    d¦  «        }	|j         }
| 
                    ¦   «         dk    }|
 
                    ¦   «         }|o|dk    }| 
                    ¦   «         dk    rV|
                     ¦   «         j        |j        k    r4|
                     ¦   «         s|
                     ¦   «         rd|j        _        |
                     ¦   «         j        |j        k    o|
                     ¦   «         t"          j        ||gf|
                     ¦   «         j        |j        k    o|
                     ¦   «         t"          j        ||gf|
                     ¦   «         j        |j        k    o|
                     ¦   «         o|dk    t"          j        |gf|
                     ¦   «         j        |	j        k    o|
                     ¦   «         o|dk    t"          j        |gf|
                     ¦   «         j        |j        k    o|
                     ¦   «         o|dk    t"          j        |gf|
                     ¦   «         j        |j        k    o|
                     ¦   «         o|dk    t"          j        |gfg}	 |                      ||¦  «        S # t          $ r2 | j                             d¦  «         |                      |¦  «        cY S w xY w)	aP  
        Can resolve a Segment whose :attr:`~music21.figuredBass.segment.Segment.segmentChord`
        spells out a dominant seventh chord. If no applicable method in
        :mod:`~music21.figuredBass.resolution` can be used, the Segment is resolved
        as an ordinary Segment.

        >>> from music21.figuredBass import segment
        >>> segmentA = segment.Segment(bassNote=note.Note('G2'), notationString='7')
        >>> allDomPossib = segmentA.allCorrectSinglePossibilities()
        >>> allDomPossibList = list(allDomPossib)
        >>> len(allDomPossibList)
        8
        >>> allDomPossibList[2]
        (<music21.pitch.Pitch D4>, <music21.pitch.Pitch B3>,
         <music21.pitch.Pitch F3>, <music21.pitch.Pitch G2>)
        >>> allDomPossibList[5]
        (<music21.pitch.Pitch D5>, <music21.pitch.Pitch B4>,
         <music21.pitch.Pitch F4>, <music21.pitch.Pitch G2>)

        Here, the Soprano pitch of resolution (C6) exceeds default maxPitch of B5, so
        it's filtered out.

        >>> [p.nameWithOctave for p in allDomPossibList[7]]
        ['B5', 'F5', 'D5', 'G2']

        >>> segmentB = segment.Segment(bassNote=note.Note('C3'), notationString='')
        >>> domResPairs = segmentA.resolveDominantSeventhSegment(segmentB)
        >>> domResPairsList = list(domResPairs)
        >>> len(domResPairsList)
        7
        >>> domResPairsList[2]
        ((<music21.pitch.Pitch D4>, <...B3>, <...F3>, <...G2>),
         (<...C4>, <...C4>, <...E3>, <...C3>))
        >>> domResPairsList[5]
        ((<...D5>, <...B4>, <...F4>, <...G2>), (<...C5>, <...C5>, <...E4>, <...C3>))
        z<Dominant seventh resolution: Not a dominant seventh Segment.r"   é   é   é   r   Fz[Dominant seventh resolution: No proper resolution available. Executing ordinary resolution.)r   re   ÚSegmentExceptionÚ_unpackSeventhChordr	   Ú
MajorScaleÚderiveÚgetParallelMinorÚgetTonicÚpitchFromDegreeÚ	inversionÚrootÚnameÚisMajorTriadÚisMinorTriadr   rF   r   ÚdominantSeventhToMajorTonicÚdominantSeventhToMinorTonicÚ dominantSeventhToMinorSubmediantÚ dominantSeventhToMajorSubmediantÚ!dominantSeventhToMajorSubdominantÚ!dominantSeventhToMinorSubdominantÚ_resolveSpecialSegmentr?   ÚwarnÚ_resolveOrdinarySegment)r@   ÚsegmentBÚdomChordÚdomChordInfoÚdominantScaleÚ
minorScaleÚtonicÚsubdominantÚmajSubmediantÚminSubmediantÚresChordÚdomInversionÚresInversionÚresolveV43toI6ÚdominantResolutionMethodss                  rB   r   z%Segment.resolveDominantSeventhSegmentq  sm  € ðL Ô$ˆØ×)Ò)Ñ+Ô+ð 	cå"Ð#aÑbÔbÐbÝ*¨8Ñ4Ô4ˆÝÔ(Ñ*Ô*×1Ò1°(Ñ;Ô;ˆØ"×3Ò3Ñ5Ô5ˆ
à×&Ò&Ñ(Ô(ˆØ#×3Ò3°AÑ6Ô6ˆØ%×5Ò5°aÑ8Ô8ˆØ"×2Ò2°1Ñ5Ô5ˆàÔ(ˆØ ×*Ò*Ñ,Ô,°Ò1ˆØ ×*Ò*Ñ,Ô,ˆØ%Ð;¨,¸!Ò*;ˆà×ÒÑ Ô  AÒ%Ð%Ø—M’M‘O”OÔ(¨E¬JÒ6Ð6Ø×*Ò*Ñ,Ô,ð 7Ø08×0EÒ0EÑ0GÔ0Gð 7ð >CˆHÔÔ:ð �]Š]‰_Œ_Ô! U¤ZÒ/ÐK°H×4IÒ4IÑ4KÔ4KÝÔ3Ø˜lÐ+ð-ð �]Š]‰_Œ_Ô! U¤ZÒ/ÐK°H×4IÒ4IÑ4KÔ4KÝÔ6Ø Ð.ð0ð �mŠm‰oŒoÔ" mÔ&8Ò8ð $Ø×'Ò'Ñ)Ô)ð$à !Ò#ÝÔ;Ø�ð	 ð
 �mŠm‰oŒoÔ" mÔ&8Ò8ð &Ø×)Ò)Ñ+Ô+ð&à  AÒ%ÝÔ;Ø�ð	 ð
 �mŠm‰oŒoÔ" kÔ&6Ò6ð &Ø×)Ò)Ñ+Ô+ð&à  AÒ%ÝÔ<Ø�ð	 ð
 �mŠm‰oŒoÔ" kÔ&6Ò6ð &Ø×)Ò)Ñ+Ô+ð&à  AÒ%ÝÔ<Ø�ð	 ð-%
Ð!ð:	:Ø×.Ò.¨xÐ9RÑSÔSÐSøÝð 	:ð 	:ð 	:ØÔ×#Ò#ð3ñ4ô 4ð 4ð ×/Ò/°Ñ9Ô9Ð9Ð9Ð9ð		:øøøs   ÌL5 Ì59M1Í0M1Fc                ó¬  — | j         }|                     ¦   «         st          d¦  «        ‚t          |¦  «        }t	          j        ¦   «                              d|                     ¦   «         ¦  «        }|                     ¦   «         }| 	                    d¦  «        }|j         }| 
                    ¦   «         dk    r5| 
                    ¦   «         dk    rd}n| 
                    ¦   «         dk    rd}|                     ¦   «         j        |j        k    o|                     ¦   «         t          j        ||gf|                     ¦   «         j        |j        k    o|                     ¦   «         t          j        ||gf|                     ¦   «         j        |j        k    o|                     ¦   «         t          j        |gf|                     ¦   «         j        |j        k    o|                     ¦   «         t          j        |gfg}		 |                      ||	¦  «        S # t          $ r2 | j                             d¦  «         |                      |¦  «        cY S w xY w)	aõ  
        Can resolve a Segment whose :attr:`~music21.figuredBass.segment.Segment.segmentChord`
        spells out a diminished seventh chord. If no applicable method in
        :mod:`~music21.figuredBass.resolution` can be used, the Segment is resolved
        as an ordinary Segment.

        >>> from music21.figuredBass import segment
        >>> segmentA = segment.Segment(bassNote=note.Note('B2'), notationString='b7')
        >>> allDimPossib = segmentA.allCorrectSinglePossibilities()
        >>> allDimPossibList = list(allDimPossib)
        >>> len(allDimPossibList)
        7
        >>> [p.nameWithOctave for p in allDimPossibList[4]]
        ['D5', 'A-4', 'F4', 'B2']
        >>> [p.nameWithOctave for p in allDimPossibList[6]]
        ['A-5', 'F5', 'D5', 'B2']

        >>> segmentB = segment.Segment(bassNote=note.Note('C3'), notationString='')
        >>> dimResPairs = segmentA.resolveDiminishedSeventhSegment(segmentB)
        >>> dimResPairsList = list(dimResPairs)
        >>> len(dimResPairsList)
        7
        >>> dimResPairsList[4]
        ((<...D5>, <...A-4>, <...F4>, <...B2>), (<...E5>, <...G4>, <...E4>, <...C3>))
        >>> dimResPairsList[6]
        ((<...A-5>, <...F5>, <...D5>, <...B2>), (<...G5>, <...E5>, <...E5>, <...C3>))
        z@Diminished seventh resolution: Not a diminished seventh Segment.é   r"   ro   r   TFz]Diminished seventh resolution: No proper resolution available. Executing ordinary resolution.)r   rf   rp   rq   r	   ÚHarmonicMinorScaleÚderiveByDegreerx   ru   rv   rw   ry   rz   r   ÚdiminishedSeventhToMajorTonicr{   ÚdiminishedSeventhToMinorTonicÚ#diminishedSeventhToMajorSubdominantÚ#diminishedSeventhToMinorSubdominantr‚   r?   rƒ   r„   )
r@   r…   ÚdoubledRootÚdimChordÚdimChordInfoÚdimScalerŠ   r‹   rŽ   ÚdiminishedResolutionMethodss
             rB   r   z'Segment.resolveDiminishedSeventhSegmentÔ  sN  € ð: Ô$ˆØ×+Ò+Ñ-Ô-ð 	Tå"ØRñTô Tð Tå*¨8Ñ4Ô4ˆÝÔ+Ñ-Ô-×<Ò<¸QÀÇÂÁÄÑPÔPˆð ×!Ò!Ñ#Ô#ˆØ×.Ò.¨qÑ1Ô1ˆàÔ(ˆØ×ÒÑÔ 1Ò$Ð$Ø×!Ò!Ñ#Ô# qÒ(Ð(Ø"��Ø×#Ò#Ñ%Ô%¨Ò*Ð*Ø#�ð �]Š]‰_Œ_Ô! U¤ZÒ/ÐK°H×4IÒ4IÑ4KÔ4KÝÔ5Ø˜<Ð(ð*ð �]Š]‰_Œ_Ô! U¤ZÒ/ÐK°H×4IÒ4IÑ4KÔ4KÝÔ8Ø˜lÐ+ð-ð �]Š]‰_Œ_Ô! [Ô%5Ò5ÐQ¸(×:OÒ:OÑ:QÔ:QÝÔ>Ø�ð ð �]Š]‰_Œ_Ô! [Ô%5Ò5ÐQ¸(×:OÒ:OÑ:QÔ:QÝÔ>Ø�ð ð'
Ð#ð	:Ø×.Ò.¨xÐ9TÑUÔUÐUøÝð 	:ð 	:ð 	:ØÔ×#Ò#ð3ñ4ô 4ð 4ð ×/Ò/°Ñ9Ô9Ð9Ð9Ð9ð		:øøøs   ÈH È9IÉIc                ó   — | j         }|                     ¦   «         st          d¦  «        ‚|                     ¦   «         r|                      |¦  «        S |                     ¦   «         rd}n]|                     ¦   «         rd}nF|                     ¦   «         rd}n/| j         	                    d¦  «         |                      |¦  «        S t          j        |                     ¦   «         d¦  «        }t          j        |¦  «        }|j         }t          |¦  «        }|                     ¦   «         dk    o5|                     ¦   «         j        |j        k    o|                     ¦   «         t          j        ||gf|                     ¦   «         dk    o5|                     ¦   «         j        |j        k    o|                     ¦   «         t          j        ||gf|                     d¦  «        j        |                     ¦   «         j        k    o|                     ¦   «         t          j        ||gfg}	 |                      ||¦  «        S # t          $ r2 | j         	                    d¦  «         |                      |¦  «        cY S w xY w)	a¦  
        Can resolve a Segment whose :attr:`~music21.figuredBass.segment.Segment.segmentChord`
        spells out a
        French, German, or Swiss augmented sixth chord. Italian augmented sixth Segments
        are solved as an
        ordinary Segment using :meth:`~music21.figuredBass.possibility.couldBeItalianA6Resolution`.
        If no
        applicable method in :mod:`~music21.figuredBass.resolution` can be used, the Segment
        is resolved
        as an ordinary Segment.

        >>> from music21.figuredBass import segment
        >>> segmentA = segment.Segment(bassNote=note.Note('A-2'), notationString='#6,b5,3')
        >>> segmentA.pitchNamesInChord  # spell out a Gr+6 chord
        ['A-', 'C', 'E-', 'F#']
        >>> allAugSixthPossib = segmentA.allCorrectSinglePossibilities()
        >>> allAugSixthPossibList = list(allAugSixthPossib)
        >>> len(allAugSixthPossibList)
        7

        >>> allAugSixthPossibList[1]
        (<music21.pitch.Pitch C4>, <music21.pitch.Pitch F#3>, <...E-3>, <...A-2>)
        >>> allAugSixthPossibList[4]
        (<music21.pitch.Pitch C5>, <music21.pitch.Pitch F#4>, <...E-4>, <...A-2>)

        >>> segmentB = segment.Segment(bassNote=note.Note('G2'), notationString='')
        >>> allAugResPossibPairs = segmentA.resolveAugmentedSixthSegment(segmentB)
        >>> allAugResPossibPairsList = list(allAugResPossibPairs)
        >>> len(allAugResPossibPairsList)
        7
        >>> allAugResPossibPairsList[1]
        ((<...C4>, <...F#3>, <...E-3>, <...A-2>), (<...B3>, <...G3>, <...D3>, <...G2>))
        >>> allAugResPossibPairsList[4]
        ((<...C5>, <...F#4>, <...E-4>, <...A-2>), (<...B4>, <...G4>, <...D4>, <...G2>))
        z;Augmented sixth resolution: Not an augmented sixth Segment.ro   rn   é   z^Augmented sixth resolution: Augmented sixth type not supported. Executing ordinary resolution.ÚM3é   zZAugmented sixth resolution: No proper resolution available. Executing ordinary resolution.)r   rg   rp   rN   r„   ÚisFrenchAugmentedSixthÚisGermanAugmentedSixthÚisSwissAugmentedSixthr?   rƒ   r   Ú
_transposeÚbassr	   rr   rq   rw   rx   ry   rz   ÚaugmentedSixthToMajorTonicr{   ÚaugmentedSixthToMinorTonicrv   ÚaugmentedSixthToDominantr‚   )	r@   r…   ÚaugSixthChordÚaugSixthTyperŠ   Ú
majorScalerŽ   ÚaugSixthChordInfoÚaugmentedSixthResolutionMethodss	            rB   r   z$Segment.resolveAugmentedSixthSegment  s¡  € ðJ Ô)ˆØ×-Ò-Ñ/Ô/ð 	bå"Ð#`ÑaÔaÐaØ×0Ò0Ñ2Ô2ð 	:Ø×/Ò/°Ñ9Ô9Ð9Ø×1Ò1Ñ3Ô3ð 
	:ØˆLˆLØ×1Ò1Ñ3Ô3ð 	:ØˆLˆLØ×0Ò0Ñ2Ô2ð 	:ØˆLˆLàÔ×#Ò#ðWñXô Xð Xð ×/Ò/°Ñ9Ô9Ð9åÔ% m×&8Ò&8Ñ&:Ô&:¸DÑAÔAˆÝÔ% eÑ,Ô,ˆ
àÔ(ˆÝ/°Ñ>Ô>Ðð × Ò Ñ"Ô" aÒ'ð ,Ø—M’M‘O”OÔ(¨E¬JÒ6ð,à×)Ò)Ñ+Ô+ÝÔ2°\ÐCTÐ4UðWð × Ò Ñ"Ô" aÒ'ð ,Ø—M’M‘O”OÔ(¨E¬JÒ6ð,à×)Ò)Ñ+Ô+ÝÔ5ØÐ0Ð1ð	3ð
 ×(Ò(¨Ñ+Ô+Ô0°H·M²M±O´OÔ4HÒHð ,Ø×)Ò)Ñ+Ô+ÝÔ3ØÐ0Ð1ð3ð+
Ð'ð 	:Ø×.Ò.¨xÐ9XÑYÔYÐYøÝð 	:ð 	:ð 	:ØÔ×#Ò#ð3ñ4ô 4ð 4ð ×/Ò/°Ñ9Ô9Ð9Ð9Ð9ð		:øøøs   È+I É9I=É<I=c                ó²   — | j         g| j        dz
  z  }|                     t          j        | j        j        j        ¦  «        g¦  «         t          j        |Ž S )a  
        Returns an iterator through a set of naive possibilities for
        a Segment, using :attr:`~music21.figuredBass.segment.Segment.numParts`,
        the pitch of :attr:`~music21.figuredBass.segment.Segment.bassNote`, and
        :attr:`~music21.figuredBass.segment.Segment.allPitchesAboveBass`.

        >>> from music21.figuredBass import segment
        >>> segmentA = segment.Segment()
        >>> allPossib = segmentA.allSinglePossibilities()
        >>> allPossib.__class__
        <... 'itertools.product'>

        The number of naive possibilities is always the length of
        :attr:`~music21.figuredBass.segment.Segment.allPitchesAboveBass`
        raised to the (:attr:`~music21.figuredBass.segment.Segment.numParts` - 1)
        power. The power is 1 less than the number of parts because
        the bass pitch is constant.

        >>> allPossibList = list(allPossib)
        >>> len(segmentA.allPitchesAboveBass)
        9
        >>> segmentA.numParts
        4
        >>> len(segmentA.allPitchesAboveBass) ** (segmentA.numParts-1)
        729
        >>> len(allPossibList)
        729

        >>> for i in (81, 275, 426):
        ...    [str(p) for p in allPossibList[i]]
        ['E3', 'C3', 'C3', 'C3']
        ['C4', 'C4', 'G4', 'C3']
        ['G4', 'G3', 'C4', 'C3']
        ro   )	r   r   Úappendr   r1   r   ÚnameWithOctaveÚ	itertoolsÚproduct)r@   Ú	iterabless     rB   r   zSegment.allSinglePossibilitiesp  sS   € ðF Ô-Ð.°$´-À!Ñ2CÑDˆ	Ø×Ò�%œ+ d¤mÔ&9Ô&HÑIÔIÐJÑKÔKÐKÝÔ  )Ð,Ð,rD   c                ó    ‡ — t          ‰                      ‰ j        ¦  «        ¦  «        ‰ _        ‰                      ¦   «         }ˆ fd„|D ¦   «         S )a  
        Uses :meth:`~music21.figuredBass.segment.Segment.allSinglePossibilities` and
        returns an iterator through a set of correct possibilities for
        a Segment, all possibilities which pass all filters in
        :meth:`~music21.figuredBass.segment.Segment.singlePossibilityRules`.

        >>> from music21.figuredBass import segment
        >>> segmentA = segment.Segment()
        >>> allPossib = segmentA.allSinglePossibilities()
        >>> allCorrectPossib = segmentA.allCorrectSinglePossibilities()

        Most of the 729 naive possibilities were filtered out using the default rules set,
        leaving only 21.

        >>> allPossibList = list(allPossib)
        >>> len(allPossibList)
        729
        >>> allCorrectPossibList = list(allCorrectPossib)
        >>> len(allCorrectPossibList)
        21

        >>> for i in (5, 12, 20):
        ...   [str(p) for p in allCorrectPossibList[i]]
        ['E4', 'G3', 'G3', 'C3']
        ['C5', 'G4', 'E4', 'C3']
        ['G5', 'G5', 'E5', 'C3']
        c                ó>   •— g | ]}‰                      |¦  «        ¯|‘ŒS © ©Ú_isCorrectSinglePossibility)Ú.0ÚpossibAr@   s     €rB   ú
<listcomp>z9Segment.allCorrectSinglePossibilities.<locals>.<listcomp>¶  s-   ø€ ÐYÐYÐY˜G¨t×/OÒ/OÐPWÑ/XÔ/XÐY�ÐYÐYÐYrD   )Ú_compileRulesr   r   r7   r   )r@   ÚallAs   ` rB   r   z%Segment.allCorrectSinglePossibilities—  sU   ø€ õ8 /<Ø×'Ò'¨¬Ñ5Ô5ñ/7ô /7ˆÔ+à×*Ò*Ñ,Ô,ˆØYÐYÐYÐY tÐYÑYÔYÐYrD   c                ó<  — | j         |j         k    st          d¦  «        ‚| j        |j        k    st          d¦  «        ‚t          |                      | j        ¦  «        d¦  «        | _        | j        d         D ]\  }} ||g|¢R Ž c S |                      |¦  «        S )aK
  
        Returns an iterator through correct (possibA, possibB) pairs.

        * If segmentA (self) is a special Segment, meaning that one of the Segment
          resolution methods in :meth:`~music21.figuredBass.segment.Segment.specialResolutionRules`
          needs to be applied, then this method returns every correct possibility of segmentA
          matched up with exactly one resolution possibility.

        * If segmentA is an ordinary, non-special Segment, then this method returns every
          combination of correct possibilities of segmentA and correct possibilities of segmentB
          which passes all filters
          in :meth:`~music21.figuredBass.segment.Segment.consecutivePossibilityRules`.

        Two notes on segmentA being a special Segment:

        1. By default, resolution possibilities are not filtered
           using :meth:`~music21.figuredBass.segment.Segment.singlePossibilityRules`
           rules of segmentB. Filter by setting
           :attr:`~music21.figuredBass.rules.Rules.applySinglePossibRulesToResolution` to True.

        2. By default, (possibA, possibB) pairs are not filtered
           using :meth:`~music21.figuredBass.segment.Segment.consecutivePossibilityRules`
           rules of segmentA. Filter by setting
           :attr:`~music21.figuredBass.rules.Rules.applyConsecutivePossibRulesToResolution`
           to True.

        >>> from music21.figuredBass import segment
        >>> segmentA = segment.Segment(bassNote=note.Note('C3'), notationString='')
        >>> segmentB = segment.Segment(bassNote=note.Note('D3'), notationString='4,3')

        Here, an ordinary resolution is being executed, because segmentA is an ordinary Segment.

        >>> consecutivePairs1 = segmentA.allCorrectConsecutivePossibilities(segmentB)
        >>> consecutivePairsList1 = list(consecutivePairs1)
        >>> len(consecutivePairsList1)
        31
        >>> consecutivePairsList1[29]
        ((<...G5>, <...G5>, <...E5>, <...C3>), (<...G5>, <...F5>, <...B4>, <...D3>))

        Here, a special resolution is being executed, because segmentA below is a
        special Segment.

        >>> segmentA = segment.Segment(bassNote=note.Note('D3'), notationString='4,3')
        >>> segmentB = segment.Segment(bassNote=note.Note('C3'), notationString='')
        >>> consecutivePairs2 = segmentA.allCorrectConsecutivePossibilities(segmentB)
        >>> consecutivePairsList2 = list(consecutivePairs2)
        >>> len(consecutivePairsList2)
        6
        >>> consecutivePairsList2[5]
        ((<...G5>, <...F5>, <...B4>, <...D3>), (<...G5>, <...E5>, <...C5>, <...C3>))
        z6Two segments with unequal numParts cannot be compared.z6Two segments with unequal maxPitch cannot be compared.r¡   T)r   rp   r9   r¿   r   r   r6   r„   )r@   r…   ÚresolutionMethodÚargss       rB   r   z*Segment.allCorrectConsecutivePossibilities¸  s½   € ðj ” Ô!2Ò2Ð2Ý"Ð#[Ñ\Ô\Ð\Ø” (Ô"4Ò4Ð4Ý"Ð#[Ñ\Ô\Ð\Ý.;Ø×'Ò'¨¬Ñ5Ô5Øñ/
ô /
ˆÔ+ð )-Ô(KÈDÔ(Qð 	5ð 	5Ñ$Ð˜tØ#Ð# HÐ4¨tÐ4Ð4Ð4Ð4Ð4Ð4Ø×+Ò+¨HÑ5Ô5Ð5rD   c                óN   — | j         d         D ]\  }}} ||g|¢R Ž |k    s dS ŒdS )zé
        Takes in a possibility (possibA) from a segmentA (self) and returns True
        if the possibility is correct given
        :meth:`~music21.figuredBass.segment.Segment.singlePossibilityRules`
        from segmentA.
        TF)r7   )r@   r½   ÚmethodÚ	isCorrectrÃ   s        rB   r»   z#Segment._isCorrectSinglePossibilityü  sP   € ð *.Ô)LÈTÔ)Rð 	ð 	Ñ%ˆV�Y Ø�F˜7Ð* TÐ*Ð*Ð*¨iÒ7Ð7Ø�u�uð 8àˆtrD   c                óP   — | j         d         D ]\  }}} |||g|¢R Ž |k    s dS ŒdS )z÷
        Takes in a (possibA, possibB) pair from a segmentA (self) and segmentB,
        and returns True if the pair is correct given
        :meth:`~music21.figuredBass.segment.Segment.consecutivePossibilityRules`
        from segmentA.
        TF)r8   )r@   r½   ÚpossibBrÅ   rÆ   rÃ   s         rB   Ú _isCorrectConsecutivePossibilityz(Segment._isCorrectConsecutivePossibility  sT   € ð *.Ô)QÐRVÔ)Wð 	ð 	Ñ%ˆV�Y Ø�F˜7 GÐ3¨dÐ3Ð3Ð3°yÒ@Ð@Ø�u�uð AàˆtrD   c                óü   ‡ — t          ‰                      ‰ j        ¦  «        ¦  «        ‰ _        ‰                      ¦   «         }|                     ¦   «         }t          j        ||¦  «        }t          ˆ fd„|¦  «        S )am  
        An ordinary segment is defined as a segment which needs no special resolution, where the
        segment does not spell out a special chord, for example, a dominant seventh.

        Finds iterators through all possibA and possibB by calling
        :meth:`~music21.figuredBass.segment.Segment.allCorrectSinglePossibilities`
        on self (segmentA) and segmentB, respectively.
        Returns an iterator through (possibA, possibB) pairs for which
        :meth:`~music21.figuredBass.segment.Segment._isCorrectConsecutivePossibility` returns True.

        >>> from music21.figuredBass import segment
        c                óJ   •— ‰                      | d         | d         ¬¦  «        S ©Nr   ro   )r½   rÈ   ©rÉ   ©ÚpossibABr@   s    €rB   ú<lambda>z1Segment._resolveOrdinarySegment.<locals>.<lambda>&  s1   ø€  t×'LÒ'LÐU]Ð^_ÔU`ØV^Ð_`ÔVað (Mñ (cô (c€ rD   )r¿   r   r   r8   r   r´   rµ   Úfilter)r@   r…   ÚcorrectAÚcorrectBÚ	correctABs   `    rB   r„   zSegment._resolveOrdinarySegment  sŒ   ø€ õ 4AØ×,Ò,¨T¬\Ñ:Ô:ñ4<ô 4<ˆÔ0à×5Ò5Ñ7Ô7ˆØ×9Ò9Ñ;Ô;ˆÝÔ% h°Ñ9Ô9ˆ	Ýð cð cð cð cà ñ"ô "ð 	"rD   c                ó@  ‡ ‡— t          |d¦  «        }|d         D ]õ\  }}g }|D ])}|                     t          j        |¦  «        ¦  «         Œ*t	          |‰                      ¦   «         g|¢R Ž }t          ‰                      ¦   «         |¦  «        }	t          ˆfd„|	¦  «        }	‰ j        j	        rt          ˆ fd„|	¦  «        }	‰ j        j
        r?t          ‰                     ‰j        ¦  «        ¦  «        ‰_        t          ˆfd„|	¦  «        }	|	c S t          d¦  «        ‚)Nr¡   Tc                óF   •— t          j        | d         ‰j        ¬¦  «        S )Nro   )r½   r*   )r
   ÚpitchesWithinLimitr9   ©rÏ   r…   s    €rB   rÐ   z0Segment._resolveSpecialSegment.<locals>.<lambda>2  s&   ø€ µÔ0NØ  œØ!Ô+ð1-ñ 1-ô 1-€ rD   c                óJ   •— ‰                      | d         | d         ¬¦  «        S rÌ   rÍ   rÎ   s    €rB   rÐ   z0Segment._resolveSpecialSegment.<locals>.<lambda>7  s+   ø€ °D×4YÒ4YØ$ QœKØ$ QœKð 5Zñ 5)ô 5)€ rD   c                ó<   •— ‰                      | d         ¬¦  «        S )Nro   )r½   rº   rØ   s    €rB   rÐ   z0Segment._resolveSpecialSegment.<locals>.<lambda>>  s$   ø€ °H×4XÒ4XØ$ QœKð 5Yñ 5)ô 5)€ rD   z!No standard resolution available.)r¿   r²   r´   ÚrepeatÚmapr   ÚziprÑ   r   Ú'applyConsecutivePossibRulesToResolutionÚ"applySinglePossibRulesToResolutionr   r7   rp   )
r@   r…   ÚspecialResolutionMethodsÚresolutionMethodExecutorrÂ   rÃ   r¶   ÚargÚresolutionsrÔ   s
   ``        rB   r‚   zSegment._resolveSpecialSegment*  s~  øø€ Ý#0Ð1IÈ1Ñ#MÔ#MÐ Ø(@ÀÔ(Fð 	ð 	Ñ$Ð˜tØˆIØð 8ð 8�Ø× Ò ¥Ô!1°#Ñ!6Ô!6Ñ7Ô7Ð7Ð7ÝÐ.°×0RÒ0RÑ0TÔ0TÐaÐW`ÐaÐaÐaˆKÝ˜D×>Ò>Ñ@Ô@À+ÑNÔNˆIÝð  -ð  -ð  -ð  -ð ñô ˆIð Œ|ÔCð Ý"ð $)ð $)ð $)ð $)ð ñô �	ð Œ|Ô>ð Ý:GØ×3Ò3°HÔ4DÑEÔEñ;Gô ;G�Ô7å"ð $)ð $)ð $)ð $)àñô �	ð ÐÐÐåÐBÑCÔCÐCrD   )r!   NNNr"   r#   N)
r   r$   r%   r&   r'   r(   r   r)   r*   r+   ©N)F)Ú__name__Ú
__module__Ú__qualname__Ú
_DOC_ORDERr    Ú__annotations__rC   r   r   r   r   r   r   r   r   r   r»   rÉ   r„   r‚   r¹   rD   rB   r   r   #   s–  € € € € € € ð2ð 2ð 2€Jð4ð%ðað ]ð@àað%!ð !€Ið ð ð ñ ð, ,0Ø,0Ø@DØ-1ØØ-1Ø#ðP;ð P;ð P;ð P;ð P;ðj7!ð 7!ð 7!ð 7!ðrP&ð P&ð P&ð P&ðdMð Mð Mð Mð^a:ð a:ð a:ðFE:ð E:ð E:ð E:ðNS:ð S:ð S:ðj%-ð %-ð %-ðNZð Zð ZðB?6ð ?6ð ?6ðH
ð 
ð 
ð
ð 
ð 
ð"ð "ð "ð,Dð Dð Dð Dð DrD   r   c                  ó   — e Zd ZdZd„ ZdS )ÚOverlaidSegmentzF
    Class to allow Segments to be overlaid with non-chord notes.
    c                ó  — | j         g| j        dz
  z  }|                     t          j        | j        j        j        ¦  «        g¦  «         | j        j        D ]%\  }}t          j        |j        ¦  «        g||dz
  <   Œ&t          j
        |Ž S )Nro   )r   r   r²   r   r1   r   r³   r   Ú_partPitchLimitsr´   rµ   )r@   r¶   Ú
partNumberÚ	partPitchs       rB   r   z&OverlaidSegment.allSinglePossibilitiesK  sŒ   € ØÔ-Ð.°$´-À!Ñ2CÑDˆ	Ø×Ò�%œ+ d¤mÔ&9Ô&HÑIÔIÐJÑKÔKÐKØ'+¤|Ô'Dð 	Pð 	PÑ#ˆZ˜Ý).¬°YÔ5MÑ)NÔ)NÐ(OˆI�j 1‘nÑ%Ð%ÝÔ  )Ð,Ð,rD   N)rå   ræ   rç   Ú__doc__r   r¹   rD   rB   rë   rë   F  s-   € € € € € ðð ð-ð -ð -ð -ð -rD   rë   ©ÚCÚEÚGr!   ÚC8Ú	bassPitchr+   r*   c                óö  ‡‡— t          ‰t          ¦  «        rt          j        ‰¦  «        Št          ‰t          ¦  «        rt          j        ‰¦  «        Š‰j        €t          d¦  «        ‚t          j        | t          ‰j        dz   ¦  «        ¦  «        }t          d„ |¦  «        }t          j
        ˆfd„|¦  «        }t          j
        ˆfd„|¦  «        }t          |¦  «        }|                     ¦   «          |S )a  
    Given a list of pitchNames, a bassPitch, and a maxPitch, returns a sorted list of
    pitches between the two limits (inclusive) which correspond to items in pitchNames.

    >>> from music21.figuredBass import segment
    >>> pitches = segment.getPitches()
    >>> print(', '.join([p.nameWithOctave for p in pitches]))
    C3, E3, G3, C4, E4, G4, C5, E5, G5, C6, E6, G6, C7, E7, G7, C8

    >>> pitches = segment.getPitches(['G', 'B', 'D', 'F'], bassPitch=pitch.Pitch('B2'))
    >>> print(', '.join([p.nameWithOctave for p in pitches]))
    B2, D3, F3, G3, B3, D4, F4, G4, B4, D5, F5, G5, B5, D6, F6, G6, B6, D7, F7, G7, B7

    >>> pitches = segment.getPitches(['F##', 'A#', 'C#'], bassPitch=pitch.Pitch('A#3'))
    >>> print(', '.join([p.nameWithOctave for p in pitches]))
    A#3, C#4, F##4, A#4, C#5, F##5, A#5, C#6, F##6, A#6, C#7, F##7, A#7

    The maxPitch must have an octave:

    >>> segment.getPitches(maxPitch=pitch.Pitch('E'))
    Traceback (most recent call last):
    ValueError: maxPitch must be given an octave
    Nz maxPitch must be given an octavero   c                ób   — t          j        | d         t          | d         ¦  «        z   ¦  «        S )Nr   ro   )r   r1   r/   )Úxs    rB   rÐ   zgetPitches.<locals>.<lambda>w  s#   € �%œ+ a¨¤d­S°°1´©Y¬YÑ&6Ñ7Ô7€ rD   c                ó   •— ‰| k    S rä   r¹   )ÚsamplePitchrö   s    €rB   rÐ   zgetPitches.<locals>.<lambda>x  s   ø€ °iÀ+Ò6M€ rD   c                ó   •— | ‰k    S rä   r¹   )rû   r*   s    €rB   rÐ   zgetPitches.<locals>.<lambda>y  s   ø€ °kÀHÒ6L€ rD   )r.   r/   r   r1   ÚoctaveÚ
ValueErrorr´   rµ   ÚrangerÜ   ÚfilterfalseÚlistÚsort)Ú
pitchNamesrö   r*   Úiter1Úiter2Úiter3Úiter4Ú
allPitchess    ``     rB   r;   r;   U  sì   øø€ õ4 �)�SÑ!Ô!ð +Ý”K 	Ñ*Ô*ˆ	Ý�(�CÑ Ô ð )Ý”;˜xÑ(Ô(ˆà„ÐÝÐ;Ñ<Ô<Ð<ÝÔ˜j­%°´À!Ñ0CÑ*DÔ*DÑEÔE€EÝÐ7Ð7¸Ñ?Ô?€EÝÔ!Ð"MÐ"MÐ"MÐ"MÈuÑUÔU€EÝÔ!Ð"LÐ"LÐ"LÐ"LÈeÑTÔT€EÝ�e‘”€JØ‡O‚OÑÔÐØÐrD   c                óâ   — |                       ¦   «         }|                      ¦   «         }|                      d¦  «        }|                      d¦  «        }|                      d¦  «        }|||||g}|S )Nr¡   r£   r”   ©r¨   rx   ÚgetChordStep)ÚseventhChordr¨   rx   ÚthirdÚfifthÚseventhÚseventhChordInfos          rB   rq   rq     st   € Ø×ÒÑÔ€DØ×ÒÑÔ€DØ×%Ò% aÑ(Ô(€EØ×%Ò% aÑ(Ô(€EØ×'Ò'¨Ñ*Ô*€GØ˜d E¨5°'Ð:ÐØÐrD   c                ó¶   — |                       ¦   «         }|                      ¦   «         }|                      d¦  «        }|                      d¦  «        }||||g}|S )Nr¡   r£   r
  )ÚthreePartChordr¨   rx   r  r  ÚthreePartChordInfos         rB   ra   ra   ‰  s_   € Ø×ÒÑ Ô €DØ×ÒÑ Ô €DØ×'Ò'¨Ñ*Ô*€EØ×'Ò'¨Ñ*Ô*€EØ  e¨UÐ3ÐØÐrD   r"   c                ó¦  — t          j        t          ¦  «        }t          t	          | ¦  «        ¦  «        D ]š}g }t	          | |         ¦  «        |k    r| |         d         }|dk    r3| |         dd…         \  }}}||                              |||f¦  «         Œd|dk    r0| |         dd…         \  }}||                              ||f¦  «         Œ›|S )Néÿÿÿÿr"   r   r¡   rn   )ÚcollectionsÚdefaultdictr  rÿ   Úlenr²   )Ú	rulesListÚ	maxLengthÚruleCheckingÚ	ruleIndexrÃ   ÚshouldRunMethodrÅ   rÆ   s           rB   r¿   r¿   ’  sè   € ÝÔ*­4Ñ0Ô0€LÝ�3˜y™>œ>Ñ*Ô*ð 	Að 	Aˆ	ØˆÝˆy˜Ô#Ñ$Ô$¨	Ò1Ð1Ø˜YÔ'¨Ô+ˆDØ˜Š>ˆ>Ø3<¸YÔ3GÈÈ!ÈÔ3LÑ0ˆ_˜f iØ˜Ô)×0Ò0°&¸)ÀTÐ1JÑKÔKÐKÐKØ˜!Š^ˆ^Ø(1°)Ô(<¸Q¸q¸SÔ(AÑ%ˆ_˜fØ˜Ô)×0Ò0°&¸$°Ñ@Ô@Ð@øàÐrD   c                ó†  ‡— dŠ| D ]=}t          |d         j        ¦  «        ‰k    rt          |d         j        ¦  «        dz   ŠŒ>ˆfd„}dd‰dz
  z  z   }|dk    rt          d	|› d
�¦  «         n|dk    rt          d	|› d�¦  «         t          t          | ¦  «        ¦  «        D �]}d}g }t          | |         ¦  «        |k    r| |         d         }|sd}nTd}t          t          |¦  «        ¦  «        D ]5}	|t	          ||	         ¦  «        z  }|	t          |¦  «        dz
  k    s|dz  }Œ6|dk    rF| |         dd…         \  }
}} ||¦  «        }t	          |
¦  «        d›|› t	          |¦  «        d›|› �}n:|dk    r4| |         dd…         \  }
} ||¦  «        }t	          |
¦  «        d›|› |› �}t          |¦  «         �ŒdS )a  
    Method which can print to the console rules inputted into
    :meth:`~music21.figuredBass.segment.Segment.singlePossibilityRules`,
    :meth:`~music21.figuredBass.segment.Segment.consecutivePossibilityRules`, and
    :meth:`~music21.figuredBass.segment.Segment.specialResolutionRules`.
    For the first two methods, maxLength is 4. For the third method, maxLength is 3.

    OMIT_FROM_DOCS
    maxLength is the maximum length of a rule, a rule which includes arguments,
    because arguments are optional.
    é   ro   rn   c                ó|   •— | j         d‰…         }t          |¦  «        ‰k     r|d‰t          |¦  «        z
  z  z  }|S )Nr   ú )rå   r  )ÚmÚ
methodNameÚMAX_SIZEs     €rB   Ú	padMethodzprintRules.<locals>.padMethod³  sD   ø€ Ø”Z  ( 
Ô+ˆ
Ýˆz‰?Œ?˜XÒ%Ð%Ø˜# ­C°
©O¬OÑ!;Ñ<Ñ<ˆJØÐrD   zMethod:r!  r”   r"   zWill run:  z(Keep solutions which return:  Arguments:r¡   z
Arguments:Nr  ÚNoneÚ z, r   Ú11Ú30)r  rå   Úprintrÿ   r/   )r  r  Úruler%  Ú	methodStrr  ÚruleToPrintrÃ   Ú
argsStringÚ	itemIndexr  rÅ   rÆ   r$  s                @rB   Ú
printRulesr0  ¢  sG  ø€ ð €HØð 1ð 1ˆÝˆt�AŒwÔÑ Ô  HÒ,Ð,Ý˜4 œ7Ô+Ñ,Ô,¨qÑ0ˆHøðð ð ð ð ð ˜C 8¨a¡<Ñ0Ñ0€IØ�A‚~€~ÝÐO˜IÐOÐOÐOÑPÔPÐPÐPØ	�aŠˆÝÐ1˜IÐ1Ð1Ð1Ñ2Ô2Ð2å�3˜y™>œ>Ñ*Ô*ð ñ ˆ	ØˆØˆÝˆy˜Ô#Ñ$Ô$¨	Ò1Ð1Ø˜YÔ'¨Ô+ˆDØð 	'ØˆJˆJàˆJÝ"¥3 t¡9¤9Ñ-Ô-ð 'ð '�	Ø�c $ y¤/Ñ2Ô2Ñ2�
Ø ¥C¨¡I¤I°¡MÒ1Ð1Ø $Ñ&�JøØ˜Š>ˆ>Ø3<¸YÔ3GÈÈ!ÈÔ3LÑ0ˆ_˜f iØ�Y˜vÑ&Ô&ˆFÝ  Ñ1Ô1Ð]Ð]°fÐ]½cÀ)¹n¼nÐ]Ð]ÐQ[Ð]Ð]ˆKˆKØ˜!Š^ˆ^Ø(1°)Ô(<¸Q¸q¸SÔ(AÑ%ˆ_˜fØ�Y˜vÑ&Ô&ˆFÝ  Ñ1Ô1ÐJÐJ°fÐJ¸jÐJÐJˆKÝˆkÑÔÐÑð+ð rD   c                  ó   — e Zd ZdS )rp   N©rå   ræ   rç   r¹   rD   rB   rp   rp   ×  ó   € € € € € Ø€DrD   rp   c                  ó   — e Zd ZdS )ÚTestNr2  r¹   rD   rB   r5  r5  Ý  r3  rD   r5  Ú__main__)rñ   r!   rõ   )rö   r+   r*   r+   )r"   )"Ú
__future__r   r  r4   r´   ÚunittestÚmusic21r   r   r   r   r   r	   Úmusic21.figuredBassr
   r   r   r   r>   r   ré   r   rë   r;   rq   ra   r¿   r0  ÚMusic21Exceptionrp   ÚTestCaser5  rå   ÚmainTestr¹   rD   rB   ú<module>r>     s…  ðð #Ð "Ð "Ð "Ð "Ð "Ð "à Ð Ð Ð Ø €€€Ø Ð Ð Ð Ø €€€à Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø  Ð  Ð  Ð  Ð  Ð  Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø +Ð +Ð +Ð +Ð +Ð +Ø -Ð -Ð -Ð -Ð -Ð -Ø *Ð *Ð *Ð *Ð *Ð *Ø %Ð %Ð %Ð %Ð %Ð %ð €ð ˆTðIÐ ð ð ð ñ ð
`Dð `Dð `Dð `Dð `Dñ `Dô `Dð `DðF
-ð 
-ð 
-ð 
-ð 
-�gñ 
-ô 
-ð 
-ð *Ø,0Ø+/ð'ð 'ð 'ð 'ð 'ðTð ð ðð ð ðð ð ð ð 2ð 2ð 2ð 2ðj	ð 	ð 	ð 	ð 	�|Ô4ñ 	ô 	ð 	ð	ð 	ð 	ð 	ð 	ˆ8Ôñ 	ô 	ð 	ð ˆzÒÐØ€N€N€NØ€GÔ�TÑÔÐÐÐð ÐrD   