Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/IPython/lib/__pycache__/backgroundjobs.cpython-39.pyc
Ðазад
a o�hJE � @ s� d Z ddlZddlZddlmZ ddlmZ ddlmZm Z G dd� de �ZG dd � d ej�Z G d d� de �ZG dd � d e �ZdS )a Manage background (threaded) jobs conveniently from an interactive shell. This module provides a BackgroundJobManager class. This is the main class meant for public usage, it implements an object which can create and manage new background jobs. It also provides the actual job classes managed by these BackgroundJobManager objects, see their docstrings below. This system was inspired by discussions with B. Granger and the BackgroundCommand class described in the book Python Scripting for Computational Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting (although ultimately no code from this text was used, as IPython's system is a separate implementation). An example notebook is provided in our documentation illustrating interactive use of the system. � N)�get_ipython)�AutoFormattedTB)�error�debugc @ s� e Zd ZdZdd� Zedd� �Zedd� �Zedd � �Zd d� Z dd � Z dd� Zdd� Zdd� Z dd� Zdd� Zd&dd�Zdd� Zdd� Zdd � Zd!d"� Zd'd$d%�Zd#S )(�BackgroundJobManagera� Class to manage a pool of backgrounded threaded jobs. Below, we assume that 'jobs' is a BackgroundJobManager instance. Usage summary (see the method docstrings for details): jobs.new(...) -> start a new job jobs() or jobs.status() -> print status summary of all jobs jobs[N] -> returns job number N. foo = jobs[N].result -> assign to variable foo the result of job N jobs[N].traceback() -> print the traceback of dead job N jobs.remove(N) -> remove (finished) job N jobs.flush() -> remove all finished jobs As a convenience feature, BackgroundJobManager instances provide the utility result and traceback methods which retrieve the corresponding information from the jobs list: jobs.result(N) <--> jobs[N].result jobs.traceback(N) <--> jobs[N].traceback() While this appears minor, it allows you to use tab completion interactively on the job manager instance. c C sN g | _ g | _g | _i | _g | _g | _tj| _tj | _ tj| _tj | _d| _d S )Nr )�_running� _completed�_dead�all�_comp_report�_dead_report�BackgroundJobBase�stat_created_cZ _s_created�stat_running_c� _s_running�stat_completed_c�_s_completed�stat_dead_c�_s_dead�_current_job_id��self� r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/IPython/lib/backgroundjobs.py�__init__I s zBackgroundJobManager.__init__c C s | � � | jS �N)�_update_statusr r r r r �running[ s zBackgroundJobManager.runningc C s | � � | jS r )r r r r r r �dead` s zBackgroundJobManager.deadc C s | � � | jS r )r r r r r r � completede s zBackgroundJobManager.completedc O s� t |�r,|�di �}t|g|�R i |��}nvt|t�r�|sTt�d�}|j|j }}n8t |�dkrn|d }}nt |�dkr�|\}}nt d��t|||�}ntd��|�dd�r�d |_ | j|_| jd7 _| j�|� || j|j<