
    ,h                     &    S /r  " S S \5      rS rg)Originc                   \    \ rS rSrSrS r\S 5       rS rS r	S r
S rSS	 jrS
 rS rSrg)r      a  This represents the origin of some object in some string.

For example, if we have an object ``x1_obj`` that was produced by parsing
the ``x1`` in the formula ``"y ~ x1:x2"``, then we conventionally keep
track of that relationship by doing::

  x1_obj.origin = Origin("y ~ x1:x2", 4, 6)

Then later if we run into a problem, we can do::

  raise PatsyError("invalid factor", x1_obj)

and we'll produce a nice error message like::

  PatsyError: invalid factor
      y ~ x1:x2
          ^^

Origins are compared by value, and hashable.
c                 (    Xl         X l        X0l        g Ncodestartend)selfr   r	   r
   s       _C:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\patsy/origin.py__init__Origin.__init__$   s    	
    c                    / nU H=  nUb!  [        U[        5      (       d  UR                  nUc  M,  UR                  U5        M?     U(       d  g[	        U Vs/ s H  oDR
                  PM     sn5      n[        U5      S:X  d   e[        U Vs/ s H  oDR                  PM     sn5      n[        U Vs/ s H  oDR                  PM     sn5      nU " UR                  5       Xg5      $ s  snf s  snf s  snf )a  Class method for combining a set of Origins into one large Origin
that spans them.

Example usage: if we wanted to represent the origin of the "x1:x2"
term, we could do ``Origin.combine([x1_obj, x2_obj])``.

Single argument is an iterable, and each element in the iterable
should be either:

* An Origin object
* ``None``
* An object that has a ``.origin`` attribute which fulfills the above
  criteria.

Returns either an Origin object, or None.
N   )
isinstancer   originappendsetr   lenminr	   maxr
   pop)clsorigin_objsoriginsobjocodesr	   r
   s           r   combineOrigin.combine)   s    $ Cz#v'>'>jj{NN3  W-WVVW-.5zQg.gWWg./'*'Q55'*+599;++	 ..*s   C%C*2C/c                 H    U R                   U R                  U R                   $ )z_Extracts and returns the span of the original code represented by
this Origin. Example: ``x1``.r   r   s    r   relevant_codeOrigin.relevant_codeJ   s     yydhh//r   c                     [        U[        5      =(       aY    U R                  UR                  :H  =(       a9    U R                  UR                  :H  =(       a    U R                  UR                  :H  $ r   )r   r   r   r	   r
   r   others     r   __eq__Origin.__eq__O   sR    uf% &		UZZ'&

ekk)& EII%		
r   c                     X:X  + $ r    r'   s     r   __ne__Origin.__ne__W   s      r   c                 d    [        [        U R                  U R                  U R                  45      $ r   )hashr   r   r	   r
   r#   s    r   __hash__Origin.__hash__Z   s"    VTYY

DHH=>>r   c                     SU-  < U R                   < SSU-  < SU R                  -  < SU R                  U R                  -
  -  < 3$ )zProduces a user-readable two line string indicating the origin of
some code. Example::

  y ~ x1:x2
      ^^

If optional argument 'indent' is given, then both lines will be
indented by this much. The returned string does not have a trailing
newline.
 
^r   )r   indents     r   caretizeOrigin.caretize]   sD     &LII&L$**488djj()
 	
r   c                     SU R                   S U R                   < SU R                   U R                  U R                   < SU R                   U R                  S  < SU R                  < SU R                  < S3$ )Nz<Origin z->z<-z (-z)>r   r#   s    r   __repr__Origin.__repr__p   sT    IIl

#IIdjj488,IIdhhj!JJHH
 	
r   c                     [         er   )NotImplementedErrorr#   s    r   __getstate__Origin.__getstate__z   s    !!r   )r   r
   r	   N)    )__name__
__module____qualname____firstlineno____doc__r   classmethodr    r$   r)   r-   r1   r8   r<   r@   __static_attributes__r,   r   r   r   r      sD    *
 , ,@0

!?
&
"r   c                     [        SSS5      n [        SSS5      nU R                  5       S:X  d   eUR                  5       S:X  d   e[         R                  X/5      nUR                  S:X  d   eUR                  S:X  d   eUR
                  S:X  d   eUR                  SS9S:X  d   eU[        SSS5      :X  d   e " S	 S
[        5      n[         R                  U" U 5      U" 5       S /5      nX@:X  d   e[         R                  U" U 5      U/5      nXR:X  d   e[         R                  U" 5       U" 5       /5      b   eSSKJn  U" [        SSS5      5        g )N012345         z012345
  ^^z012345
    ^)r7   z  012345
    ^^^c                       \ rS rSrSS jrSrg)"test_Origin.<locals>.ObjWithOrigin   Nc                     Xl         g r   r   )r   r   s     r   r   +test_Origin.<locals>.ObjWithOrigin.__init__   s     Kr   rS   r   )rC   rD   rE   rF   r   rI   r,   r   r   ObjWithOriginrP      s    	!r   rU   rB   )assert_no_pickling )	r   r8   r    r   r	   r
   object
patsy.utilrV   )o1o2o3rU   o4o5rV   s          r   test_Originr_   ~   s?   	!Q	B	!Q	B;;=N***;;=O+++		!B77h88q==66Q;;;;a; $7777!Q''''! ! 
r*MOTB	CB8O8	r*B/	0B8O8>>=?MO<=EEE-vb!Q'(r   N)__all__rX   r   r_   r,   r   r   <module>ra      s"    *m"V m"`)r   