o
    §ƒðj.U  ã                   @  sü  d Z ddlmZ dgZddlmZ ddlmZ ddlm	Z	 ddl
mZmZmZ ddlmZmZmZ dd	lmZmZ dd
lZdd
lZG dd„ dƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZeG dd„ deƒƒZG dd„ deed�ZG dd„ deed�Z G dd„ deed�Z!G dd„ deed�Z"G dd„ deed�Z#G dd „ d eed�Z$G d!d"„ d"eed�Z%G d#d$„ d$eed�Z&G d%d&„ d&eed�Z'G d'd(„ d(eed�Z(G d)d*„ d*eed�Z)G d+d,„ d,eed�Z*G d-d.„ d.eed�Z+G d/d0„ d0eed�Z,G d1d2„ d2eed�Z-G d3d4„ d4eeed�Z.G d5d6„ d6eeed�Z/G d7d8„ d8eeed�Z0G d9d:„ d:eeed�Z1G d;d<„ d<eeed�Z2G d=d>„ d>eeed�Z3G d?d@„ d@eed�Z4G dAdB„ dBeeed�Z5G dCdD„ dDeed�Z6G dEdF„ dFeed�Z7dMdGdH„Z8dIdJ„ Z9dKdL„ Z:e ;¡  d
S )Nz>Options manager for :class:`~.Poly` and public API functions. é    )ÚannotationsÚOptions)ÚBasic)ÚExpr)Úsympify)ÚGeneratorsErrorÚOptionErrorÚ	FlagError)Únumbered_symbolsÚtopological_sortÚpublic)Úhas_dupsÚis_sequenceNc                   @  sv   e Zd ZU dZdZded< dZg Zded< g Zded< g Z	ded	< g Z
ded
< edd„ ƒZedd„ ƒZedd„ ƒZdS )ÚOptionz%Base class for all kinds of options. Nz
str | NoneÚoptionFú	list[str]ÚrequiresÚexcludesÚafterÚbeforec                 C  ó   d S ©N© ©Úclsr   r   ú™/tmp/claude-1000/-var-www-html-academy/3f42efd1-c2b7-4d08-9b05-30d86bb35479/scratchpad/piper/venv/lib/python3.10/site-packages/sympy/polys/polyoptions.pyÚdefault   ó   zOption.defaultc                 C  r   r   r   )r   r   r   r   r   Ú
preprocess#   r   zOption.preprocessc                 C  r   r   r   ©r   Úoptionsr   r   r   Úpostprocess'   r   zOption.postprocess)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Ú__annotations__Úis_Flagr   r   r   r   Úclassmethodr   r   r!   r   r   r   r   r      s   
 

r   c                   @  ó   e Zd ZdZdZdS )ÚFlagz#Base class for all kinds of flags. TN)r"   r#   r$   r%   r'   r   r   r   r   r*   ,   ó    r*   c                   @  s   e Zd ZdZedd„ ƒZdS )ÚBooleanOptionzAAn option that must have a boolean value or equivalent assigned. c                 C  s"   |dv rt |ƒS td| j|f ƒ‚)N)TFz/'%s' must have a boolean value assigned, got %s)Úboolr   r   )r   Úvaluer   r   r   r   5   s   zBooleanOption.preprocessN)r"   r#   r$   r%   r(   r   r   r   r   r   r,   2   s    r,   c                   @  s   e Zd ZdZdd„ ZdS )Ú
OptionTypez7Base type for all options that does registers options. c                   s.   t ‡ fdd„ƒ}ttˆ j|ƒ ˆ tjˆ j< d S )Nc                   s(   z| ˆ j  W S  ty   ˆ  ¡  Y S w r   )r   ÚKeyErrorr   )Úselfr   r   r   ÚgetterA   s
   ÿz#OptionType.__init__.<locals>.getter)ÚpropertyÚsetattrr   r   Ú__options__)r   ÚargsÚkwargsr2   r   r   r   Ú__init__@   s   zOptionType.__init__N)r"   r#   r$   r%   r8   r   r   r   r   r/   =   s    r/   c                      sˆ   e Zd ZU dZdZi Zded< ded< ded< dd
