Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/jedi/api/refactoring/__pycache__/extract.cpython-39.pyc
Ðазад
a j�hm6 � @ s d dl mZ d dlmZ d dlmZ d dlmZ d dlm Z m Z d dlmZ d dl mZmZ dZe d �� Zd d� Zdd � Zdd� Zd1dd�Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd � Zd!d"� Zd#d$� Zd%d&� Z d'd(� Z!d)d*� Z"d+d,� Z#d-d.� Z$d/d0� Z%dS )2� )�dedent)�split_lines)�debug)�RefactoringError)�Refactoring�EXPRESSION_PARTS)�indent_block)�function_is_classmethod�function_is_staticmethod�Zsuite� file_inputz_atom testlist_star_expr testlist test lambdef lambdef_nocond keyword name number string fstringc C s\ t |||�}t�d|� t|�\}}|s0t|��|d t|� } |t||| |�i} t| | �S )NzExtracting nodes: %s� = )�_find_nodesr Zdbg�_is_expression_with_errorr �_expression_nodes_to_string�_replacer )�inference_state�path�module_node�name�pos� until_pos�nodes� is_expression�messageZgenerated_code�file_to_node_changes� r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/jedi/api/refactoring/extract.py�extract_variable s r c C s: t dd� | D ��rdS | d jtvr6dd| d j fS dS )z8 Returns a tuple (is_expression, error_string). c s s | ]}|j d ko|�� V qdS )r N)�type� is_definition)�.0�noder r r � <genexpr># � z,_is_expression_with_error.<locals>.<genexpr>)Fz,Cannot extract a name that defines somethingr FzCannot extract a "%s")T� )�anyr �_VARIABLE_EXCTRACTABLE�r r r r r s r c C s* | j |dd�}|du r||jdkr>|�� }|dur>|j|kr>|}t|�rL|j}|jjdkr`|jj}|jjtv rt|j}q`|g}n�|j|kr�|�� }|dur�|}t|�r�|j}| j |dd�}|j|kr�|�� }|du r�t d��|}|j|jk r�|j}q�t |||�}t|�dk�r&|jdv �r&|d jd gS |S ) zd Looks up a module and tries to find the appropriate amount of nodes that are in there. T)Zinclude_prefixesN�operator�trailerz!Cannot extract anything from that� )�return_stmtZ yield_exprr ) Zget_leaf_for_positionr � get_next_leaf� start_pos�_is_not_extractable_syntax�parentr �end_posZget_previous_leafr �!_remove_unwanted_expression_nodes�len�children)r r r Z start_nodeZ next_leafr Zend_leaf�parent_noder r r r + s>