Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/IPython/core/__pycache__/compilerop.cpython-39.pyc
Ðазад
a o�h2 � @ s� d Z ddlZddlmZ ddlZddlZddlZddlZddlZddl Z ddl mZ e�ej dd� ejD ��Zd dd�ZG d d � d ej�Zdd� ZdS )z�Compiler tools with improved interactive support. Provides compilation machinery similar to codeop, but with caching support so we can provide interactive tracebacks. Authors ------- * Robert Kern * Fernando Perez * Thomas Kluyver � N)� PyCF_ONLY_AST)�contextmanagerc c s | ]}t t|�jV qd S �N)�getattr� __future__� compiler_flag)�.0�fname� r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/IPython/core/compilerop.py� <genexpr>/ s �r c C s( t �| �d���� }d�||dd� �S )zf Compute a (probably) unique name for code for caching. This now expects code to be unicode. zutf-8z<ipython-input-{0}-{1}>N� )�hashlib�sha1�encode� hexdigest�format)�code�numberZhash_digestr r r � code_name6 s r c @ s\ e Zd ZdZdd� Zddd�Zdd � Zed d� �Zdd � Z dd� Z ddd�Zedd� �Z dS )�CachingCompilerzFA compiler that caches code compiled from interactive statements. c C s t j�| � i | _d S r )�codeop�Compile�__init__� _filename_map��selfr r r r I s zCachingCompiler.__init__� <unknown>�execc C s t |||| jtB d�S )z�Parse code to an AST with the current compiler flags active. Arguments are exactly the same as ast.parse (in the standard library), and are passed to the built-in compile function.� )�compile�flagsr )r �source�filename�symbolr r r � ast_parseQ s zCachingCompiler.ast_parsec C s t j| _dS )z&Reset compiler flags to default state.N)r ZPyCF_DONT_IMPLY_DEDENTr! r r r r �reset_compiler_flagsX s z$CachingCompiler.reset_compiler_flagsc C s | j S )z;Flags currently active in the compilation process. �r! r r r r �compiler_flags^ s zCachingCompiler.compiler_flagsc C s t ||�S )a� Compute filename given the code, and the cell number. Parameters ---------- raw_code : str The raw cell code. transformed_code : str The executable Python source code to cache and compile. number : int A number which forms part of the code's name. Used for the execution counter. Returns ------- The computed filename. )r )r �raw_code�transformed_coder r r r � get_code_named s zCachingCompiler.get_code_namec C s || j v rdd| j | fS dS )aN Return a user-friendly label and name for a code block. Parameters ---------- name : str The name for the code block returned from get_code_name Returns ------- A (label, name) pair that can be used in tracebacks, or None if the default formatting should be used. ZCellzIn[%s]N)r )r �namer r r �format_code_namew s z CachingCompiler.format_code_namer Nc C sP |du r|}| � |||�}|| j|<