
    3j                        d Z ddlmZ ddlmZ ddlmZ ddlmZ  G d de      Z	e
dk(  rdd	lZ ej                          y	y	)
z
The FiguredBass object is a subclass of Harmony that will (eventually) be able
to represent figured bass symbols in music notation and also realize it.

BETA at this point.

Based on work by Jose Cabal-Ugaz.
    )annotations)Iterable)Harmony)notationc                       e Zd ZdZ	 ddd	 	 	 d fdZedd       Zej                  dd       Zedd       Zej                  dd       Zedd	       Z	e	j                  dd
       Z	d Z
 xZS )FiguredBassa  
    *BETA*: FiguredBass objects are currently in beta and may change without warning.

    The FiguredBass objects store information about thorough bass figures.
    It is created as a representation for <fb> tags in MEI and <figured-bass> tags in MusicXML.
    The FiguredBass object derives from the Harmony object and can be used
    in the following way:

    >>> fb = figuredBass.FiguredBass('#,6#')
    >>> fb
    <music21.figuredBass.harmony.FiguredBass #,6#>

    (note that the FiguredBass object can be found in either music21.figuredBass.FiguredBass
    or music21.figuredBass.harmony.FiguredBass.  It is the same class)

    The single figures are stored as figuredBass.notation.Figure objects:

    >>> fb.notation.figures[0]
    <music21.figuredBass.notation.Figure 3 <Modifier # sharp>>

    The figures can be accessed and manipulated individually by passing in `figureStrings`
    (plural), and extenders are allowed as with `_`:

    >>> fb2 = figuredBass.FiguredBass(figureStrings=['#_', '6#'])
    >>> fb2
    <music21.figuredBass.harmony.FiguredBass #_,6#>
    >>> fb2.notation.hasExtenders
    True

    Currently, figured bass objects do not have associated pitches.  This will change.

    >>> fb.pitches
    ()

    * New in v9.3.
     )figureStringsc                   t        |   di | d| _        |dk7  r|| _        n|rdj	                  |      | _        t        j                  | j                        | _        y )N ,r	   )super__init___figsfigureStringjoinr   Notation_figNotation)selfr   r
   keywords	__class__s       H/DATA/.local/lib/python3.12/site-packages/music21/figuredBass/harmony.pyr   zFiguredBass.__init__A   sW    
 	$8$
2 ,D # 7D/7/@/@/L    c                    | j                   S )a  
        Gets or sets the notation property of the FiguresBass object

        >>> fb = figuredBass.FiguredBass('6,#')
        >>> fb.figureString
        '6,#'
        >>> fb.notation
        <music21.figuredBass.notation.Notation 6,#>

        When setting, this updates the figureString property as well.

        >>> fb.notation = figuredBass.notation.Notation('7b,b')
        >>> fb.notation
        <music21.figuredBass.notation.Notation 7b,b>
        >>> fb.figureString
        '7b,b'
        )r   r   s    r   r   zFiguredBass.notationQ   s    &    r   c                4    || _         |j                  | _        y N)r   notationColumnr   )r   figureNotations     r   r   zFiguredBass.notationf   s    *#22
r   c                    | j                   S )a  
        Get the figures as strings of the FiguresBass object.

        >>> fb = figuredBass.FiguredBass('6,#')
        >>> fb.figureString
        '6,#'
        >>> fb.notation
        <music21.figuredBass.notation.Notation 6,#>

        When setting the figureString the notation property is updated as well:

        >>> fb.figureString = '5,b'
        >>> fb.figureString
        '5,b'
        >>> fb.notation
        <music21.figuredBass.notation.Notation 5,b>
        )r   r   s    r   r   zFiguredBass.figureStringk   s    & zzr   c                Z    || _         t        j                  | j                         | _        y r   )r   r   r   )r   r   s     r   r   zFiguredBass.figureString   s    !
 ))$**5r   c                8    | j                   j                  d      S )a  
        Does the same as figureStrings but returns a list:

        >>> fb = figuredBass.FiguredBass('6,#')
        >>> fb.figureStrings
        ['6', '#']

        Like figureString, figureStrings can be set as well and updates the notation property:

        >>> fb.figureStrings = ['5', 'b']
        >>> fb.figureStrings
        ['5', 'b']
        >>> fb.notation
        <music21.figuredBass.notation.Notation 5,b>
        r   )r   splitr   s    r   r
   zFiguredBass.figureStrings   s    "   &&s++r   c                0    dj                  |      | _        y )Nr   )r   r   )r   r
   s     r   r
   zFiguredBass.figureStrings   s    HH]3r   c                .    | j                   j                  S r   )r   r   r   s    r   _reprInternalzFiguredBass._reprInternal   s    }}+++r   )r   )r   strr
   Iterable[str])returnnotation.Notation)r   r*   )r)   r'   )r   r'   )r)   z	list[str])r
   r(   r)   None)__name__
__module____qualname____doc__r   propertyr   setterr   r
   r&   __classcell__)r   s   @r   r   r      s    #J &(M 13M"M !.M  ! !( __3 3  ( 6 6 , ,$ 4 4,r   r   __main__N)r/   
__future__r   collections.abcr   music21.harmonyr   music21.figuredBassr   r   r,   music21mainTestr	   r   r   <module>r:      sG    # $ # (A,' A,J zG r   