
    ,hE                         S S/r SSKJrJrJrJrJrJr  \ / SQ-  r SSKJ	r	  \ S/-  r SSK
JrJrJr  \ / SQ-  r SSKJr  \ S/-  r SS	KJrJrJr  \ / S	Q-  r S
 rS rS rS rg)IQ    )ContrastMatrix	TreatmentPolySumHelmertDiff)Cr   )centerstandardizescale)bsr   )crcctec                     U $ )a}  The identity function. Simply returns its input unchanged.

Since Patsy's formula parser ignores anything inside a function call
syntax, this is useful to 'hide' arithmetic operations from it. For
instance::

  y ~ x1 + x2

has ``x1`` and ``x2`` as two separate predictors. But in::

  y ~ I(x1 + x2)

we instead have a single predictor, defined to be the sum of ``x1`` and
``x2``. )xs    aC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\patsy/builtins.pyr   r   "   s	     H    c                  B    [        S5      S:X  d   e[        S 5      b   eg )N   )r   r   r   r   test_Ir   4   s     Q4199T7??r   c                     SSK Jn  UR                  S5      n UR                  U    $ ! [         a    [        SU < S35      ef = f)a  A way to 'quote' variable names, especially ones that do not otherwise
meet Python's variable name rules.

If ``x`` is a variable, ``Q("x")`` returns the value of ``x``. (Note that
``Q`` takes the *string* ``"x"``, not the value of ``x`` itself.) This
works even if instead of ``x``, we have a variable name that would not
otherwise be legal in Python.

For example, if you have a column of data named ``weight.in.kg``, then you
can't write::

  y ~ weight.in.kg

because Python will try to find a variable named ``weight``, that has an
attribute named ``in``, that has an attribute named ``kg``. (And worse
yet, ``in`` is a reserved word, which makes this example doubly broken.)
Instead, write::

  y ~ Q("weight.in.kg")

and all will be well. Note, though, that this requires embedding a Python
string inside your formula, which may require some care with your quote
marks. Some standard options include::

  my_fit_function("y ~ Q('weight.in.kg')", ...)
  my_fit_function('y ~ Q("weight.in.kg")', ...)
  my_fit_function("y ~ Q(\"weight.in.kg\")", ...)

Note also that ``Q`` is an ordinary Python function, which means that you
can use it in more complex expressions. For example, this is a legal
formula::

  y ~ np.sqrt(Q("weight.in.kg"))
r   )EvalEnvironmentr   zno data named z found)
patsy.evalr   capture	namespaceKeyError	NameError)namer   envs      r   r   r   9   sI    F +

!
!!
$C<}}T"" <D:;;<s	   ( Ac                      Sn [        S5      S:X  d   e[        S5      [         L d   eSS KnUR                  [        [         S5        g )Nr   ar   r   asdfsadfdsad)r   pytestraisesr!   )r%   r'   s     r   test_Qr)   e   s:    	AS6Q;;S6Q;;
MM)Q/r   N)__all__patsy.contrastsr   r   r   r   r	   r
   patsy.categoricalr   patsy.stater   r   r   patsy.splinesr   patsy.mgcv_cubic_splinesr   r   r   r   r   r   r)   r   r   r   <module>r0      sv    * O O L L  C5  2 2 - -  D6  / /  $
)<X0r   