
    wgT                       d Z ddlmZ dgZddlmZ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
      Z G d de      Z G d de      Z G d de      Ze G d de             Z G d dee      Z G d dee      Z G d dee      Z G d dee      Z G d dee      Z  G d dee      Z! G d d ee      Z" G d! d"ee      Z# G d# d$ee      Z$ G d% d&ee      Z% G d' d(ee      Z& G d) d*ee      Z' G d+ d,ee      Z( G d- d.ee      Z) G d/ d0ee      Z* G d1 d2eee      Z+ G d3 d4eee      Z, G d5 d6eee      Z- G d7 d8eee      Z. G d9 d:eee      Z/ G d; d<eee      Z0 G d= d>ee      Z1 G d? d@eee      Z2 G dA dBee      Z3 G dC dDee      Z4dHdEZ5dF Z6dG Z7ejq                          y)Iz>Options manager for :class:`~.Poly` and public API functions.     )annotationsOptions)Basicsympify)GeneratorsErrorOptionError	FlagError)numbered_symbolstopological_sortpublic)has_dupsis_sequenceNc                      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        Zed        Zed        Zy)Optionz%Base class for all kinds of options. Nz
str | NoneoptionF	list[str]requiresexcludesafterbeforec                     y N clss    \/home/mcse/projects/flask/flask-venv/lib/python3.12/site-packages/sympy/polys/polyoptions.pydefaultzOption.default           c                     y r   r   )r   r   s     r   
preprocesszOption.preprocess!   r   r   c                     y r   r   r   optionss     r   postprocesszOption.postprocess%   s    r   )__name__
__module____qualname____doc__r   __annotations__is_Flagr   r   r   r   classmethodr   r!   r%   r   r   r   r   r      sv    /FJGHiHiE9FI     r   r   c                      e Zd ZdZdZy)Flagz#Base class for all kinds of flags. TN)r&   r'   r(   r)   r+   r   r   r   r.   r.   *   s
    -Gr   r.   c                       e Zd ZdZed        Zy)BooleanOptionzAAn option that must have a boolean value or equivalent assigned. c                V    |dv rt        |      S t        d| j                  d|      )N)TF'z*' must have a boolean value assigned, got )boolr   r   )r   values     r   r!   zBooleanOption.preprocess3   s,    M!;SVS]S]_deffr   N)r&   r'   r(   r)   r,   r!   r   r   r   r0   r0   0   s    Kg gr   r0   c                      e Zd ZdZd Zy)
OptionTypez7Base type for all options that does registers options. c                     t          fd       }t        t         j                  |        t        j                   j                  <   y )Nc                b    	 | j                      S # t        $ r j                         cY S w xY wr   )r   KeyErrorr   )selfr   s    r   getterz#OptionType.__init__.<locals>.getter?   s2    %CJJ'' %{{}$%s    ..)propertysetattrr   r   __options__)r   argskwargsr;   s   `   r   __init__zOptionType.__init__>   s;    		% 
	% 	V,*-CJJ'r   N)r&   r'   r(   r)   rA   r   r   r   r6   r6   ;   s
    A	.r   r6   c                       e Zd ZU dZdZi Zded<   ddZed        Z	i fdZ
 fdZed	        Zed
        Zed        Z x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]]r>   c           	         t         j                          |r|j                  dd      rt        d      |rt        |      }||d<   |j	                  di       } fd} ||       t        |      D ]A  }| v r||=  j                         D ]$  } j                  |   }	||	j                  v s!||=  A C  ||        j                         D ]y  } j                  |   }	|	j                  D ]%  }
 j                  |
      t        d|d|
d       |	j                  D ]%  } j                  |      t        d|d|d       {  j                  D ]   } j                  |   j                          " y )	Ngensr   z1both '*gens' and keyword argument 'gens' supplieddefaultsc                   | j                         D ]R  \  }}	 j                  |   }t	        |t
              r|vrrt        d|z        |?|j                  |      |<   T y # t        $ r t        d|z        w xY w)N'%s' is not a valid option('%s' flag is not allowed in this context)itemsr>   r9   r   