d„Zedd„ ƒZ	i fdd„Z
‡ fdd„Zedd„ ƒZedd„ ƒZedd„ ƒZ‡  ZS )r   aB  
    Options manager for polynomial manipulation module.

    Examples
    ========

    >>> from sympy.polys.polyoptions import Options
    >>> from sympy.polys.polyoptions import build_options

    >>> from sympy.abc import x, y, z

    >>> Options((x, y, z), {'domain': 'ZZ'})
    {'auto': False, 'domain': ZZ, 'gens': (x, y, z)}

    >>> build_options((x, y, z), {'domain': 'ZZ'})
    {'auto': False, 'domain': ZZ, 'gens': (x, y, z)}

    **Options**

    * Expand --- boolean option
    * Gens --- option
    * Wrt --- option
    * Sort --- option
    * Order --- option
    * Field --- boolean option
    * Greedy --- boolean option
    * Domain --- option
    * Split --- boolean option
    * Gaussian --- boolean option
    * Extension --- option
    * Modulus --- option
    * Symmetric --- boolean option
    * Strict --- boolean option

    **Flags**

    * Auto --- boolean flag
    * Frac --- boolean flag
    * Formal --- boolean flag
    * Polys --- boolean flag
    * Include --- boolean flag
    * All --- boolean flag
    * Gen --- flag
    * Series --- boolean flag

    Nzdict[str, type[Option]]r5   ztuple[Expr, ...]Úgenszsympy.polys.domains.DomainÚdomainFc                   s8  t  ˆ¡ |r| dd¡rtdƒ‚|rt |ƒ}||d< | di ¡}‡ ‡‡fdd„}||ƒ t |ƒD ] }|ˆv r;||= q1ˆ ¡ D ]}ˆj| }	||	jv rP||=  nq?q1||ƒ ˆ ¡ D ]1}ˆj| }	|	jD ]}
ˆ |
¡d u rutd||
f ƒ‚qd|	jD ]}ˆ |¡d urŠtd||f ƒ‚qyqZˆj	D ]
}ˆj|  
ˆ¡ q�d S )	Nr9   r   z1both '*gens' and keyword argument 'gens' suppliedÚdefaultsc              	     s€   |   ¡ D ]9\}}zˆj| }W n ty   td| ƒ‚w t|tƒr2ˆ d u s*|ˆ vr2ˆr2td| ƒ‚|d ur=| |¡ˆ|< qd S )Nú'%s' is not a valid optionú('%s' flag is not allowed in this context)Úitemsr5   r0   r   Ú
issubclassr*   r   )r6   r   r.   r   ©Úflagsr1   Ústrictr   r   Úpreprocess_options�   s   ÿ
€ôz,Options.__init__.<locals>.preprocess_optionsz.'%s' option is only allowed together with '%s'z-'%s' option is not allowed together with '%s')Údictr8   Úgetr   ÚpopÚkeysr5   r   r   Ú	__order__r!   )r1   r9   r6   rA   rB   r;   rC   Úkeyr   r   Úrequire_optionÚexclude_optionr   r@   r   r8   ƒ   sH   
ÿ

þ€

ÿ
ÿÿ
ÿzOptions.__init__c                   sœ   | j du rLg tƒ }}| j ¡ D ]#\‰ }| ˆ ¡ | ‡ fdd„|jD ƒ¡ | ‡ fdd„|jD ƒ¡ qzt|t	|ƒfƒ| _ W dS  t
yK   tdƒ‚w dS )z*Resolve the order of options' processing. Nc                 3  s   � | ]}|ˆ fV  qd S r   r   ©Ú.0Ú_name©Únamer   r   Ú	<genexpr>Ä   ó   € z3Options._init_dependencies_order.<locals>.<genexpr>c                 3  s   � | ]}ˆ |fV  qd S r   r   rL   rO   r   r   rQ   Æ   rR   z/cycle detected in sympy.polys options framework)rH   Úsetr5   r>   ÚappendÚupdater   r   r   ÚlistÚ
ValueErrorÚRuntimeError)r   ÚverticesÚedgesr   r   rO   r   Ú_init_dependencies_order»   s   

