
    wg
                     n    d Z ddlZddlmZ ddlmZ  ej                  dej                        Zd Z	d Z
y)z5
A few practical conventions common to all printers.
    N)Iterable)
Derivativez^([^\W\d_]+)(\d+)$c                    | s| g g fS d}d}g }g }|t        |       k  r|dz   }| ||dz    dk(  r|dz  }| j                  d|      }|dk  rt        |       }| j                  d|      }|dk  rt        |       }t        ||      }| || }	|}||	}n}|	j                  d      r|j	                  |	dd        nW|	j                  d      r|j	                  |	dd        n1|	j                  d      r|j	                  |	dd        nt        d      |t        |       k  rt        j                  |      }
|
r%|
j                         \  }}|j                  d|       |||fS )	a|  Split a symbol name into a name, superscripts and subscripts

    The first part of the symbol name is considered to be its actual
    'name', followed by super- and subscripts. Each superscript is
    preceded with a "^" character or by "__". Each subscript is preceded
    by a "_" character.  The three return values are the actual name, a
    list with superscripts and a list with subscripts.

    Examples
    ========

    >>> from sympy.printing.conventions import split_super_sub
    >>> split_super_sub('a_x^1')
    ('a', ['1'], ['x'])
    >>> split_super_sub('var_sub1__sup_sub2')
    ('var', ['sup'], ['sub1', 'sub2'])

    r   N      __^_zThis should never happen.)
lenfindmin
startswithappendRuntimeError_name_with_digits_pmatchgroupsinsert)textposnamesuperssubsstartpos_hatpos_uscpos_nextpartmsubs               _/home/mcse/projects/flask/flask-venv/lib/python3.12/site-packages/sympy/printing/conventions.pysplit_super_subr"      sp   & R|
CDFD
D	/aC!G$QJE))C'Q;$iG))C'Q;$iGw(C!<D__S!MM$qr(#__T"MM$qr(#__S!KKQR!:;;- D	/4 	!!$'AHHJ	cAs    c                     t        | t              rt        | j                        S t        | j                  t
              s!t        t        | j                              dkD  S t        d | j                  D              dkD  S )aA  Return whether a partial derivative symbol is required for printing

    This requires checking how many free variables there are,
    filtering out the ones that are integers. Some expressions do not have
    free variables. In that case, check its variable list explicitly to
    get the context of the expression.
    r   c              3   6   K   | ]  }|j                      y w)N)
is_integer).0ss     r!   	<genexpr>z#requires_partial.<locals>.<genexpr>X   s     ;A1<<;s   )

isinstancer   requires_partialexprfree_symbolsr   r   set	variablessum)r,   s    r!   r+   r+   I   sb     $
#		**d''23t~~&'!++;):):;;a??r#   )__doc__recollections.abcr   sympy.core.functionr   compileUr   r"   r+    r#   r!   <module>r8      s9    
 $ * bjj!6= 9x@r#   