issubclassr.   r!   )r?   r   r4   r   flagsr:   stricts       r   preprocess_optionsz,Options.__init__.<locals>.preprocess_options   s    !% 9M**62C c4(}e(;!"-.X[a.a"bb$#&>>%#8DL9   M%&BV&KLLMs   A((B r2   z(' option is only allowed together with 'z'' option is not allowed together with ')dictrA   getr   popkeysr>   r   r   	__order__r%   )r:   rD   r?   rK   rL   rE   rM   keyr   r   require_optionexclude_options   `  ``       r   rA   zOptions.__init__~   s   dDHHVR(CE E:DDL88J+	9 	4 > 		Cd{SM"iik F**62Ccll*$SM			 	8$iik 		rF""6*C"%,, s88N+3%Z`bp&qrrs #&,, r88N+7%Y_ao&pqqr		r nn 	7FV$006	7r   c                   | j                   g t               }}| j                  j                         D ]^  \  }|j	                         |j                  fd|j                  D               |j                  fd|j                  D               ` 	 t        |t        |      f      | _         yy# t        $ r t        d      w xY w)z*Resolve the order of options' processing. Nc              3  &   K   | ]  }|f 
 y wr   r   .0_namenames     r   	<genexpr>z3Options._init_dependencies_order.<locals>.<genexpr>   s     EueT]E   c              3  &   K   | ]  }|f 
 y wr   r   rX   s     r   r\   z3Options._init_dependencies_order.<locals>.<genexpr>   s     FudE]Fr]   z/cycle detected in sympy.polys options framework)rR   setr>   rI   appendupdater   r   r   list
ValueErrorRuntimeError)r   verticesedgesr   r[   s       @r   _init_dependencies_orderz Options._init_dependencies_order   s     ==  #%eH # 5 5 7 Gf%EEEFFFGG 0(DK1H I !  G"EG GGs   B3 3Cc                    t         j                  | j                        }| j                         D ]
  \  }}|||<    |j                         D ]
  \  }}|||<    |S )z-Clone ``self`` and update specified options. )rN   __new__	__class__rI   )r:   updatesobjr   r4   s        r   clonezOptions.clone   sa    ll4>>*!ZZ\ 	 MFECK	  %]]_ 	 MFECK	  
r   c                N    || j                   v r|| |<   y t        | 	  ||       y r   )r>   super__setattr__)r:   attrr4   rj   s      r   rp   zOptions.__setattr__   s)    4###DJGe,r   c                    i }| j                         D ]3  \  }}|	|dk7  s| j                  |   }t        |t              r/|||<   5 |S )NrD   )rI   r>   rJ   r.   )r:   r?   r   r4   r   s        r   r?   zOptions.args   sW    !ZZ\ 	)MFE Vv%5&&v.!#t,#(DL	) r   c                    i }| j                   j                         D ]%  \  }}t        |t              rt	        | |      ||<   ' |S r   r>   rI   rJ   r.   getattr)r:   r$   r   r   s       r   r$   zOptions.options   sJ    ++113 	8KFCc4(")$"7	8 r   c                    i }| j                   j                         D ]%  \  }}t        |t              st	        | |      ||<   ' |S r   rt   )r:   rK   r   r   s       r   rK   zOptions.flags   sJ    ++113 	6KFC#t$ 'f 5f	6 r   NF)r&   r'   r(   r)   rR   r>   r*   rA   r,   rg   rm   rp   r<   r?   r$   rK   __classcell__)rj   s   @r   r   r   J   s    -^ I+-K(-67p G G$  
- 
 
    r   c                  B    e Zd ZU dZdZg Zded<   g Zded<   ed        Z	y)Expandz8``expand`` option to polynomial manipulation functions. expandr   r   r   c                     yNTr   r   s    r   r   zExpand.default  r   r   N)
