관리-도구
편집 파일: parser.cpython-311.pyc
� �܋f�� � � � d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl Z ddl mZ ddlm Z mZmZmZmZmZmZmZmZmZ ddlmZ ddlmZ ddlmZ dd lmZmZ dd l m!Z!m"Z" ddl#m$Z$ ddl%m&Z&m'Z'm(Z( G d � d� � Z) G d� d� � Z* G d� d ej+ dd� � � � Z, G d� de&� � Z-ee'eeee. ee. f f Z/ G d� d� � Z0 G d� de0� � Z1 G d� de0� � Z2 G d� de0� � Z3 G d� d e0� � Z4 G d!� d"ej5 � � Z6d7d'�Z7 G d(� d)� � Z8d*gZ9d8d.�Z:de;fd9d6�Z<dS ):zCode parsing for coverage.py.� )�annotationsN)�CodeType) �cast�Any�Callable�Dict�Iterable�List�Optional�Sequence�Set�Tuple)�env)�code_objects)�short_stack)�NoSource� NotPython)� join_regex� nice_pair)�generate_tokens)�Protocol�TArc�TLineNoc �~ � e Zd ZdZ d%d&d �Zd'd �Zd(d�Zd)d�Zd*d�Zd+d�Z d,d�Z d(d�Zd-d�Zd(d�Z d.d�Z d/d0d$�ZdS )1�PythonParserz�Parse code to find executable lines, excluded lines, etc. This information is all based on static analysis: no code execution is involved. N�text� Optional[str]�filename�exclude�return�Nonec �D � |s|s J d� � �|pd| _ |�|| _ nJddlm} || j � � | _ n-# t $ r }t d| j � d|� �� � |�d}~ww xY w|| _ | j � d� � | _ t � � | _ t � � | _ t � � | _ t � � | _ t � � | _ t � � | _ d | _ i | _ d| _ d| _ dS ) z� Source can be provided as `text`, the text itself, or `filename`, from which the text will be read. Excluded lines are those that match `exclude`, a regex string. z*PythonParser needs either text or filenamez<code>Nr )�get_python_sourcezNo source for code: 'z': � F)r r �coverage.pythonr# �OSErrorr r �split�lines�set� statements�excluded�raw_statements�raw_excluded� raw_classdefs�raw_docstrings�show_tokens� _multiline� _all_arcs�_missing_arc_fragments)�selfr r r r# �errs �b/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib64/python3.11/site-packages/coverage/parser.py�__init__zPythonParser.__init__% sJ � � �M�x�M�M�!M�M�M�� �,�H�� ���!�D�I�I�9�9�9�9�9�9� Y�-�-�d�m�<�<�� � ��� Y� Y� Y��N�t�}�N�N��N�N�O�O�UX�X����� Y���� ��� !%� ���� 5� 5�� � ),����� '*�e�e�� � -0�E�E��� +.�%�%��� ,/�5�5��� -0�E�E��� !��� 35��� /3���?C��#�#�#s �? � A)� A$�$A)�regexes�str�Set[TLineNo]c �� � t |� � }t j |� � }t � � }t | j d�� � D ]/\ }}|� |� � r|� |� � �0|S )z�Find the lines matching one of a list of regexes. Returns a set of line numbers, the lines that contain a match for one of the regexes in `regexes`. The entire line needn't match, just a part of it. � ��start)r �re�compiler) � enumerater( �search�add)r4 r8 �combined�regex_c�matches�i�ltexts r6 �lines_matchingzPythonParser.lines_matchinge st � � �g�&�&���*�X�&�&���%�%��!�$�*�A�6�6�6� � �H�A�u��~�~�e�$�$� ����A������� c �& � | j r| � | j � � | _ d}d}d}d}t j }d}d}d}d} | j �J �t | j � � } | D �],\ }}\ } }\ }}}| j rJt t j � ||� � d�dt | |f� � d�d|d�d|��� � |t j k r|d z }�na|t j k r|d z }�nJ|t j k r"|d k r| j � | � � �n|t j k r�|dk r6| dk r0|| j v p|}|s"|r | j � |� � |}d}d}n�|dk r*|r(|| j v rd}|r| j � |� � n�|d v r| d z } n�|dv r| d z } n�|t j k r<|t j k r,| j � t+ | |d z � � � � n<|t j k r,|�&||k r t+ ||d z � � D ]}|| j |<