§
    °³Ùg„%  ã                   ó¢   — d dl mZmZ ddlmZmZmZmZ ddlZ	ddl
Z
ddlZ e	j        d¦  «        Zd„ Zd„ Z G d„ d	¦  «        Zeeeffd
„Zd„ ZdS )é   )ÚSymbolÚBasicé    )ÚcombinationsÚpermutationsÚproductr   Nz"([0-9]*:[0-9]+|[a-zA-Z]?:[a-zA-Z])c           	      óê	  ‡‡‡‡— g }t          | t          ¦  «        �r›d}g d¢Št          t          ‰¦  «        ¦  «        D ]‹}‰                     d¦  «        }|| v rpt          |¦  «        | v r|dz  }t          |¦  «        | v °t          |¦  «        }|dz  }|                      ||¦  «        } ‰                     ||dd…         f¦  «         ŒŒˆfd„Š|                      ¦   «         } |  	                    d¦  «        }|r| dd…          
                    ¦   «         } | st          d¦  «        ‚d	„ |                      d¦  «        D ¦   «         } t          d
„ | D ¦   «         ¦  «        st          d¦  «        ‚t          t          | ¦  «        dz
  dd¦  «        D ]$}| |                              ¦   «         | ||dz   …<   Œ%‰                     dt          ¦  «        Š‰                     d|¦  «        }| D �]ž}	|	st          d¦  «        ‚d|	vr( ‰ ‰|	¦  «        fi ‰¤Ž}
|                     |
¦  «         Œ@t                               |	¦  «        }t          t          |¦  «        dz
  ¦  «        D ]ˆ}|r„d||         v rz||         dk    rn||dz
            	                    d¦  «        rP||dz                                 d¦  «        r2||dz
           dd…         ||dz
  <   ||dz            dd…         ||dz   <   Œ‰t#          |¦  «        D �]\  }}d|v �r |d          	                    d¦  «        rt          d¦  «        ‚|                     d¦  «        \  }}|d         t$          j        v r@|sdnt)          |¦  «        }t)          |¦  «        }d„ t          ||¦  «        D ¦   «         ||<   n^|pd}d„ t          t$          j                             |¦  «        t$          j                             |¦  «        dz   ¦  «        D ¦   «         ||<   ||         s n„�Œ|g||<   �Œd}t          |¦  «        dk    r	|d         } nd„ t/          |Ž D ¦   «         } ‰r%|                     ˆˆˆfd„| D ¦   «         ¦  «         �Œ||                     ˆˆfd„| D ¦   «         ¦  «         �Œ |st          |¦  «        dk    r|sdS |d         S t3          |¦  «        S | D ]"}	|                     t5          |	fi ‰¤Ž¦  «         Œ# t7          | ¦  «        |¦  «        S )aÁ  
    Transform strings into instances of :class:`Symbol` class.
    :func:`symbols` function returns a sequence of symbols with names taken
    from ``names`` argument, which can be a comma or whitespace delimited
    string, or a sequence of strings::
        >>> from symengine import symbols
        >>> x, y, z = symbols('x,y,z')
        >>> a, b, c = symbols('a b c')
    The type of output is dependent on the properties of input arguments::
        >>> symbols('x')
        x
        >>> symbols('x,')
        (x,)
        >>> symbols('x,y')
        (x, y)
        >>> symbols(('a', 'b', 'c'))
        (a, b, c)
        >>> symbols(['a', 'b', 'c'])
        [a, b, c]
        >>> symbols(set(['a', 'b', 'c']))
        set([a, b, c])
    If an iterable container is needed for a single symbol, set the ``seq``
    argument to ``True`` or terminate the symbol name with a comma::
        >>> symbols('x', seq=True)
        (x,)
    To reduce typing, range syntax is supported to create indexed symbols.
    Ranges are indicated by a colon and the type of range is determined by
    the character to the right of the colon. If the character is a digit
    then all contiguous digits to the left are taken as the nonnegative
    starting value (or 0 if there is no digit left of the colon) and all
    contiguous digits to the right are taken as 1 greater than the ending
    value::
        >>> symbols('x:10')
        (x0, x1, x2, x3, x4, x5, x6, x7, x8, x9)
        >>> symbols('x5:10')
        (x5, x6, x7, x8, x9)
        >>> symbols('x5(:2)')
        (x50, x51)
        >>> symbols('x5:10,y:5')
        (x5, x6, x7, x8, x9, y0, y1, y2, y3, y4)
        >>> symbols(('x5:10', 'y:5'))
        ((x5, x6, x7, x8, x9), (y0, y1, y2, y3, y4))
    If the character to the right of the colon is a letter, then the single
    letter to the left (or 'a' if there is none) is taken as the start
    and all characters in the lexicographic range *through* the letter to
    the right are used as the range::
        >>> symbols('x:z')
        (x, y, z)
        >>> symbols('x:c')  # null range
        ()
        >>> symbols('x(:c)')
        (xa, xb, xc)
        >>> symbols(':c')
        (a, b, c)
        >>> symbols('a:d, x:z')
        (a, b, c, d, x, y, z)
        >>> symbols(('a:d', 'x:z'))
        ((a, b, c, d), (x, y, z))
    Multiple ranges are supported; contiguous numerical ranges should be
    separated by parentheses to disambiguate the ending number of one
    range from the starting number of the next::
        >>> symbols('x:2(1:3)')
        (x01, x02, x11, x12)
        >>> symbols(':3:2')  # parsing is from left to right
        (00, 01, 10, 11, 20, 21)
    Only one pair of parentheses surrounding ranges are removed, so to
    include parentheses around ranges, double them. And to include spaces,
    commas, or colons, escape them with a backslash::
        >>> symbols('x((a:b))')
        (x(a), x(b))
        >>> symbols('x(:1\,:2)')  # or 'x((:1)\,(:2))'
        (x(0,0), x(0,1))
    r   )z\,z\:z\ r   Nc                 óH   •— ‰r‰D ]\  }}|                       ||¦  «        } Œ| S ©N)Úreplace)ÚsÚcÚlÚliteralss      €úI/granary/edev/quantum/lib/python3.11/site-packages/symengine/utilities.pyÚliteralzsymbols.<locals>.literald   s6   ø€ Øð (Ø$ð (ð (‘D�A�qØŸ	š	 ! Q™œ�A�AØˆHó    ú,éÿÿÿÿzno symbols givenc                 ó6   — g | ]}|                      ¦   «         ‘ŒS © )Ústrip©Ú.0Úns     r   ú