r&   r'   r(   r)   r   r   r*   r   r,   r   r   r   r   rz   rz      s0    BFHiHi r   rz   )	metaclassc                  R    e Zd ZU dZdZg Zded<   g Zded<   ed        Z	ed        Z
y)	Gensz6``gens`` option to polynomial manipulation functions. rD   r   r   r   c                     y)Nr   r   r   s    r   r   zGens.default  s    r   c                <   t        |t              r|f}n!t        |      dk(  rt        |d         r|d   }|dk(  rd}t        |      S t	        |      rt        dt        |      z        t        d |D              rt        dt        |      z        t        |      S )N   r   r   r   zduplicated generators: %sc              3  8   K   | ]  }|j                   d u   yw)FN)is_commutative)rY   gens     r   r\   z"Gens.preprocess.<locals>.<genexpr>!  s     =##u,=s   znon-commutative generators: %s)	
isinstancer   lenr   r   r   stranytuple)r   rD   s     r   r!   zGens.preprocess  s    dE"7DY!^DG 47D7?D T{ d^!"=D	"IJJ===!"BSY"NOOT{r   Nr&   r'   r(   r)   r   r   r*   r   r,   r   r!   r   r   r   r   r   
  sD    @FHiHi   r   r   c                  f    e Zd ZU dZdZg Zded<   g Zded<    ej                  d      Z
ed        Zy)	Wrtz5``wrt`` option to polynomial manipulation functions. wrtr   r   r   z\s*,\s*|\s+c                b   t        |t              rt        |      gS t        |t              rT|j                         }|j	                  d      rt        d      |sg S t        | j                  j                  |            S t        |d      rt        t        t        |            S t        d      )N,zBad input: missing parameter.__getitem__z!invalid argument for 'wrt' option)r   r   r   stripendswithr   rb   	_re_splitsplithasattrmap)r   r   s     r   r!   zWrt.preprocess1  s    c5!H:S!))+C||C !"ABB	++C011S-(C&&ABBr   N)r&   r'   r(   r)   r   r   r*   r   recompiler   r,   r!   r   r   r   r   r   '  sB    ?FHiHi

