Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/parso/python/__pycache__/tree.cpython-39.pyc
Ðазад
a e�hj� � @ s� d Z ddlZzddlmZ W n ey: ddlmZ Y n0 ddlmZ ddlm Z m Z mZmZm Z mZ ddlmZ ddlmZ eg d��Zed d g�eB Zeg d��eB Zeg d��Zed dg�ZG dd� d�ZG dd� d�ZG dd� dee�ZG dd� de�ZG dd� dee �ZG dd� dee �ZG dd� dee�ZG dd� de e�Z G dd � d e�Z!G d!d"� d"e�Z"G d#d$� d$e�Z#G d%d&� d&e�Z$G d'd(� d(e$�Z%G d)d*� d*e$�Z&G d+d,� d,e�Z'G d-d.� d.e�Z(G d/d0� d0e�Z)G d1d2� d2�Z*G d3d4� d4ee*�Z+G d5d6� d6ee*�Z,G d7d8� d8ee�Z-G d9d:� d:e-�Z.G d;d<� d<e�Z/G d=d>� d>e-�Z0G d?d@� d@e0�Z1dAdB� Z2G dCdD� dDe0�Z3G dEdF� dFe3�Z4G dGdH� dHe�Z5G dIdJ� dJe5�Z6G dKdL� dLe5�Z7G dMdN� dNe5�Z8G dOdP� dPe5�Z9G dQdR� dRe5�Z:G dSdT� dTe�Z;G dUdV� dVe;�Z<G dWdX� dXe;�Z=G dYdZ� dZe�Z>G d[d\� d\e>�Z?G d]d^� d^e>�Z@G d_d`� d`e>�ZAG dadb� dbe�ZBdcdd� ZCG dedf� dfee�ZDG dgdh� dhe�ZEG didj� dje�ZFG dkdl� dle�ZGeGZHG dmdn� dne�ZIdS )oa This is the syntax tree for Python 3 syntaxes. The classes represent syntax elements like functions and imports. All of the nodes can be traced back to the `Python grammar file <https://docs.python.org/3/reference/grammar.html>`_. If you want to know how a tree is structured, just analyse that file (for each Python version it's a bit different). There's a lot of logic here that makes it easier for Jedi (and other libraries) to deal with a Python syntax tree. By using :py:meth:`parso.tree.NodeOrLeaf.get_code` on a module, you can get back the 1-to-1 representation of the input given to the parser. This is important if you want to refactor a parser tree. >>> from parso import parse >>> parser = parse('import os') >>> module = parser.get_root_node() >>> module <Module: @1-1> Any subclasses of :class:`Scope`, including :class:`Module` has an attribute :attr:`iter_imports <Scope.iter_imports>`: >>> list(module.iter_imports()) [<ImportName: import os@1,0>] Changes to the Python Grammar ----------------------------- A few things have changed when looking at Python grammar files: - :class:`Param` does not exist in Python grammar files. It is essentially a part of a ``parameters`` node. |parso| splits it up to make it easier to analyse parameters. However this just makes it easier to deal with the syntax tree, it doesn't actually change the valid syntax. - A few nodes like `lambdef` and `lambdef_nocond` have been merged in the syntax tree to make it easier to do deal with them. Parser Tree Classes ------------------- � N)�Mapping)�Tuple)�Node�BaseNode�Leaf� ErrorNode� ErrorLeaf�search_ancestor)�split_prefix)�split_lines)�if_stmt� while_stmt�for_stmt�try_stmt� with_stmtZ async_stmt�suiter �simple_stmt)r r � decorated� async_funcdef) � expr_stmt� sync_comp_forr r �import_name�import_from�paramZdel_stmt�namedexpr_testr r c @ s e Zd ZdZdd� ZdS )�DocstringMixin� c C s� | j dkr| jd }nb| j dv rL| j| j�d�d }|j dkrx|jd }n,| j}|jj}|�|�}|sldS ||d }|j dkr�|jd }|j d kr�|S dS ) zN Returns the string leaf of a docstring. e.g. ``r'''foo'''``. � file_inputr ��funcdef�classdef�:� r Nr �string)�type�children�index�parent)�self�noder �cr&