
    yh              	          S SK r S SKrS SKJr  S SKJr  S SKJrJrJ	r	  Sr
 " S S\5      rSS\S	\S
\\   4S jjr SS\	\\4   S\S\S
\4S jjrS
\4S jr " S S\5      r\ " S S\5      5       rS
\4S jrSS\S
\4S jjrg)    N)literal_eval)total_ordering)
NamedTupleSequenceUnion)   u    u    c                   4    \ rS rSr% \\S'   \\S'   \\S'   Srg)Version   majorminormicro N__name__
__module____qualname____firstlineno__int__annotations____static_attributes__r       cc:\Users\julio\OneDrive\Documentos\Trabajo\IdeasFrscas\Cabanna\env\Lib\site-packages\parso/utils.pyr   r      s    JJJr   r   stringkeependsreturnc                    U(       a  U R                  S5      n/ n[        U5       H(  u  pE US   nU[        ;   a  UR                  U5        M(  M*     [        U5       H  n X'   X'S-      -   X''   X'S-   	 M     U R                  S5      (       d  U R                  S5      (       d  U S:X  a  UR                  S5        U$ [        R                  " SU 5      $ ! [         a     M  f = f! [         a     M  f = f)a  
Intended for Python code. In contrast to Python's :py:meth:`str.splitlines`,
looks at form feeds and other special characters as normal text. Just
splits ``\n`` and ``\r\n``.
Also different: Returns ``[""]`` for an empty string input.

In Python 2.7 form feeds are used as normal characters when using
str.splitlines. However in Python 3 somewhere there was a decision to split
also on form feeds.
T   
 z
\n|\r\n|\r)	
splitlines	enumerate_NON_LINE_BREAKSappend
IndexErrorreversedendswithresplit)r   r    lstmergeilinelast_chrindexs           r   split_linesr7      s     %  ~GA$8 //LLO 0 & e_E Z#ai.8
	N % ??4  FOOD$9$9Vr\JJrN
xxv..-     s#   C!C%
C"!C"%
C32C3sourceencodingerrorsc                    ^ ^ UU 4S jn[        T [        5      (       a  T $ U" 5       m [        T TU5      $ ! [         a    US:X  a  [        T SU5      s $ e f = f)a5  
Checks for unicode BOMs and PEP 263 encoding declarations. Then returns a
unicode object like in :py:meth:`bytes.decode`.

:param encoding: See :py:meth:`bytes.decode` documentation.
:param errors: See :py:meth:`bytes.decode` documentation. ``errors`` can be
    ``'strict'``, ``'replace'`` or ``'ignore'``.
c                  >  > [        S5      n TR                  U 5      (       a  g[        R                  " ST5      R	                  S5      n[        R
                  " SU5      nU(       a5  UR	                  S5      n[        U[        5      (       d  [        USS5      nU$ T$ )	z
For the implementation of encoding definitions in Python, look at:
- http://www.python.org/dev/peps/pep-0263/
- http://docs.python.org/2/reference/lexical_analysis.html#encoding-declarations
zb'\xef\xbb\xbf'utf-8s   (?:[^\r\n]*(?:\r\n|\r|\n)){0,2}r   s   coding[=:]\s*([-\w.]+)r$   asciireplace)r   
startswithr/   matchgroupsearch
isinstancestr)	byte_markfirst_two_linespossible_encodinger9   r8   s       r   detect_encoding0python_bytes_to_unicode.<locals>.detect_encodingT   s     !!34	Y''((#FOUUVWXII&@&57!''*Aa%%7I.H Or   r?   r=   )rD   rE   LookupError)r8   r9   r:   rJ   s   ``  r   python_bytes_to_unicoderM   I   sc    . &# H
68V,, Y
 vw//s   6 AAc            	          SSK Jn   [        R                  " SU 5      n[	        [        U5       VVs/ s H  u  p#US:X  a  UO
[        U5      PM     snn6 $ s  snnf )zT
Returns a namedtuple of parso's version, similar to Python's
``sys.version_info``.
r   )__version__z
[a-z]+|\d+   )parsorO   r/   findallr   r)   r   )rO   tuplr3   xs       r   version_inforU   }   sI    
 "::m[1D4I!q&Qc!f,IJJIs   A
c                   *    \ rS rSr% \\S'   \\S'   Srg)_PythonVersionInfo   r   r   r   Nr   r   r   r   rW   rW      s    JJr   rW   c                   :   ^  \ rS rSrU 4S jrU 4S jrS rSrU =r$ )PythonVersionInfo   c                    > [        U[        5      (       a5  [        U5      S:w  a  [        S5      eU R                  U R
                  4U:  $ [        TU ]  U5        U R                  U R
                  4$ N   z'Can only compare to tuples of length 2.)rD   tuplelen
ValueErrorr   r   super__gt__selfother	__class__s     r   rc   PythonVersionInfo.__gt__   s^    eU##5zQ !JKKJJ

+e33u

DJJ''r   c                    > [        U[        5      (       a5  [        U5      S:w  a  [        S5      eU R                  U R
                  4U:H  $ [        TU ]  U5        g r]   )rD   r_   r`   ra   r   r   rb   __eq__rd   s     r   rj   PythonVersionInfo.__eq__   sK    eU##5zQ !JKKJJ

+u44ur   c                 .    U R                  U5      (       + $ N)rj   )re   rf   s     r   __ne__PythonVersionInfo.__ne__   s    ;;u%%%r   r   )	r   r   r   r   rc   rj   rn   r   __classcell__)rg   s   @r   rZ   rZ      s    (& &r   rZ   c                    [         R                  " SU 5      nUc  [        S5      e[        UR	                  S5      5      nUR	                  S5      nUc  US:X  a  SnOUS:X  a  SnO[        S5      e[        U5      n[        X#5      $ )	Nz-(\d+)(?:\.(\d{1,2})(?:\.\d+)?)?((a|b|rc)\d)?$zNThe given version is not in the right format. Use something like "3.8" or "3".r$   r^   7rP   6z7Sorry, no support yet for those fancy new/old versions.)r/   rA   ra   r   rB   NotImplementedErrorrZ   )versionrA   r   r   s       r   _parse_versionrv      s    HHEwOE} < = 	= AEKKNE} A:EaZE%&_``JEU**r   ru   c                     U c  S[         R                  SS -  n [        U [        5      (       d  [	        S5      e[        U 5      $ )z
Checks for a valid version number (e.g. `3.8` or `3.10.1` or `3`) and
returns a corresponding version info that is always two characters long in
decimal.
Nz%s.%sr^   z#version must be a string like "3.8")sysrU   rD   rE   	TypeErrorrv   )ru   s    r   parse_version_stringrz      sD     C,,Ra00gs##=>>'""r   )F)r=   strictrm   )r/   rx   astr   	functoolsr   typingr   r   r   r*   r   rE   boolr7   bytesrM   rU   rW   rZ   rv   rz   r   r   r   <module>r      s    	 
  $ . .

 j )/ )/t )/ )/Z GO1#u*1),1@C11hKg K 
 &* & &*+0 +*## #1B #r   