ÿÿôz Options._init_dependencies_orderc                 C  sD   t  | j¡}|  ¡ D ]\}}|||< q
| ¡ D ]\}}|||< q|S )z-Clone ``self`` and update specified options. )rD   Ú__new__Ú	__class__r>   )r1   ÚupdatesÚobjr   r.   r   r   r   ÚcloneÎ   s   

zOptions.clonec                   s(   || j v r|| |< d S tƒ  ||¡ d S r   )r5   ÚsuperÚ__setattr__)r1   Úattrr.   ©r]   r   r   rb   Ú   s   
zOptions.__setattr__c                 C  sF   i }|   ¡ D ]\}}|d ur |dkr | j| }t|tƒs |||< q|S )Nr9   )r>   r5   r?   r*   )r1   r6   r   r.   r   r   r   r   r6   à   s   

€zOptions.argsc                 C  s4   i }| j  ¡ D ]\}}t|tƒst| |ƒ||< q|S r   ©r5   r>   r?   r*   Úgetattr)r1   r    r   r   r   r   r   r    í   ó   
€zOptions.optionsc                 C  s4   i }| j  ¡ D ]\}}t|tƒrt| |ƒ||< q|S r   re   )r1   rA   r   r   r   r   r   rA   ÷   rg   zOptions.flags©NF)r"   r#   r$   r%   rH   r5   r&   r8   r(   r[   r`   rb   r3   r6   r    rA   Ú__classcell__r   r   rd   r   r   L   s"   
 /
8


	c                   @  s:   e Zd ZU dZdZg Zded< g Zded< edd„ ƒZ	dS )	ÚExpandz8``expand`` option to polynomial manipulation functions. Úexpandr   r   r   c                 C  ó   dS ©NTr   r   r   r   r   r   
  r   zExpand.defaultN)
r"   r#   r$   r%   r   r   r&   r   r(   r   r   r   r   r   rj     s   
 rj   )Ú	metaclassc                   @  óF   e Zd ZU dZdZg Zded< g Zded< edd„ ƒZ	edd	„ ƒZ
d
S )ÚGensz6``gens`` option to polynomial manipulation functions. r9   r   r   r   c                 C  rl   )Nr   r   r   r   r   r   r     r   zGens.defaultc                 C  sˆ   t |tƒr	|f}nt|ƒdkrt|d ƒr|d }|dkr#d}t|ƒS t|ƒr/tdt|ƒ ƒ‚tdd„ |D ƒƒr@tdt|ƒ ƒ‚t|ƒS )	Né   r   r   r   zduplicated generators: %sc                 s  s   � | ]}|j d u V  qdS )FN)Úis_commutative©rM   Úgenr   r   r   rQ   &  s   € z"Gens.preprocess.<locals>.<genexpr>znon-commutative generators: %s)	Ú
isinstancer   Úlenr   r   r   ÚstrÚanyÚtuple)r   r9   r   r   r   r     s   
ûzGens.preprocessN©r"   r#   r$   r%   r   r   r&   r   r(   r   r   r   r   r   r   rp     ó   
 
