← Back
Editing: compilerop.cpython-311.pyc
� �@�c( � �� � d Z ddlZddlmZ ddlZddlZddlZddlZddlZddl Z ddl mZ ej ej d� ej D � � � � Zd d�Z G d� dej � � Zd � 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 # �J K � | ]}t t |� � j V � �d S �N)�getattr� __future__� compiler_flag)�.0�fnames �9/usr/lib/python3/dist-packages/IPython/core/compilerop.py� <genexpr>r / sK � � � � I� I�"'� &�j�%�8�8�F� I� I� I� I� I� I� c � � t j | � 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�number�hash_digests r � code_namer 6 sL � � �,�t�{�{�7�3�3�4�4�>�>�@�@�K� %�+�+�F�K����4D�E�E�Er c �` � e Zd ZdZd� Zd d�Zd� Zed� � � Zd� Z dd�Z ed� � � Zd S )�CachingCompilerzFA compiler that caches code compiled from interactive statements. c � � t j � | � � t t d� � si t _ t t d� � st j t _ t t _ i | _ d S )N�_ipython_cache�_checkcache_ori) �codeop�Compile�__init__�hasattr� linecacher � checkcacher �check_linecache_ipython� _filename_map��selfs r r! zCachingCompiler.__init__I sm � ������%�%�%� �y�"2�3�3� *�')�I�$��y�"3�4�4� =�(1�(<�I�%� 7� �� ����r � <unknown>�execc �B � t |||| j t z 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�symbols r � ast_parsezCachingCompiler.ast_parsed s! � � �v�x����m�1K�Q�O�O�Or c �( � t j | _ dS )z&Reset compiler flags to default state.N)r �PyCF_DONT_IMPLY_DEDENTr. r'