>*IC Cr   r   c                  R    e Zd ZU dZdZg Zded<   g Zded<   ed        Z	ed        Z
y)	Sortz6``sort`` option to polynomial manipulation functions. sortr   r   r   c                    g S r   r   r   s    r   r   zSort.defaultJ  s    	r   c                    t        |t              r-|j                  d      D cg c]  }|j                          c}S t	        |d      rt        t        t        |            S t        d      c c}w )N>r   z"invalid argument for 'sort' option)r   r   r   r   r   rb   r   r   )r   r   r   s      r   r!   zSort.preprocessN  sW    dC ,0JJsO=SSYY[==T=)C''BCC	 >s   A.Nr   r   r   r   r   r   B  sF    @FHiHi  D Dr   r   c                  R    e Zd ZU dZdZg Zded<   g Zded<   ed        Z	ed        Z
y)	Orderz7``order`` option to polynomial manipulation functions. orderr   r   r   c                J    t         j                  j                  j                  S r   )sympypolys	orderingslexr   s    r   r   zOrder.default`  s    {{$$(((r   c                T    t         j                  j                  j                  |      S r   )r   r   r   monomial_key)r   r   s     r   r!   zOrder.preprocessd  s    {{$$11%88r   Nr   r   r   r   r   r   X  sD    AFHiHi) ) 9 9r   r   c                  ,    e Zd ZU dZdZg Zded<   g dZy)Fieldz7``field`` option to polynomial manipulation functions. fieldr   r   )domainr   gaussianNr&   r'   r(   r)   r   r   r*   r   r   r   r   r   r   i  s    AFHi.Hr   r   c                  ,    e Zd ZU dZdZg Zded<   g dZy)Greedyz8``greedy`` option to polynomial manipulation functions. greedyr   r   r   r   r   	extensionmodulus	symmetricNr   r   r   r   r   r   r  s    BFHiSHr   r   c                  <    e Zd ZU dZdZed        Zg Zded<   g dZ	y)	Compositez;``composite`` option to polynomial manipulation functions. 	compositec                     y r   r   r   s    r   r   zComposite.default  r   r   r   r   r   N)
r&   r'   r(   r)   r   r,   r   r   r*   r   r   r   r   r   r   {  s-    EF  HiSHr   r   c                  *   e Zd ZU dZdZg Zded<   g dZdgZ e	j                  d      Z e	j                  d      Z e	j                  d	      Z e	j                  d
      Z e	j                  d      Z e	j                  d      Zed        Zed        Zy)Domainz8``domain`` option to polynomial manipulation functions. r   r   r   )r   r   r   r   r   rD   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                
   t        |t        j                  j                  j                        r|S t        |d      r|j                         S t        |t              r|dv r$t        j                  j                  j                  S |dv r$t        j                  j                  j                  S |dk(  r$t        j                  j                  j                  S |dk(  r$t        j                  j                  j                  S |dk(  r$t        j                  j                  j                  S | j                  j                  |      }|l|j                         \  }}}|$t        j                  j                  j                   S t        j                  j                  j#                  t%        |            S | j&                  j                  |      }|l|j                         \  }}}|$t        j                  j                  j(                  S t        j                  j                  j+                  t%        |            S | j,                  j                  |      }|Ct        j                  j                  j/                  t%        |j                         d               S | j0                  j                  |      }|q|j                         \  }}t3        t5        t6        |j9                  d                  }|dv r0t        j                  j                  j                  j:                  | S |dv r0t        j                  j                  j                  j:                  | S |d	v r0t        j                  j                  j                   j:                  | S |dk(  r0t        j                  j                  j                  j:                  | S |dk(  r0t        j                  j                  j                  j:                  | S t        j                  j                  j(                  j:                  | S | j<                  j                  |      }||j                         \  }}t3        t5        t6        |j9                  d                  }|dv r0t        j                  j                  j                  j>                  | S t        j                  j                  j                  j>                  | S | j@                  j                  |      }|it3        t5        t6        |j                         d   j9                  d                  }t        j                  j                  j                  jB                  | S tE        d
|z        )N	to_domain)ZZZ)QQQZZ_IQQ_IEXr   r   )RRRz-expected a valid domain specification, got %s)#r   r   r   domainsr   r   r   r   r   r   r   r   r   _re_realfieldmatchgroupsr   	RealFieldint_re_complexfieldCCComplexField_re_finitefieldFF_re_polynomialrb   r   r   r   	poly_ring_re_fraction
frac_field_re_algebraicalgebraic_fieldr   )r   r   r_precgroundrD   s          r   r!   zDomain.preprocess  s   fekk11889MV[)##%%$${{**---${{**---{{**///{{**///~{{**---!!''/A}XXZ
1d< ;;..111 ;;..88TCC$$**62A}XXZ
1d< ;;..111 ;;..;;CIFF##))&1A}{{**--c!((*Q-.@AA""((0A} xxzCC9:[( ;;..11;;TBB{* ;;..11;;TBB{* ;;..11;;TBBv% ;;..33==tDDv% ;;..33==tDD ;;..11;;TBB  &&v.A} xxzCC9:[( ;;..11<<dCC ;;..11<<dCC!!''/A}CA)<)<S)ABC{{**--==tDDIFRSSr   c                   d|v rEd|v rA|d   j                   r2t        |d   j                        t        |d         z  rt        d      d|vs|d   s;d|v r6|d   t        j
                  j                  j                  k(  rt        d      y y y )NrD   r   z/ground domain and generators interfere togetherz>you have to provide generators because EX domain was requested)is_Compositer_   symbolsr   r   r   r   r   r#   s     r   r%   zDomain.postprocess  s    WW!49J9W9WWX&../#gfo2FF!AC CG#76?G#(9U[[=P=P=S=S(S!"bcc )T# ,;r   N)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    BFHiDHHEBJJ34M!rzz"67 bjj!67ORZZ LMN2::67LBJJ23MTT TTl d dr   r   c                  <    e Zd ZU dZdZg Zded<   g dZed        Z	y)Splitz7``split`` option to polynomial manipulation functions. r   r   r   )r   r   r   r   r   r   r   c                "    d|v rt        d      y )Nr   z%'split' option is not implemented yet)NotImplementedErrorr#   s     r   r%   zSplit.postprocess  s    g%&MNN r   N
r&   r'   r(   r)   r   r   r*   r   r,   r%   r   r   r   r   r     s1    AFHi H O Or   r   c                  <    e Zd ZU dZdZg Zded<   g dZed        Z	y)Gaussianz:``gaussian`` option to polynomial manipulation functions. r   r   r   )r   r   r   r   r   r   r   c                    d|v rE|d   du r=t         j                  j                  j                  |d<   t        j                  |       y y y )Nr   Tr   )r   r   r   r   	Extensionr%   r#   s     r   r%   zGaussian.postprocess  sG     WZ%8D%@ % 3 3 8 8GH!!'* &A r   Nr   r   r   r   r   r   
  s/    DFHi H + +r   r   c                  L    e Zd ZU dZdZg Zded<   g dZed        Z	ed        Z
y)	r   z;``extension`` option to polynomial manipulation functions. r   r   r   )r   r   r   r   r   r   c                    |dk(  rt        |      S |dk(  rt        d      t        |d      s|h}|S |sd }|S t        |      }|S )Nr   r   z.'False' is an invalid argument for 'extension'__iter__)r3   r   r   r_   )r   r   s     r   r!   zExtension.preprocess#  sb    >	?"!^NOO9j1&K	  ! $I  !$IIr   c                    d|v r?|d   dur7t        j                  j                  j                  j                  |d    |d<   y y y )Nr   Tr   )r   r   r   r   r   r#   s     r   r%   zExtension.postprocess4  sL    '!gk&:$&F % 3 3 6 6 F F%!'GH 'G!r   Nr&   r'   r(   r)   r   r   r*   r   r,   r!   r%   r   r   r   r   r     sC    EFHiH    ' 'r   r   c                  L    e Zd ZU dZdZg Zded<   g dZed        Z	ed        Z
y)	Modulusz9``modulus`` option to polynomial manipulation functions. r   r   r   )r   r   r   r   r   c                l    t        |      }|j                  r|dkD  rt        |      S t        d|z        )Nr   z)'modulus' must a positive integer, got %s)r   
is_Integerr   r   )r   r   s     r   r!   zModulus.preprocessC  s<    '"'A+w<;gEG Gr   c                    d|v rE|d   }|j                  dd      }t        j                  j                  j	                  ||      |d<   y y )Nr   r   Tr   )rO   r   r   r   r   )r   r$   r   r   s       r   r%   zModulus.postprocessM  sJ    i(GK6I % 3 3 6 6w	 JGH  r   Nr   r   r   r   r   r   ;  sC    CFHiEHG G K Kr   r   c                  "    e Zd ZdZdZdgZg dZy)	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   U  s    EF{HEHr   r   c                  $    e Zd ZdZdZed        Zy)Strictz8``strict`` option to polynomial manipulation functions. rL   c                     yr}   r   r   s    r   r   zStrict.defaultc  r   r   Nr&   r'   r(   r)   r   r,   r   r   r   r   r   r   ^  s    BF r   r   c                  <    e Zd ZdZdZg dZed        Zed        Zy)Autoz4``auto`` flag to polynomial manipulation functions. auto)r   r   r   r   c                     yr}   r   r   s    r   r   zAuto.defaulto  r   r   c                *    d|v sd|v rd|vrd|d<   y y y )Nr   r   r   Fr   r#   s     r   r%   zAuto.postprocesss  s*    7g#56;P#GFO <Q#5r   N)	r&   r'   r(   r)   r   r   r,   r   r%   r   r   r   r   r   h  s5    >F8E  $ $r   r   c                  $    e Zd ZdZdZed        Zy)Fracz6``auto`` option to polynomial manipulation functions. fracc                     yrw   r   r   s    r   r   zFrac.default~      r   Nr   r   r   r   r   r   y  s    @F r   r   c                  $    e Zd ZdZdZed        Zy)Formalz6``formal`` flag to polynomial manipulation functions. formalc                     yrw   r   r   s    r   r   zFormal.default  r  r   Nr   r   r   r   r  r        @F r   r  c                      e Zd ZdZdZy)Polysz5``polys`` flag to polynomial manipulation functions. r   N)r&   r'   r(   r)   r   r   r   r   r
  r
    s
    ?Fr   r
  c                  $    e Zd ZdZdZed        Zy)Includez7``include`` flag to polynomial manipulation functions. includec                     yrw   r   r   s    r   r   zInclude.default  r  r   Nr   r   r   r   r  r    s    AF r   r  c                  $    e Zd ZdZdZed        Zy)Allz3``all`` flag to polynomial manipulation functions. allc                     yrw   r   r   s    r   r   zAll.default  r  r   Nr   r   r   r   r  r    s    =F r   r  c                  4    e Zd ZdZdZed        Zed        Zy)Genz3``gen`` flag to polynomial manipulation functions. r   c                     y)Nr   r   r   s    r   r   zGen.default  s    r   c                H    t        |t        t        f      r|S t        d      )Nz!invalid argument for 'gen' option)r   r   r   r   )r   r   s     r   r!   zGen.preprocess  s!    cE3<(JABBr   Nr&   r'   r(   r)   r   r,   r   r!   r   r   r   r  r    s2    =F  C Cr   r  c                  $    e Zd ZdZdZed        Zy)Seriesz6``series`` flag to polynomial manipulation functions. seriesc                     yrw   r   r   s    r   r   zSeries.default  r  r   Nr   r   r   r   r  r    r  r   r  c                  4    e Zd ZdZdZed        Zed        Zy)Symbolsz7``symbols`` flag to polynomial manipulation functions. r   c                    t        dd      S )Nsr   )start)r
   r   s    r   r   zSymbols.default  s    1--r   c                L    t        |d      rt        |      S t        d|z        )Nr   z2expected an iterator or iterable container, got %s)r   iterr   )r   r   s     r   r!   zSymbols.preprocess  s(    7J'= RU\\]]r   Nr  r   r   r   r  r    s2    AF. . ^ ^r   r  c                  $    e Zd ZdZdZed        Zy)Methodz6``method`` flag to polynomial manipulation functions. methodc                ^    t        |t              r|j                         S t        d|z        )Nzexpected a string, got %s)r   r   lowerr   )r   r%  s     r   r!   zMethod.preprocess  s)    fc"<<>!9FBCCr   N)r&   r'   r(   r)   r   r,   r!   r   r   r   r$  r$    s    @FD Dr   r$  c                X    |d| }} t        |      dk7  sd|vs| rt        | |      S |d   S )z9Construct options from keyword arguments or ... options. r   r   opt)r   r   )rD   r?   s     r   build_optionsr*    s;    |d
4yA~d*dtT""E{r   c                    t        |      }| j                         D ]2  }	 t        j                  |   j                  r||vrt        d|z        4 y# t        $ r t        d|z        w xY w)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'])

    rH   rG   N)r_   rQ   r   r>   r+   r	   r9   r   )r?   rK   args      r   allowed_flagsr-    s    ( JEyy{ B	B""3'//Cu4D>DF FB
  	B:S@AA	Bs   /AA*c                .    d| vrt        |       } || d<   | S )z$Update options with default values. rE   )rN   )r$   rE   s     r   set_defaultsr/  
  s"     w-&
Nr   r   )9r)   
__future__r   __all__
sympy.corer   r   sympy.polys.polyerrorsr   r   r	   sympy.utilitiesr
   r   r   sympy.utilities.iterablesr   r   sympy.polysr   r   r   r.   r0   typer6   rN   r   rz   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/  rg   r   r   r   <module>r8     s   D "+ % J J F F ;  	 46 gF g. . od o od
]j 
6Z :C&J C6D6Z D,9Fj 9"/MZ /T]j T
T 
TpdVz pdfOMZ O+}
 + '* 'BKf
 K4F F]j $=$* $"=$* ]DJ M4: mTZ - C$* C"]DJ ^dj ^"
DTZ 
DB>      "r   