rp   c                   @  sD   e Zd ZU dZdZg Zded< g Zded< e 	d¡Z
edd„ ƒZd	S )
ÚWrtz5``wrt`` option to polynomial manipulation functions. Úwrtr   r   r   z\s*,\s*|\s+c                 C  sp   t |tƒr
t|ƒgS t |tƒr(| ¡ }| d¡rtdƒ‚|s g S t| j |¡ƒS t	|dƒr4tt
t|ƒƒS tdƒ‚)Nú,zBad input: missing parameter.Ú__getitem__z!invalid argument for 'wrt' option)ru   r   rw   ÚstripÚendswithr   rV   Ú	_re_splitÚsplitÚhasattrÚmap)r   r}   r   r   r   r   6  s   




zWrt.preprocessN)r"   r#   r$   r%   r   r   r&   r   ÚreÚcompiler‚   r(   r   r   r   r   r   r|   ,  s   
 
r|   c                   @  ro   )ÚSortz6``sort`` option to polynomial manipulation functions. Úsortr   r   r   c                 C  s   g S r   r   r   r   r   r   r   O  r   zSort.defaultc                 C  s>   t |tƒrdd„ | d¡D ƒS t|dƒrttt|ƒƒS tdƒ‚)Nc                 S  s   g | ]}|  ¡ ‘qS r   )r€   rs   r   r   r   Ú
<listcomp>V  s    z#Sort.preprocess.<locals>.<listcomp>ú>r   z"invalid argument for 'sort' option)ru   rw   rƒ   r„   rV   r…   r   )r   r‰   r   r   r   r   S  s
   

zSort.preprocessNrz   r   r   r   r   rˆ   G  r{   rˆ   c                   @  ro   )ÚOrderz7``order`` option to polynomial manipulation functions. Úorderr   r   r   c                 C  s
   t jjjS r   )ÚsympyÚpolysÚ	orderingsÚlexr   r   r   r   r   e  s   
zOrder.defaultc                 C  s   t jj |¡S r   )rŽ   r�   r�   Úmonomial_key)r   r�   r   r   r   r   i  s   zOrder.preprocessNrz   r   r   r   r   rŒ   ]  r{   rŒ   c                   @  ó*   e Zd ZU dZdZg Zded< g d¢ZdS )ÚFieldz7``field`` option to polynomial manipulation functions. Úfieldr   r   )r:   rƒ   ÚgaussianN©r"   r#   r$   r%   r   r   r&   r   r   r   r   r   r”   n  ó
   
 r”   c                   @  r“   )ÚGreedyz8``greedy`` option to polynomial manipulation functions. Úgreedyr   r   ©r:   rƒ   r–   Ú	extensionÚmodulusÚ	symmetricNr—   r   r   r   r   r™   w  r˜   r™   c                   @  s6   e Zd ZU dZdZedd„ ƒZg Zded< g d¢Z	dS )	Ú	Compositez;``composite`` option to polynomial manipulation functions. Ú	compositec                 C  r   r   r   r   r   r   r   r   …  r   zComposite.defaultr   r   r›   N)
r"   r#   r$   r%   r   r(   r   r   r&   r   r   r   r   r   rŸ   €  s   
 
