Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/parso/python/__pycache__/diff.cpython-39.pyc
Ðазад
a e�h�� � @ sX d Z ddlZddlZddlmZ ddlZddlmZ ddlm Z ddl mZ ddlm Z mZ ddlmZ e�e�Zd Zd ZejZejZejZejZejZdd� Zd d� Zdd� Zdd� Zdd� Zdd� Z dd� Z!dd� Z"dd� Z#dd� Z$d4d d!�Z%d"d#� Z&d$d%� Z'd&d'� Z(d(d)� Z)G d*d+� d+e*�Z+d,d-� Z,G d.d/� d/�Z-G d0d1� d1�Z.G d2d3� d3�Z/dS )5aa The diff parser is trying to be a faster version of the normal parser by trying to reuse the nodes of a previous pass over the same file. This is also called incremental parsing in parser literature. The difference is mostly that with incremental parsing you get a range that needs to be reparsed. Here we calculate that range ourselves by using difflib. After that it's essentially incremental parsing. The biggest issue of this approach is that we reuse nodes in a mutable way. The intial design and idea is quite problematic for this parser, but it is also pretty fast. Measurements showed that just copying nodes in Python is simply quite a bit slower (especially for big files >3 kLOC). Therefore we did not want to get rid of the mutable nodes, since this is usually not an issue. This is by far the hardest software I ever wrote, exactly because the initial design is crappy. When you have to account for a lot of mutable state, it creates a ton of issues that you would otherwise not have. This file took probably 3-6 months to write, which is insane for a parser. There is a fuzzer in that helps test this whole thing. Please use it if you make changes here. If you run the fuzzer like:: test/fuzz_diff_parser.py random -n 100000 you can be pretty sure that everything is still fine. I sometimes run the fuzzer up to 24h to make sure everything is still ok. � N)� namedtuple)�split_lines)�Parser)� EndMarker)�PythonToken�BOM_UTF8_STRING)�PythonTokenTypesF)�INDENT�ERROR_DEDENT�DEDENTc C s | j dko| jtv S )N� error_leaf)�type� token_type�_INDENTATION_TOKENS��node� r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/parso/python/diff.py�_is_indentation_error_leaf3 s r c C s | rt | �r| �� } q | S �N)r �get_previous_leaf��leafr r r �!_get_previous_leaf_if_indentation7 s r c C s | rt | �r| �� } q | S r )r � get_next_leafr r r r �_get_next_leaf_if_indentation= s r c C s t | jd �S �N� )�_get_indentation�children�� tree_noder r r �_get_suite_indentationC s r"