Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/IPython/core/__pycache__/page.cpython-39.pyc
Ðазад
a o�h�- � @ s< d Z ddlZddlZddlZddlZddlZddlZddlmZ ddlm Z ddl mZ ddlm Z ddlmZ ddlmZ dd lmZ dd lmZ ddlmZ d'd d�Zdd� Ze�d�Zd(dd�Zdd� Zd)dd�Zd*dd�Zd+dd�Z d,dd�Z!dd� Z"ej#d k�r0ej$�%d!d"�d#k�r0ddl&Z&d$d%� Z'nd&d%� Z'dS )-z� Paging capabilities for IPython.core Notes ----- For now this uses IPython hooks, so it can't be in IPython.utils. If we can get rid of that dependency, we could move it there. ----- � N)�UnsupportedOperation)�Path)�get_ipython)�display)�TryNext)�chop)�system)�get_terminal_size)� py3compat� c C sB t | t�r| }n"|r*d�| �� |d� �} d| i}t|dd� dS )z1Just display, no paging. screen_lines is ignored.� N� text/plainT)�raw)� isinstance�dict�join� splitlinesr )�strng�start�screen_lines�data� r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/IPython/core/page.py�display_page$ s r c s � fdd�S )zRWrap a pager func to strip the `self` arg so it can be called as a hook. c s � |i |��S )Nr )�self�args�kwargs�Z page_funcr r �<lambda>4 � zas_hook.<locals>.<lambda>r r r r r �as_hook/ s r z(\x1b[^m]+m)c C s� t | t�r| �dd�} | �� |d� }t||d �}t|�dkrVttj� |d �� npd}|dd� D ]F}tj� |�}t|| � t � s� dS t�|�}t|�dkrf|d }qft|tj� |d � � dS )z�Very dumb 'pager' in Python, for when nothing else works. Only moves forward, same interface as page(), except for pager_cmd and mode. r � N� r ���) r r �getr r �len�print�os�linesepr � page_more�esc_re�findall) r r r Zout_lnZscreensZlast_escape�scrZhunkZesc_listr r r � page_dumb9 s r- c C s� t j�dd�}|dks|dkr(tjdks,| S zddl}ddl}W n tyV | Y S 0 z|�tj �}W n6 |j y� } ztd�|��|�W Y d}~n d}~0 0 z|� � }W n ty� | Y S 0 |�� \}}|�� |�tj |j|� |S )z�Attempt to work out the number of lines on the screen. This is called by page(). It can raise an error (e.g. when run in the test suite), so it's separated out so it can easily be called in a try block. �TERMNZxtermzxterm-colorZsunos5r ztermios error: {0})r'