File: //home/arjun/projects/env/lib/python3.10/site-packages/flake8/__pycache__/processor.cpython-310.pyc
o
%we�@ � @ sJ d Z ddlmZ ddlZddlZddlZddlZddlmZ ddlm Z ddlm
Z
ddlmZ ddlm
Z
dd lmZ dd
lmZ ddlmZ ddlmZ e�e�Zeejejg�Zeejejejejg�Ze
eeeeef f Zee
e e
e ef Z G d
d� d�Z!d%dd�Z"d%dd�Z#d%dd�Z$d&dd�Z%d'd d!�Z&d(d#d$�Z'dS ))zFModule containing our file processor that tokenizes a file for checks.� )�annotationsN)�Any)� Generator)�List)�Tuple)�defaults)�utils)�FSTRING_END)�FSTRING_MIDDLE)�LoadedPluginc @ s e Zd ZdZdZ dSdTdd
�ZedUdd��ZdVdd�ZdWdd�Z dXdd�Z
dXdd�ZdXdd�ZdYd"d#�Z
dZd&d'�ZdXd(d)�Zd[d+d,�Zd\d.d/�Zd]d1d2�Zd^d7d8�Zd_d:d;�Zd`d?d@�ZdadCdD�ZdbdEdF�ZdcdHdI�ZdcdJdK�ZdcdLdM�ZdddOdP�ZdXdQdR�ZdS )e�
FileProcessora= Processes a file and holds state.
This processes a file by generating tokens, logical and physical lines,
and AST trees. This also provides a way of passing state about the file
to checks expecting that state. Any public attribute on this object can
be requested by a plugin. The known public attributes are:
- :attr:`blank_before`
- :attr:`blank_lines`
- :attr:`checker_state`
- :attr:`indent_char`
- :attr:`indent_level`
- :attr:`line_number`
- :attr:`logical_line`
- :attr:`max_line_length`
- :attr:`max_doc_length`
- :attr:`multiline`
- :attr:`noqa`
- :attr:`previous_indent_level`
- :attr:`previous_logical`
- :attr:`previous_unindented_logical_line`
- :attr:`tokens`
- :attr:`file_tokens`
- :attr:`total_lines`
- :attr:`verbose`
FN�filename�str�options�argparse.Namespace�lines�list[str] | None�return�Nonec C s� || _ || _|dur|n| �� | _| �� d| _d| _i | _i | _|j | _ d| _
d| _|j| _d| _
d| _|j| _|j| _d| _d| _d| _d| _g | _t| j�| _|j| _ddi| _d| _d| _d| _dS )z]Initialize our file processor.
:param filename: Name of the file to process
Nr � F�
logical lines���)r r
�
read_linesr �
strip_utf_bom�blank_before�blank_lines�_checker_states�
checker_state�hang_closing�indent_char�indent_level�indent_size�line_number�logical_line�max_line_length�max_doc_length� multiline�previous_indent_level�previous_logical� previous_unindented_logical_line�tokens�len�total_lines�verbose�
statistics�_file_tokens�_noqa_line_mapping�_fstring_start)�selfr
r r � r3 �I/home/arjun/projects/env/lib/python3.10/site-packages/flake8/processor.py�__init__= s6
zFileProcessor.__init__�list[tokenize.TokenInfo]c s2 | j du rt| j�� tt�� fdd���| _ | j S )z-Return the complete set of tokens for a file.Nc s t � �S �N)�nextr3 �� line_iterr3 r4 �<lambda>� s z+FileProcessor.file_tokens.<locals>.<lambda>)r/ �iterr �list�tokenize�generate_tokens�r2 r3 r9 r4 �file_tokensz s
�zFileProcessor.file_tokens�lineno�intc C s
|| _ dS )z#Signal the beginning of an fstring.N)r1 )r2 rB r3 r3 r4 �
fstring_start� �
zFileProcessor.fstring_start�token�tokenize.TokenInfo�Generator[str, None, None]c c sj � |j tkr
| j}n|jd }d| _|| _t||jd �D ]}| j| jd V | jd7 _qd| _dS )z0Iterate through the lines of a multiline string.r T� FN) �typer r1 �startr&