rŸ   c                   @  s„   e Zd ZU dZdZg Zded< g d¢ZdgZe	 
d¡Ze	 
d¡Ze	 
d	¡Ze	 
d
¡Ze	 
d¡Ze	 
d¡Zedd„ ƒZedd„ ƒZdS )ÚDomainz8``domain`` option to polynomial manipulation functions. r:   r   r   )r•   rš   rƒ   r–   rœ   r9   z^(R|RR)(_(\d+))?$z^(C|CC)(_(\d+))?$z^(FF|GF)\((\d+)\)$z)^(Z|ZZ|Q|QQ|ZZ_I|QQ_I|R|RR|C|CC)\[(.+)\]$z^(Z|ZZ|Q|QQ)\((.+)\)$z^(Q|QQ)\<(.+)\>$c                 C  s²  t |tjjjƒr
|S t|dƒr| ¡ S t |tƒ�rS|dv r"tjjjS |dv r+tjjj	S |dkr4tjjj
S |dkr=tjjjS |dkrFtjjjS | j |¡}|d uri| ¡ \}}}|d u r`tjjjS tjj t|ƒ¡S | j |¡}|d urŒ| ¡ \}}}|d u rƒtjjjS tjj t|ƒ¡S | j |¡}|d ur£tjj t| ¡ d ƒ¡S | j |¡}|d u�r| ¡ \}}ttt| d¡ƒƒ}|dv rÊtjjjj|Ž S |dv rÖtjjj	j|Ž S |d	v râtjjjj|Ž S |dkrîtjjj
j|Ž S |dkrútjjjj|Ž S tjjjj|Ž S | j |¡}|d u�r2| ¡ \}}ttt| d¡ƒƒ}|dv �r*tjjjj|Ž S tjjj	j|Ž S | j  |¡}|d u�rSttt| ¡ d  d¡ƒƒ}tjjj	j!|Ž S t"d
| ƒ‚)NÚ	to_domain)ÚZÚZZ)ÚQÚQQÚZZ_IÚQQ_IÚEXrq   r~   )ÚRÚRRz-expected a valid domain specification, got %s)#ru   rŽ   r�   Údomainsr¡   r„   r¢   rw   r¤   r¦   r§   r¨   r©   Ú_re_realfieldÚmatchÚgroupsr«   Ú	RealFieldÚintÚ_re_complexfieldÚCCÚComplexFieldÚ_re_finitefieldÚFFÚ_re_polynomialrV   r…   r   rƒ   Ú	poly_ringÚ_re_fractionÚ
frac_fieldÚ_re_algebraicÚalgebraic_fieldr   )r   r:   ÚrÚ_ÚprecÚgroundr9   r   r   r   r   ž  sr   











zDomain.preprocessc                 C  sz   d|v rd|v r|d j rt|d jƒt|d ƒ@ rtdƒ‚d|vs&|d s9d|v r7|d tjjjkr;tdƒ‚d S d S d S )Nr9   r:   z/ground domain and generators interfere togetherz>you have to provide generators because EX domain was requested)Úis_CompositerS   Úsymbolsr   rŽ   r�   r¬   r©   r   r   r   r   r!   õ  s   ÿÿÿÿzDomain.postprocessN)r"   r#   r$   r%   r   r   r&   r   r   r†   r‡   r­   r²   rµ   r·   r¹   r»   r(   r   r!   r   r   r   r   r¡   �  s    
 






Vr¡   c                   @  ó6   e Zd ZU dZdZg Zded< g d¢Zedd„ ƒZ	dS )	ÚSplitz7``split`` option to polynomial manipulation functions. rƒ   r   r   )r•   rš   r:   r–   rœ   r�   rž   c                 C  s   d|v rt dƒ‚d S )Nrƒ   z%'split' option is not implemented yet)ÚNotImplementedErrorr   r   r   r   r!   	  s   ÿzSplit.postprocessN©
r"   r#   r$   r%   r   r   r&   r   r(   r!   r   r   r   r   rÄ      ó   
 rÄ   c                   @  rÃ   )	ÚGaussianz:``gaussian`` option to polynomial manipulation functions. r–   r   r   )r•   rš   r:   rƒ   rœ   r�   rž   c                 C  s8   d|v r|d du rt jjj|d< t |¡ d S d S d S )Nr–   Tr:   )rŽ   r�   r¬   r¨   Ú	Extensionr!   r   r   r   r   r!     s   þzGaussian.postprocessNrÆ   r   r   r   r   rÈ     rÇ   rÈ   c                   @  óB   e Zd ZU dZdZg Zded< g d¢Zedd„ ƒZ	edd	„ ƒZ
d
S )rÉ   z;``extension`` option to polynomial manipulation functions. rœ   r   r   )rš   r:   rƒ   r–   r�   rž   c                 C  sL   |dkrt |ƒS |dkrtdƒ‚t|dƒs|h}|S |s d }|S t|ƒ}|S )Nrq   r   z.'False' is an invalid argument for 'extension'Ú__iter__)r-   r   r„   rS   )r   rœ   r   r   r   r   (  s   
ûþzExtension.preprocessc                 C  s8   d|v r|d durt jjjj|d Ž |d< d S d S d S )Nrœ   Tr:   )rŽ   r�   r¬   r¦   r¼   r   r   r   r   r!   9  s
   
ÿÿzExtension.postprocessN©r"   r#   r$   r%   r   r   r&   r   r(   r   r!   r   r   r   r   rÉ     s   
 
rÉ   c                   @  rÊ   )ÚModulusz9``modulus`` option to polynomial manipulation functions. r�   r   r   )rš   rƒ   r:   r–   rœ   c                 C  s*   t |ƒ}|jr|dkrt|ƒS td| ƒ‚)Nr   z)'modulus' must a positive integer, got %s)r   Ú
is_Integerr±   r   )r   r�   r   r   r   r   H  s   ÿzModulus.preprocessc                 C  s8   d|v r|d }|  dd¡}tjj ||¡|d< d S d S )Nr�   rž   Tr:   )rE   rŽ   r�   r¬   r¶   )r   r    r�   rž   r   r   r   r!   R  s
   ýzModulus.postprocessNrÌ   r   r   r   r   rÍ   @  s   
 
	rÍ   c                   @  s"   e Zd ZdZdZdgZg d¢ZdS )Ú	Symmetricz;``symmetric`` option to polynomial manipulation functions. rž   r�   )rš   r:   rƒ   r–   rœ   N)r"   r#   r$   r%   r   r   r   r   r   r   r   rÏ   Z  s
    rÏ   c                   @  ó    e Zd ZdZdZedd„ ƒZdS )ÚStrictz8``strict`` option to polynomial manipulation functions. rB   c                 C  rl   rm   r   r   r   r   r   r   h  r   zStrict.defaultN©r"   r#   r$   r%   r   r(   r   r   r   r   r   rÑ   c  ó
    rÑ   c                   @  s4   e Zd ZdZdZg d¢Zedd„ ƒZedd„ ƒZdS )	ÚAutoz4``auto`` flag to polynomial manipulation functions. Úauto)r•   r:   rœ   r–   c                 C  rl   rm   r   r   r   r   r   r   t  r   zAuto.defaultc                 C  s,   d|v sd|v rd|vrd|d< d S d S d S )Nr:   r•   rÕ   Fr   r   r   r   r   r!   x  s   ÿzAuto.postprocessN)	r"   r#   r$   r%   r   r   r(   r   r!   r   r   r   r   rÔ   m  s    
rÔ   c                   @  rÐ   )ÚFracz6``auto`` option to polynomial manipulation functions. Úfracc                 C  rl   rh   r   r   r   r   r   r   ƒ  r   zFrac.defaultNrÒ   r   r   r   r   rÖ   ~  rÓ   rÖ   c                   @  rÐ   )ÚFormalz6``formal`` flag to polynomial manipulation functions. Úformalc                 C  rl   rh   r   r   r   r   r   r   �  r   zFormal.defaultNrÒ   r   r   r   r   rØ   ˆ  rÓ   rØ   c                   @  r)   )ÚPolysz5``polys`` flag to polynomial manipulation functions. r�   N)r"   r#   r$   r%   r   r   r   r   r   rÚ   ’  r+   rÚ   c                   @  rÐ   )ÚIncludez7``include`` flag to polynomial manipulation functions. Úincludec                 C  rl   rh   r   r   r   r   r   r   �  r   zInclude.defaultNrÒ   r   r   r   r   rÛ   ˜  rÓ   rÛ   c                   @  rÐ   )ÚAllz3``all`` flag to polynomial manipulation functions. Úallc                 C  rl   rh   r   r   r   r   r   r   §  r   zAll.defaultNrÒ   r   r   r   r   rÝ   ¢  rÓ   rÝ   c                   @  ó,   e Zd ZdZdZedd„ ƒZedd„ ƒZdS )ÚGenz3``gen`` flag to polynomial manipulation functions. rt   c                 C  rl   )Nr   r   r   r   r   r   r   ±  r   zGen.defaultc                 C  s   t |ttfƒr	|S tdƒ‚)Nz!invalid argument for 'gen' option)ru   r   r±   r   )r   rt   r   r   r   r   µ  s   zGen.preprocessN©r"   r#   r$   r%   r   r(   r   r   r   r   r   r   rà   ¬  ó    
rà   c                   @  rÐ   )ÚSeriesz6``series`` flag to polynomial manipulation functions. Úseriesc                 C  rl   rh   r   r   r   r   r   r   Â  r   zSeries.defaultNrÒ   r   r   r   r   rã   ½  rÓ   rã   c                   @  rß   )ÚSymbolsz7``symbols`` flag to polynomial manipulation functions. rÂ   c                 C  s   t ddd�S )NÚsrq   )Ústart)r
   r   r   r   r   r   Ì  s   zSymbols.defaultc                 C  s   t |dƒr	t|ƒS td| ƒ‚)NrË   z2expected an iterator or iterable container, got %s)r„   Úiterr   )r   rÂ   r   r   r   r   Ð  ó   
zSymbols.preprocessNrá   r   r   r   r   rå   Ç  râ   rå   c                   @  rÐ   )ÚMethodz6``method`` flag to polynomial manipulation functions. Úmethodc                 C  s   t |tƒr	| ¡ S td| ƒ‚)Nzexpected a string, got %s)ru   rw   Úlowerr   )r   rë   r   r   r   r   Ý  ré   zMethod.preprocessN)r"   r#   r$   r%   r   r(   r   r   r   r   r   rê   Ø  rÓ   rê   c                 C  s<   |du r	d| } }t |ƒdksd|vs| rt| |ƒS |d S )z9Construct options from keyword arguments or ... options. Nr   rq   Úopt)rv   r   )r9   r6   r   r   r   Úbuild_optionså  s
   

rî   c              	   C  sX   t |ƒ}|  ¡ D ]!}ztj| jr||vrtd| ƒ‚W q ty)   td| ƒ‚w dS )aÎ  
    Allow specified flags to be used in the given context.

    Examples
    ========

    >>> from sympy.polys.polyoptions import allowed_flags
    >>> from sympy.polys.domains import ZZ

    >>> allowed_flags({'domain': ZZ}, [])

    >>> allowed_flags({'domain': ZZ, 'frac': True}, [])
    Traceback (most recent call last):
    ...
    FlagError: 'frac' flag is not allowed in this context

    >>> allowed_flags({'domain': ZZ, 'frac': True}, ['frac'])

    r=   r<   N)rS   rG   r   r5   r'   r	   r0   r   )r6   rA   Úargr   r   r   Úallowed_flagsð  s   ÿ€ÿûrð   c                 K  s   d| vrt | ƒ} || d< | S )z$Update options with default values. r;   )rD   )r    r;   r   r   r   Úset_defaults  s   rñ   r   )<r%   Ú
__future__r   Ú__all__Úsympy.core.basicr   Úsympy.core.exprr   Úsympy.core.sympifyr   Úsympy.polys.polyerrorsr   r   r	   Úsympy.utilitiesr
   r   r   Úsympy.utilities.iterablesr   r   Úsympy.polysrŽ   r†   r   r*   r,   Útyper/   rD   r   rj   rp   r|   rˆ   rŒ   r”   r™   rŸ   r¡   rÄ   rÈ   rÉ   rÍ   rÏ   rÑ   rÔ   rÖ   rØ   rÚ   rÛ   rÝ   rà   rã   rå   rê   rî   rð   rñ   r[   r   r   r   r   Ú<module>   s^     6		s!	






