
    V.j                         d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZ ddlmZ ddlmZmZ ee	j"                     ZddZddZdd	Zdd
ZddZy)z"Better tokenizing for coverage.py.    )annotationsN)Iterable)env)TLineNoTSourceTokenLinesc           	   #    K   d}d}d}| D ]A  \  }}\  }}\  }}	}
||k7  r|r|j                  d      rd}|j                  d      rd}ny|t        j                  k(  r7|j                  d      r#|j                  d      j                  |      rd}n2d}n/t        j
                  j                  r|t        j                  k(  rd}|rBt        |j                  d	      d
         dz
  }t        j                  dd||f||dz   f|       |
}|t        j                  t        j                  fvr|}t        j                  ||||f||	f|
       |}D yw)aB  Return all physical tokens, even line continuations.

    tokenize.generate_tokens() doesn't return a token for the backslash that
    continues lines.  This wrapper provides those tokens so that we can
    re-create a faithful representation of the original source.

    Returns the same values as generate_tokens()

    N z\
T\Fz \

   i    )endswithtokenSTRINGrstripr   
PYBEHAVIORfstring_syntaxFSTRING_MIDDLElensplittokenize	TokenInfoNEWLINENL)toks	last_linelast_lineno
last_ttextttypettextslinenoscolelinenoecolltextinject_backslashccols                UC:\xampp\htdocs\tradingbinance\backend\.venv\Lib\site-packages\coverage/phystokens.py_phys_tokensr+      sg     !IKJAE=uow'!Y//7  $( &&t,',$ell*!**62%,,W5>>zJ ,0( ,1(^^22u@T@T7T',$#yt4R89A=D",, $ $(+!  I))8;;77J  $QVWWm BFs   EEc                   t               }t        j                  t        j                  |             D ]   }t	        |t        j
                        rR|j                  |j                         |j                  D ]'  }|j                  |j                  j                         ) pt        j                  dk\  r6t	        |t        j                        r|j                  |j                         t        j                  dk\  st	        |t        j                  t        j                  f      s|j                  s|j                  |j                         # |S )zCHelper for finding lines with soft keywords, like match/case lines.)      )r-      )setastwalkparse
isinstanceMatchaddlinenocasespatternsysversion_info	TypeAliasImport
ImportFromis_lazy)sourcesoft_key_linesnodecases       r*   find_soft_key_linesrD   ]   s    #&5N6*+ dCII&t{{+

""4<<#6#67 #(Zcmm-Lt{{+(Zszz3>>>Z-[||""4;;/ ,     c              #  R  K   t         j                  t         j                  t         j                  t        j
                  h}g }d}| j                  d      j                  dd      } t        |       }t        |       }t        |      D ]  \  }}\  }}	\  }
}}
d}t        j                  d|      D ]c  }|dk(  r| g }d}d}nM|dk(  rd}nD||v rd}n<t        j                  j                  rC|t         j                   k(  r0|j                  d	d
      j                  dd      }|	t#        |      z   }|r |	|kD  r|j%                  dd|	|z
  z  f       d}t        j&                  j)                  |d      j+                         dd }|t         j,                  k(  rdt/        j0                  |      rd}nLt/        j2                  |      r7t#        |      dk(  rd}nt#        |      dk(  r|d   d   dk(  rd}nd}|r||v rd}|j%                  ||f       d}d}	f s|} |r| yyw)a  Generate a series of lines, one for each line in `source`.

    Each line is a list of pairs, each pair is a token::

        [('key', 'def'), ('ws', ' '), ('nam', 'hello'), ('op', '('), ... ]

    Each pair has a token class, and the token text.

    If you concatenate all the token texts, and then join them with newlines,
    you should have your original `source` back, with two differences:
    trailing white space is not preserved, and a final line with no newline
    is indistinguishable from a final line with a newline.

    r      z
r   Tz(
)Fr
   {z{{}z}}ws xxNr-   keyr   )r   INDENTDEDENTr   r   r   
expandtabsreplacegenerate_tokensrD   r+   rer   r   r   r   r   r   appendtok_namegetlowerNAMEkeyword	iskeywordissoftkeyword)r@   	ws_tokenslinecoltokgenrA   r!   r"   sliner$   _r&   
mark_startpartmark_end	tok_classis_start_of_lines                    r*   source_token_linesrg   q   s      u||U]]HKKHI"$D
Cq!))&$7FV$F(0N5A&5I1umudYa
HHVU+Dt|
  )# >>00Ue>R>R5R<<T2::3ED#d)+D$*KKsdSj'9 :;!&J$--11%>DDFrJ	EJJ&((/$)	 ..u5t9>/3,!$i1n$q'!*2D/3,/4,+0G(-IY-.DE ,F CM 6JP 
 s   HH'H'c                j    t        j                  |       j                  }t        j                  |      S )zA helper around `tokenize.generate_tokens`.

    Originally this was used to cache the results, but it didn't seem to make
    reporting go faster, and caused issues with using too much memory.

    )ioStringIOreadliner   rR   )textrk   s     r*   rR   rR      s)     {{4 ))H##H--rE   c                z    t        | j                  d            j                  }t        j                  |      d   S )zDetermine the encoding for `source`, according to PEP 263.

    `source` is a byte string: the text of the program.

    Returns a string, the name of the encoding.

    Tr   )iter
splitlines__next__r   detect_encoding)r@   rk   s     r*   source_encodingrr      s5     F%%d+,55H##H-a00rE   )r   
TokenInfosreturnrs   )r@   strrt   zset[TLineNo])r@   ru   rt   r   )rl   ru   rt   rs   )r@   bytesrt   ru   )__doc__
__future__r   r1   ri   rY   rS   r:   r   r   collections.abcr   coverager   coverage.typesr   r   r   rs   r+   rD   rg   rR   rr    rE   r*   <module>r}      sX    ) " 
 	  	 
   $  5h(()
CL(BJ.	1rE   