ó
¡¼™\c           @  ss  d  Z  d d l m Z m Z d g Z d d l m Z m Z m 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 d d	 l Z d d	 l Z d
 e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ e d e f d „  ƒ  Yƒ Z  d e e e ƒ f d „  ƒ  YZ! d e e e ƒ f d „  ƒ  YZ" d e e e ƒ f d „  ƒ  YZ# d e e e ƒ f d „  ƒ  YZ$ d e e e ƒ f d „  ƒ  YZ% d e e e ƒ f d „  ƒ  YZ& d e e e ƒ f d  „  ƒ  YZ' d! e e e ƒ f d" „  ƒ  YZ( d# e e e ƒ f d$ „  ƒ  YZ) d% e e e ƒ f d& „  ƒ  YZ* d' e e e ƒ f d( „  ƒ  YZ+ d) e e e ƒ f d* „  ƒ  YZ, d+ e e e ƒ f d, „  ƒ  YZ- d- e e e ƒ f d. „  ƒ  YZ. d/ e e e ƒ f d0 „  ƒ  YZ/ d1 e e e e ƒ f d2 „  ƒ  YZ0 d3 e e e e ƒ f d4 „  ƒ  YZ1 d5 e e e e ƒ f d6 „  ƒ  YZ2 d7 e e e e ƒ f d8 „  ƒ  YZ3 d9 e e e e ƒ f d: „  ƒ  YZ4 d; e e e e ƒ f d< „  ƒ  YZ5 d= e e e ƒ f d> „  ƒ  YZ6 d? e e e e ƒ f d@ „  ƒ  YZ7 dA e e e ƒ f dB „  ƒ  YZ8 dC e e e ƒ f dD „  ƒ  YZ9 d	 dE „ Z; dF „  Z< dG „  Z= e  j> ƒ  d	 S(H   s<   Options manager for :class:`Poly` and public API functions. iÿÿÿÿ(   t   print_functiont   divisiont   Options(   t   St   Basict   sympify(   t   string_typest   with_metaclass(   t   GeneratorsErrort   OptionErrort	   FlagError(   t   numbered_symbolst   topological_sortt   public(   t   has_dupsNt   Optionc           B  s_   e  Z d  Z d Z e Z g  Z g  Z g  Z	 g  Z
 e d „  ƒ Z e d „  ƒ Z e d „  ƒ Z RS(   s%   Base class for all kinds of options. c         C  s   d  S(   N(   t   None(   t   cls(    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyt   default   s    c         C  s   d  S(   N(   R   (   R   t   option(    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyt
   preprocess"   s    c         C  s   d  S(   N(    (   R   t   options(    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyt   postprocess&   s    N(   t   __name__t
   __module__t   __doc__R   R   t   Falset   is_Flagt   requirest   excludest   aftert   beforet   classmethodR   R   R   (    (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR      s   t   Flagc           B  s   e  Z d  Z e Z RS(   s#   Base class for all kinds of flags. (   R   R   R   t   TrueR   (    (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR!   +   s   t   BooleanOptionc           B  s   e  Z d  Z e d „  ƒ Z RS(   sA   An option that must have a boolean value or equivalent assigned. c         C  s9   | t  t g k r t | ƒ St d |  j | f ƒ ‚ d  S(   Ns/   '%s' must have a boolean value assigned, got %s(   R"   R   t   boolR	   R   (   R   t   value(    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR   4   s    
(   R   R   R   R    R   (    (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR#   1   s   t
   OptionTypec           B  s   e  Z d  Z d „  Z RS(   s7   Base type for all options that does registers options. c           s<   t  ‡  f d †  ƒ } t t ˆ  j | ƒ ˆ  t j ˆ  j <d  S(   Nc           s.   y |  ˆ  j  SWn t k
 r) ˆ  j ƒ  SXd  S(   N(   R   t   KeyErrorR   (   t   self(   R   (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyt   getter@   s    (   t   propertyt   setattrR   R   t   __options__(   R   t   argst   kwargsR)   (    (   R   s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyt   __init__?   s    (   R   R   R   R/   (    (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR&   <   s   c           B  sz   e  Z d  Z d Z i  Z d e d „ Z e d „  ƒ Z	 i  d „ Z
 d „  Z e d „  ƒ Z e d „  ƒ Z e d „  ƒ Z RS(	   sB  
    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

    c           sÙ  t  j ˆ ƒ | r4 | j d d ƒ r4 t d ƒ ‚ n | rS t  | ƒ } | | d <n  | j d i  ƒ } ‡  ‡ ‡ f d †  } | | ƒ xt t  | ƒ j ƒ  D]` \ } } | ˆ k r¹ | | =q— x; ˆ j ƒ  D]- }	 ˆ j |	 }
 | |
 j k rÆ | | =PqÆ qÆ Wq— W| | ƒ x¥ ˆ j ƒ  D]— }	 ˆ j |	 }
 x? |
 j	 D]4 } ˆ j | ƒ d  k r/t d |	 | f ƒ ‚ q/q/Wx? |
 j D]4 } ˆ j | ƒ d  k	 rqt d |	 | f ƒ ‚ qqqqWqWx% ˆ j D] }	 ˆ j |	 j ˆ ƒ q·Wd  S(   Nt   genss1   both '*gens' and keyword argument 'gens' suppliedt   defaultsc           s¾   x· |  j  ƒ  D]© \ } } y ˆ j | } Wn! t k
 rM t d | ƒ ‚ n Xt | t ƒ r” ˆ  d  k su | ˆ  k r” ˆ r‘ t d | ƒ ‚ q‘ q” n  | d  k	 r | j | ƒ ˆ | <q q Wd  S(   Ns   '%s' is not a valid options(   '%s' flag is not allowed in this context(   t   itemsR,   R'   R	   t
   issubclassR!   R   R   (   R-   R   R%   R   (   t   flagsR(   t   strict(    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyt   preprocess_options‹   s    s.   '%s' option is only allowed together with '%s's-   '%s' option is not allowed together with '%s'(    (   t   dictR/   t   getR	   t   popR2   t   keysR,   R   R   R   t	   __order__R   (   R(   R0   R-   R4   R5   R1   R6   t   keyR%   R   R   t   require_optiont   exclude_option(    (   R4   R(   R5   s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR/      s:    


!c         C  sã   |  j  d k rß g  t g  ƒ } } xx |  j j ƒ  D]g \ } } | j | ƒ x$ | j D] } | j | | f ƒ qU Wx$ | j D] } | j | | f ƒ q| Wq2 Wy t	 | t
 | ƒ f ƒ |  _  Wqß t k
 rÛ t d ƒ ‚ qß Xn  d S(   s*   Resolve the order of options' processing. s/   cycle detected in sympy.polys options frameworkN(   R;   R   t   setR,   R2   t   appendR   t   addR   R   t   listt
   ValueErrort   RuntimeError(   R   t   verticest   edgest   nameR   t   _name(    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyt   _init_dependencies_order·   s    c         C  sd   t  j |  j ƒ } x$ |  j ƒ  D] \ } } | | | <q Wx$ | j ƒ  D] \ } } | | | <qF W| S(   s-   Clone ``self`` and update specified options. (   R7   t   __new__t	   __class__R2   (   R(   t   updatest   objR   R%   (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyt   cloneÌ   s    c         C  s9   | |  j  k r | |  | <n t t |  ƒ j | | ƒ d  S(   N(   R,   t   superR   t   __setattr__(   R(   t   attrR%   (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyRP   Ø   s    c         C  sk   i  } x^ |  j  ƒ  D]P \ } } | d  k	 r | d k r |  j | } t | t ƒ sc | | | <qc q q W| S(   NR0   (   R2   R   R,   R3   R!   (   R(   R-   R   R%   R   (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR-   Þ   s    c         C  sO   i  } xB |  j  j ƒ  D]1 \ } } t | t ƒ s t |  | ƒ | | <q q W| S(   N(   R,   R2   R3   R!   t   getattr(   R(   R   R   R   (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR   ë   s
    c         C  sO   i  } xB |  j  j ƒ  D]1 \ } } t | t ƒ r t |  | ƒ | | <q q W| S(   N(   R,   R2   R3   R!   RR   (   R(   R4   R   R   (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR4   õ   s
    N(   R   R   R   R   R;   R,   R   R/   R    RI   RN   RP   R*   R-   R   R4   (    (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR   K   s   /8	
t   Expandc           B  s/   e  Z d  Z d Z g  Z g  Z e d „  ƒ Z RS(   s8   ``expand`` option to polynomial manipulation functions. t   expandc         C  s   t  S(   N(   R"   (   R   (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR     s    (   R   R   R   R   R   R   R    R   (    (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyRS      s
   t   Gensc           B  s>   e  Z d  Z d Z g  Z g  Z e d „  ƒ Z e d „  ƒ Z RS(   s6   ``gens`` option to polynomial manipulation functions. R0   c         C  s   d S(   N(    (    (   R   (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR     s    c         C  sÀ   t  | t ƒ r | f } n2 t | ƒ d k rM t | d d ƒ rM | d } n  | d k rb d } nT t | ƒ r‡ t d t | ƒ ƒ ‚ n/ t d „  | Dƒ ƒ r¶ t d t | ƒ ƒ ‚ n  t	 | ƒ S(	   Ni   i    t   __iter__s   duplicated generators: %sc         s  s   |  ] } | j  t k Vq d  S(   N(   t   is_commutativeR   (   t   .0t   gen(    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pys	   <genexpr>$  s    s   non-commutative generators: %s(   N(    (
   t
   isinstanceR   t   lent   hasattrR   R   R   t   strt   anyt   tuple(   R   R0   (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR     s    %	(	   R   R   R   R   R   R   R    R   R   (    (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyRU     s   t   Wrtc           B  s>   e  Z d  Z d Z g  Z g  Z e j d ƒ Z e	 d „  ƒ Z
 RS(   s5   ``wrt`` option to polynomial manipulation functions. t   wrts   \s*,\s*|\s+c         C  s´   t  | t ƒ r t | ƒ g St  | t ƒ r‚ | j ƒ  } | j d ƒ rU t d ƒ ‚ n  | s_ g  Sg  |  j j | ƒ D] } | ^ qr St | d ƒ r¤ t	 t
 t | ƒ ƒ St d ƒ ‚ d  S(   Nt   ,s   Bad input: missing parameter.t   __getitem__s!   invalid argument for 'wrt' option(   RZ   R   R]   t   stript   endswithR	   t	   _re_splitt   splitR\   RB   t   map(   R   Ra   RY   (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR   4  s    #(   R   R   R   R   R   R   t   ret   compileRf   R    R   (    (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR`   *  s   t   Sortc           B  s>   e  Z d  Z d Z g  Z g  Z e d „  ƒ Z e d „  ƒ Z RS(   s6   ``sort`` option to polynomial manipulation functions. t   sortc         C  s   g  S(   N(    (   R   (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR   M  s    c         C  sg   t  | t ƒ r5 g  | j d ƒ D] } | j ƒ  ^ q St | d ƒ rW t t t | ƒ ƒ St d ƒ ‚ d  S(   Nt   >Rc   s"   invalid argument for 'sort' option(   RZ   R]   Rg   Rd   R\   RB   Rh   R	   (   R   Rl   RY   (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR   Q  s
    &(	   R   R   R   R   R   R   R    R   R   (    (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyRk   E  s   t   Orderc           B  s>   e  Z d  Z d Z g  Z g  Z e d „  ƒ Z e d „  ƒ Z RS(   s7   ``order`` option to polynomial manipulation functions. t   orderc         C  s   t  j j j S(   N(   t   sympyt   polyst	   orderingst   lex(   R   (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR   c  s    c         C  s   t  j j j | ƒ S(   N(   Rp   Rq   Rr   t   monomial_key(   R   Ro   (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR   g  s    (	   R   R   R   R   R   R   R    R   R   (    (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyRn   [  s   t   Fieldc           B  s)   e  Z d  Z d Z g  Z d d d g Z RS(   s7   ``field`` option to polynomial manipulation functions. t   fieldt   domainRg   t   gaussian(   R   R   R   R   R   R   (    (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyRu   l  s   t   Greedyc           B  s2   e  Z d  Z d Z g  Z d d d d d d g Z RS(   s8   ``greedy`` option to polynomial manipulation functions. t   greedyRw   Rg   Rx   t	   extensiont   modulust	   symmetric(   R   R   R   R   R   R   (    (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyRy   u  s   t	   Compositec           B  sA   e  Z d  Z d Z e d „  ƒ Z g  Z d d d d d d g Z RS(	   s;   ``composite`` option to polynomial manipulation functions. t	   compositec         C  s   d  S(   N(   R   (   R   (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR   ƒ  s    Rw   Rg   Rx   R{   R|   R}   (   R   R   R   R   R    R   R   R   (    (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR~   ~  s
   t   Domainc           B  s°   e  Z d  Z d Z g  Z d d d d d g 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 RS(   s8   ``domain`` option to polynomial manipulation functions. Rw   Rv   Rz   Rg   Rx   R{   R0   s   ^(R|RR)(_(\d+))?$s   ^(C|CC)(_(\d+))?$s   ^(FF|GF)\((\d+)\)$s   ^(Z|ZZ|Q|QQ)\[(.+)\]$s   ^(Z|ZZ|Q|QQ)\((.+)\)$s   ^(Q|QQ)\<(.+)\>$c         C  s%  t  | t j j j ƒ r | St | d ƒ r5 | j ƒ  St  | t ƒ r| d
 k r] t j j j S| d k rv t j j j	 S| d k r t j j j
 S|  j j | ƒ } | d  k	 r÷ | j ƒ  \ } } } | d  k rÛ t j j j St j j j t | ƒ ƒ Sn  |  j j | ƒ } | d  k	 r_| j ƒ  \ } } } | d  k rCt j j j St j j j t | ƒ ƒ Sn  |  j j | ƒ } | d  k	 r t j j j t | j ƒ  d ƒ ƒ S|  j j | ƒ } | d  k	 r)| j ƒ  \ } } t t t | j d ƒ ƒ ƒ } | d k rt j j j j | Œ  St j j j	 j | Œ  Sn  |  j j | ƒ } | d  k	 r²| j ƒ  \ } } t t t | j d ƒ ƒ ƒ } | d k r™t j j j j | Œ  St j j j	 j | Œ  Sn  |  j j | ƒ } | d  k	 rt t t | j ƒ  d j d ƒ ƒ ƒ } t j j j	 j  | Œ  Sn  t! d	 | ƒ ‚ d  S(   Nt	   to_domaint   Zt   ZZt   Qt   QQt   EXi   Rb   s-   expected a valid domain specification, got %s(   R‚   Rƒ   (   R„   R…   (   R‚   Rƒ   (   R‚   Rƒ   ("   RZ   Rp   Rq   t   domainsR€   R\   R   R   Rƒ   R…   R†   t   _re_realfieldt   matchR   t   groupst   RRt	   RealFieldt   intt   _re_complexfieldt   CCt   ComplexFieldt   _re_finitefieldt   FFt   _re_polynomialRB   Rh   R   Rg   t	   poly_ringt   _re_fractiont
   frac_fieldt   _re_algebraict   algebraic_fieldR	   (   R   Rw   t   rt   _t   prect   groundR0   (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR   œ  sZ    
#(c         C  s¤   d | k rU d | k rU | d j  rU t | d j ƒ t | d ƒ @rU t d ƒ ‚ nK d | k sl | d r  d | k r  | d t j j j k r  t d ƒ ‚ n  d  S(   NR0   Rw   s/   ground domain and generators interfere togethers>   you have to provide generators because EX domain was requested(   t   is_CompositeR?   t   symbolsR   Rp   Rq   R‡   R†   (   R   R   (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR   å  s    %!%(   R   R   R   R   R   R   R   Ri   Rj   Rˆ   RŽ   R‘   R“   R•   R—   R    R   R   (    (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR€   ‹  s   	It   Splitc           B  sD   e  Z d  Z d Z g  Z d d d d d d d g Z e d	 „  ƒ Z RS(
   s7   ``split`` option to polynomial manipulation functions. Rg   Rv   Rz   Rw   Rx   R{   R|   R}   c         C  s   d | k r t  d ƒ ‚ n  d  S(   NRg   s%   'split' option is not implemented yet(   t   NotImplementedError(   R   R   (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR   ù  s    (   R   R   R   R   R   R   R    R   (    (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyRŸ   ð  s   t   Gaussianc           B  sD   e  Z d  Z d Z g  Z d d d d d d d g Z e d	 „  ƒ Z RS(
   s:   ``gaussian`` option to polynomial manipulation functions. Rx   Rv   Rz   Rw   Rg   R{   R|   R}   c         C  sF   d | k rB | d t  k rB t t j g ƒ | d <t j | ƒ n  d  S(   NRx   R{   (   R"   R?   R   t   ImaginaryUnitt	   ExtensionR   (   R   R   (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR     s    (   R   R   R   R   R   R   R    R   (    (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR¡   ÿ  s   R£   c           B  sP   e  Z d  Z d Z g  Z d d d d d d g Z e d „  ƒ Z e d	 „  ƒ Z RS(
   s;   ``extension`` option to polynomial manipulation functions. R{   Rz   Rw   Rg   Rx   R|   R}   c         C  su   | d k r t  | ƒ S| d k r1 t d ƒ ‚ n@ t | d ƒ sR t | g ƒ } n | sa d  } n t | ƒ } | Sd  S(   Ni   i    s.   'False' is an invalid argument for 'extension'RV   (   R$   R	   R\   R?   R   (   R   R{   (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR     s    
	c         C  sC   d | k r? | d t  k	 r? t j j j j | d Œ  | d <n  d  S(   NR{   Rw   (   R"   Rp   Rq   R‡   R…   R˜   (   R   R   (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR   )  s    (	   R   R   R   R   R   R   R    R   R   (    (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR£     s   	t   Modulusc           B  sM   e  Z d  Z d Z g  Z d d d d d g Z e d „  ƒ Z e d „  ƒ Z RS(	   s9   ``modulus`` option to polynomial manipulation functions. R|   Rz   Rg   Rw   Rx   R{   c         C  s?   t  | ƒ } | j r+ | d k r+ t | ƒ St d | ƒ ‚ d  S(   Ni    s)   'modulus' must a positive integer, got %s(   R   t
   is_IntegerR   R	   (   R   R|   (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR   8  s
    
c         C  sK   d | k rG | d } | j  d t ƒ } t j j j | | ƒ | d <n  d  S(   NR|   R}   Rw   (   R8   R"   Rp   Rq   R‡   R’   (   R   R   R|   R}   (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR   B  s    
(	   R   R   R   R   R   R   R    R   R   (    (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR¤   0  s   
t	   Symmetricc           B  s2   e  Z d  Z d Z d g Z d d d d d g Z RS(   s;   ``symmetric`` option to polynomial manipulation functions. R}   R|   Rz   Rw   Rg   Rx   R{   (   R   R   R   R   R   R   (    (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR¦   J  s   	t   Strictc           B  s#   e  Z d  Z d Z e d „  ƒ Z RS(   s8   ``strict`` option to polynomial manipulation functions. R5   c         C  s   t  S(   N(   R"   (   R   (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR   X  s    (   R   R   R   R   R    R   (    (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR§   S  s   t   Autoc           B  sD   e  Z d  Z d Z d d d d g Z e d „  ƒ Z e d „  ƒ Z RS(   s4   ``auto`` flag to polynomial manipulation functions. t   autoRv   Rw   R{   Rx   c         C  s   t  S(   N(   R"   (   R   (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR   d  s    c         C  s5   d | k s d | k r1 d | k r1 t  | d <n  d  S(   NRw   Rv   R©   (   R   (   R   R   (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR   h  s    $(   R   R   R   R   R   R    R   R   (    (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR¨   ]  s
   t   Fracc           B  s#   e  Z d  Z d Z e d „  ƒ Z RS(   s6   ``auto`` option to polynomial manipulation functions. t   fracc         C  s   t  S(   N(   R   (   R   (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR   s  s    (   R   R   R   R   R    R   (    (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyRª   n  s   t   Formalc           B  s#   e  Z d  Z d Z e d „  ƒ Z RS(   s6   ``formal`` flag to polynomial manipulation functions. t   formalc         C  s   t  S(   N(   R   (   R   (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR   }  s    (   R   R   R   R   R    R   (    (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR¬   x  s   t   Polysc           B  s   e  Z d  Z d Z RS(   s5   ``polys`` flag to polynomial manipulation functions. Rq   (   R   R   R   R   (    (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR®   ‚  s   t   Includec           B  s#   e  Z d  Z d Z e d „  ƒ Z RS(   s7   ``include`` flag to polynomial manipulation functions. t   includec         C  s   t  S(   N(   R   (   R   (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR     s    (   R   R   R   R   R    R   (    (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR¯   ˆ  s   t   Allc           B  s#   e  Z d  Z d Z e d „  ƒ Z RS(   s3   ``all`` flag to polynomial manipulation functions. t   allc         C  s   t  S(   N(   R   (   R   (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR   —  s    (   R   R   R   R   R    R   (    (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR±   ’  s   t   Genc           B  s2   e  Z d  Z d Z e d „  ƒ Z e d „  ƒ Z RS(   s3   ``gen`` flag to polynomial manipulation functions. RY   c         C  s   d S(   Ni    (    (   R   (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR   ¡  s    c         C  s)   t  | t t f ƒ r | St d ƒ ‚ d  S(   Ns!   invalid argument for 'gen' option(   RZ   R   R   R	   (   R   RY   (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR   ¥  s    (   R   R   R   R   R    R   R   (    (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR³   œ  s   t   Seriesc           B  s#   e  Z d  Z d Z e d „  ƒ Z RS(   s6   ``series`` flag to polynomial manipulation functions. t   seriesc         C  s   t  S(   N(   R   (   R   (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR   ²  s    (   R   R   R   R   R    R   (    (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR´   ­  s   t   Symbolsc           B  s2   e  Z d  Z d Z e d „  ƒ Z e d „  ƒ Z RS(   s7   ``symbols`` flag to polynomial manipulation functions. Rž   c         C  s   t  d d d ƒS(   Nt   st   starti   (   R   (   R   (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR   ¼  s    c         C  s-   t  | d ƒ r t | ƒ St d | ƒ ‚ d  S(   NRV   s2   expected an iterator or iterable container, got %s(   R\   t   iterR	   (   R   Rž   (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR   À  s    
(   R   R   R   R   R    R   R   (    (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR¶   ·  s   t   Methodc           B  s#   e  Z d  Z d Z e d „  ƒ Z RS(   s6   ``method`` flag to polynomial manipulation functions. t   methodc         C  s-   t  | t ƒ r | j ƒ  St d | ƒ ‚ d  S(   Ns   expected a string, got %s(   RZ   R]   t   lowerR	   (   R   R»   (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyR   Í  s    
(   R   R   R   R   R    R   (    (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyRº   È  s   c         C  sY   | d k r d |  }  } n  t | ƒ d k s@ d | k s@ |  rM t |  | ƒ S| d Sd S(   s9   Construct options from keyword arguments or ... options. i   t   optN(    (   R   R[   R   (   R0   R-   (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyt   build_optionsÕ  s
    $c         C  s~   t  | ƒ } xk |  j ƒ  D]] } y3 t j | j rQ | | k rQ t d | ƒ ‚ n  Wq t k
 ru t d | ƒ ‚ q Xq Wd S(   sÎ  
    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'])

    s(   '%s' flag is not allowed in this contexts   '%s' is not a valid optionN(   R?   R:   R   R,   R   R
   R'   R	   (   R-   R4   t   arg(    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyt   allowed_flagsà  s    c         K  s)   d |  k r% t  |  ƒ }  | |  d <n  |  S(   s$   Update options with default values. R1   (   R7   (   R   R1   (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyt   set_defaultsÿ  s    (?   R   t
   __future__R    R   t   __all__t
   sympy.coreR   R   R   t   sympy.core.compatibilityR   R   t   sympy.polys.polyerrorsR   R	   R
   t   sympy.utilitiesR   R   R   t   sympy.utilities.iterablesR   t   sympy.polysRp   Ri   t   objectR   R!   R#   t   typeR&   R7   R   RS   RU   R`   Rk   Rn   Ru   Ry   R~   R€   RŸ   R¡   R£   R¤   R¦   R§   R¨   Rª   R¬   R®   R¯   R±   R³   R´   R¶   Rº   R   R¾   RÀ   RÁ   RI   (    (    (    s6   lib/python2.7/site-packages/sympy/polys/polyoptions.pyt   <module>   sX   	´		e!	
""
"
""
"
"
		