← Back
Editing: inputtransformer2.cpython-311.pyc
� �@�c�n � � � d Z ddlZddlZddlmZmZ ddlZddlZddlm Z m Z mZmZ ddl Z ej d� � Zd� Zd� Z G d� d � � Z e ej d � � ej d� � �� � Z e ej d ej � � � � Zd� Zdee fd�Zdefd�Zde eef defd�Z G d� d� � Z G d� de� � Z G d� de� � ZdZdZdZ dZ!d Z"d!Z#d"Z$d#Z%d$Z&h d%�Z'ddhZ(d&� Z)d'� Z*d(� Z+d)� Z,d*� Z-d+� Z.d,� Z/ed-j0 ed.j0 e e*e!e+e"e,e$e-e%e.e&e/iZ1 G d/� d0e� � Z2 ej d1ej � � Z3 G d2� d3e� � Z4d4e e5 fd5�Z6d6e ej7 fd7�Z8d8e5fd9�Z9d:Z: G d;� d<� � Z;d=� Z< G d>� d?e� � Z= G d@� dAe� � Z>ej? Z@ e>e@�B� � ZAdS )Ca5 Input transformer machinery to support IPython special syntax. This includes the machinery to recognise and transform ``%magic`` commands, ``!system`` commands, ``help?`` querying, prompt stripping, and so forth. Added: IPython 7.0. Replaces inputsplitter and inputtransformer which were deprecated in 7.0. � N)�CommandCompiler�Compile)�List�Tuple�Optional�Anyz^[ \t]+c �| � | s| S t | � � D ]'\ }}|r |� � � s| |d� c S �(| S )zyRemove leading empty lines If the leading lines are empty or contain only whitespace, they will be removed. N)� enumerate�isspace)�lines�i�lines �@/usr/lib/python3/dist-packages/IPython/core/inputtransformer2.py�leading_empty_linesr s] � � � ����U�#�#� � ���4�� ������ �����9������L� c � ��� | s| S t � | d � � }|s| S |� d� � �t �� � ���fd�| D � � S )z�Remove leading indentation. If the first line starts with a spaces or tabs, the same whitespace will be removed from each following line in the cell. r c �R �� g | ]#}|� �� � r |�d � n|��$S �N)� startswith)�.0�l�n�spaces ��r � <listcomp>z"leading_indent.<locals>.<listcomp>1 sF �� � � � �� �\�\�%�(�(�/�A�a�b�b�E�E�a� � � r )� _indent_re�match�group�len)r �mr r s @@r �leading_indentr $ s� ��� � � �������q��"�"�A�� ��� �G�G�A�J�J�E��E� � �A�� � � � ��� � � r c �&