<listcomp>zsymbols.<locals>.<listcomp>r   s    € Ð5Ð5Ð5˜q�—’‘”Ð5Ð5Ð5r   c              3   ó   K  — | ]}|V — Œd S r   r   r   s     r   ú	<genexpr>zsymbols.<locals>.<genexpr>s   s"   è è € Ð$Ð$˜�1Ð$Ð$Ð$Ð$Ð$Ð$r   zmissing symbol between commasÚclsÚseqzmissing symbolú:ú(ú)zmissing end rangec                 ó,   — g | ]}t          |¦  «        ‘ŒS r   )Ústr©r   r   s     r   r   zsymbols.<locals>.<listcomp>•   s   € Ð#@Ð#@Ð#@¨q¥C¨¡F¤FÐ#@Ð#@Ð#@r   Úac                 ó2   — g | ]}t           j        |         ‘ŒS r   )ÚstringÚascii_lettersr&   s     r   r   zsymbols.<locals>.<listcomp>˜   s2   € ð $@ð $@ð $@À¥FÔ$8¸Ô$;ð $@ð $@ð $@r   Tc                 ó8   — g | ]}d                       |¦  «        ‘ŒS )Ú )Újoin)r   r   s     r   r   zsymbols.<locals>.<listcomp>¤   s"   € Ð@Ð@Ð@¨A˜RŸWšW Q™ZœZÐ@Ð@Ð@r   c                 ó4   •— g | ]} ‰ ‰|¦  «        fi ‰¤Ž‘ŒS r   r   )r   r   Úargsr   r   s     €€€r   r   zsymbols.<locals>.<listcomp>¦   s3   ø€ Ð"JÐ"JÐ"J¸q 3 3 w w¨q¡z¤zÐ#:Ð#:°TÐ#:Ð#:Ð"JÐ"JÐ"Jr   c                 ó"   •— g | ]} ‰|fi ‰¤Ž‘ŒS r   r   )r   r   r/   r   s     €€r   r   zsymbols.<locals>.<listcomp>¨   s'   ø€ Ð"AÐ"AÐ"A°a 3 3 q > >¨D > >Ð"AÐ"AÐ"Ar   r   )Ú
isinstancer%   ÚrangeÚlenÚpopÚchrr   Úappendr   ÚendswithÚrstripÚ
ValueErrorÚsplitÚallr   Ú_rangeÚ
startswithÚ	enumerater)   ÚdigitsÚintr*   ÚindexÚcartesÚextendÚtupleÚsymbolsÚtype)Únamesr/   ÚresultÚmarkerÚiÚlitÚlit_charÚas_seqr    ÚnameÚsymbolr:   r   r'   Úbr   r   r   s    `             @@@r   rE   rE      s—  øøøø€ ðT €Få�%�ÑÔñ ]#ØˆØ(Ð(Ð(ˆÝ•s˜8‘}”}Ñ%Ô%ð 	5ð 	5ˆAØ—,’,˜q‘/”/ˆCØ�eˆ|ˆ|Ý˜&‘k”k UÐ*Ð*Ø˜a‘K�Fõ ˜&‘k”k UÐ*Ð*å˜v™;œ;�Ø˜!‘�ØŸš c¨8Ñ4Ô4�Ø—’ ¨3¨q¨r¨r¬7Ð 3Ñ4Ô4Ð4øð	ð 	ð 	ð 	ð 	ð —’‘”ˆØ—’ Ñ$Ô$ˆØð 	(Ø˜#˜2˜#”J×%Ò%Ñ'Ô'ˆEØð 	1ÝÐ/Ñ0Ô0Ð0ð 6Ð5 E§K¢K°Ñ$4Ô$4Ð5Ñ5Ô5ˆÝÐ$Ð$˜eÐ$Ñ$Ô$Ñ$Ô$ð 	>ÝÐ<Ñ=Ô=Ð=å•s˜5‘z”z A‘~ r¨2Ñ.Ô.ð 	/ð 	/ˆAØ# AœhŸnšnÑ.Ô.ˆE�!�Q˜‘U�(‰OˆOà�hŠh�u�fÑ%Ô%ˆØ�hŠh�u˜fÑ%Ô%ˆàð ,	Cñ ,	CˆDØð 3Ý Ð!1Ñ2Ô2Ð2à˜$ˆˆØ˜˜W˜W T™]œ]Ð3Ð3¨dÐ3Ð3�Ø—’˜fÑ%Ô%Ð%Øå—L’L Ñ&Ô&ˆEå�3˜u™:œ:¨™>Ñ*Ô*ð 4ð 4�Øð 4˜  a¤˜˜¨U°1¬X¸ª_¨_Ø˜a !™eœ×-Ò-¨cÑ2Ô2ð .=à˜a !™eœ×/Ò/°Ñ4Ô4ð .=ð $)¨¨Q©¤<°°°Ô#4�E˜!˜a™%‘LØ#(¨¨Q©¤<°°°Ô#3�E˜!˜a™%‘LøÝ! %Ñ(Ô(ð Cñ C‘��1Ø˜!�8‘8Ø˜”u—~’~ cÑ*Ô*ð >Ý(Ð)<Ñ=Ô=Ð=ØŸ7š7 3™<œ<‘D�A�qØ˜”u¥¤Ð-Ð-Ø%&Ð2˜A˜A­C°©F¬F˜Ý ™FœF˜Ø#@Ð#@µE¸!¸Q±K´KÐ#@Ñ#@Ô#@˜˜a™˜à˜H ˜ð$@ð $@ÅUÝ"Ô0×6Ò6°qÑ9Ô9Ý"Ô0×6Ò6°qÑ9Ô9¸AÑ=ñF?ô F?ð $@ñ $@ô $@˜˜a™ð ! œ8ð Ø˜ñð !"˜s�E˜!‘H‘Hà�Ý�u‘:”: ’?�?Ø! !œH�E�Eà@Ð@µ¸°Ð@Ñ@Ô@�EØð CØ—M’MÐ"JÐ"JÐ"JÐ"JÐ"JÐ"JÀEÐ"JÑ"JÔ"JÑKÔKÐKÑKà—M’MÐ"AÐ"AÐ"AÐ"AÐ"A¸5Ð"AÑ"AÔ"AÑBÔBÐBùàð 	•s˜6‘{”{ aÒ'Ð'Øð Ø�rØ˜!”9Ðå�V‰}Œ}Ðàð 	1ð 	1ˆDØ�MŠM�' $Ð/Ð/¨$Ð/Ð/Ñ0Ô0Ð0Ð0à�t�E‰{Œ{˜6Ñ"Ô"Ð"r   c                 óè   ‡— ˆfd„Šddl m}  |¦   «         j        }	 t          | fi |¤Ž}|�>t	          |t
          ¦  «        r||j        |                     ¦   «         <   n ‰||¦  «         ~n# ~w xY w|S )aä  
    Create symbols and inject them into the global namespace.

    INPUT:
-            s -- a string, either a single variable name, or
-                 a space separated list of variable names, or
-                 a list of variable names.

    This calls :func:`symbols` with the same arguments and puts the results
    into the *global* namespace. It's recommended not to use :func:`var` in
    library code, where :func:`symbols` has to be used::

    Examples
    ========

    >>> from symengine import var

    >>> var('x')
    x
    >>> x
    x

    >>> var('a,ab,abc')
    (a, ab, abc)
    >>> abc
    abc

    See :func:`symbols` documentation for more details on what kinds of
    arguments can be passed to :func:`var`.

    c                 óŽ   •— | D ]@}t          |t          ¦  «        r||j        |                     ¦   «         <   Œ4 ‰||¦  «         ŒAdS )z4Recursively inject symbols to the global namespace. N)r1   r   Ú	f_globalsÚ__str__)rE   ÚframerO   Útraverses      €r   rV   zvar.<locals>.traverse×   s^   ø€ àð 	(ð 	(ˆFÝ˜&¥%Ñ(Ô(ð (Ø4:�” §¢Ñ 0Ô 0Ñ1Ð1ð �˜ Ñ'Ô'Ð'Ð'ð	(ð 	(r   r   )Úcurrentframe)ÚinspectrW   Úf_backrE   r1   r   rS   rT   )rG   r/   rW   rU   ÚsymsrV   s        @r   Úvarr[   ·   s±   ø€ ð@(ð (ð (ð (ð (ð %Ð$Ð$Ð$Ð$Ð$ØˆL‰NŒNÔ!€EðÝ�uÐ%Ð% Ð%Ð%ˆàÐÝ˜$¥Ñ&Ô&ð &Ø26�” §¢¡¤Ñ/Ð/ð �˜˜uÑ%Ô%Ð%àˆEøˆEˆ	ˆ	ˆ	ˆ	à€Ks   �AA, Á,A/c                   ó   — e Zd ZdZdS )ÚNotIterablezÌ
    Use this as mixin when creating a class which is not supposed to return
    true when iterable() is called on its instances. I.e. avoid infinite loop
    when calling e.g. list() on the instance
    N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r]   r]   ô   s   € € € € € ðð ð
 	€Dr   r]   c                 óp   — 	 t          | ¦  «         n# t          $ r Y dS w xY w|rt          | |¦  «         S dS )a½  
    Return a boolean indicating whether ``i`` is SymPy iterable.
    True also indicates that the iterator is finite, i.e. you e.g.
    call list(...) on the instance.

    When SymPy is working with iterables, it is almost always assuming
    that the iterable is not a string or a mapping, so those are excluded
    by default. If you want a pure Python definition, make exclude=None. To
    exclude multiple items, pass them as a tuple.
    FT)ÚiterÚ	TypeErrorr1   )rJ   Úexcludes     r   Úiterablerf   ý   sV   € ðÝˆQ‰ŒˆˆøÝð ð ð Øˆuˆuðøøøàð *Ý˜a Ñ)Ô)Ð)Ð)Øˆ4s   ‚ ’
 Ÿ c                 ó@   — t          | d¦  «        ot          | ¦  «        S )a  
    Return a boolean indicating whether ``i`` is a sequence in the SymPy
    sense. If anything that fails the test below should be included as
    being a sequence for your application, set 'include' to that object's
    type; multiple types should be passed as a tuple of types.
    Ú__getitem__)Úhasattrrf   )rJ   s    r   Úis_sequencerj     s   € õ �1�mÑ$Ô$Ð4­°!©¬Ð4r   )Úlib.symengine_wrapperr   r   Ú	itertoolsr   r   r   rB   ÚreÚ_rer)   ÚsysÚcompiler<   rE   r[   r]   r%   Údictrf   rj   r   r   r   ú<module>rr      s÷   ðØ 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0Ø LÐ LÐ LÐ LÐ LÐ LÐ LÐ LÐ LÐ LÐ LÐ LØ Ð Ð Ð Ø €€€Ø 
€
€
€
ð 
ˆŒÐ9Ñ	:Ô	:€ði#ð i#ð i#ðX:ð :ð :ðz	ð 	ð 	ð 	ð 	ñ 	ô 	ð 	ð ˜d KÐ0ð ð ð ð ð(5ð 5ð 5ð 5ð 5r   