Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/IPython/utils/__pycache__/tokenutil.cpython-39.pyc
Ðазад
a o�h� � @ s� d Z ddlmZ ddlmZ ddlmZ ddlZddlmZ ddl m Z mZ edg d ��Zd d� Z dee e d�d d�Zddd�Zdeed�dd�ZdS )zToken-related utilities� )� namedtuple)�StringIO)� iskeywordN)� TokenInfo)�List�Optional�Token)�token�text�start�end�linec c s6 zt �| �D ] }|V qW n t jy0 Y dS 0 dS )z'wrap generate_tkens to catch EOF errorsN)�tokenize�generate_tokens� TokenError)�readliner � r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/IPython/utils/tokenutil.pyr s r )�extra_errors_to_catchc # s� g d�}|d u st |t�sJ �||p&g }g }z$t�| �D ]}|�|� |V q:W n� tjy� � zxt� fdd�|D ��r�|r�|d jd |d jd f}|}|d j }nd }}d}t� tjd|||�V n� W Y d � � n d � � 0 0 d S )N)zunterminated string literalzinvalid non-printable characterz!after line continuation characterc 3 s | ]}|� j d v V qdS )r N)�args)�.0�error��excr r � <genexpr>, � z/generate_tokens_catch_errors.<locals>.<genexpr>���r )� r � )� isinstance�listr r �appendr �anyr r r r � ERRORTOKEN) r r Zdefault_errors_to_catchZerrors_to_catch�tokensr r r r r r r �generate_tokens_catch_errors s$ r% c C sR d}| � d�}|D ]2}|t|� }|�d�s4|d7 }||kr@ qJ|}qd}||fS )a� Return the line in a cell at a given cursor position Used for calling line-based APIs that don't support multi-line input, yet. Parameters ---------- cell : str multiline block of text cursor_pos : integer the cursor position Returns ------- (line, offset): (string, integer) The line with the current cursor, and the character offset of the start of the line. r T� r r )� splitlines�len�endswith)�cell� cursor_pos�offset�linesr �next_offsetr r r �line_at_cursor: s r/ )r* r+ c C s� g }g }g }ddi}t t| �j�D �]�}t|� }|j\}} |j\} }| d |vr�|j�d�}t||d �D ](\} }| |vrj|| d t |� || <