Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/twisted/_threads/test/__pycache__/test_threadworker.cpython-39.pyc
Ðазад
a k�h1 � @ s� d Z ddlZddlZddlmZmZ ddlmZ ddlm Z m Z mZ G dd� de�Z G d d � d e�ZG dd� d�ZG d d� d�ZG dd� d�ZG dd� de�ZG dd� de�ZdS )z. Tests for L{twisted._threads._threadworker}. � N)�ThreadError�local)�SynchronousTestCase� )�AlreadyQuit� LockWorker�ThreadWorkerc @ s e Zd ZdZdS )�FakeQueueEmptyz8 L{FakeQueue}'s C{get} has exhausted the queue. N��__name__� __module__�__qualname__�__doc__� r r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/twisted/_threads/test/test_threadworker.pyr s r c @ s e Zd ZdZdS )� WouldDeadlockzf If this were a real lock, you'd be deadlocked because the lock would be double-acquired. Nr r r r r r s r c @ s e Zd ZdZdd� Zdd� ZdS )� FakeThreadz� A fake L{threading.Thread}. @ivar target: A target function to run. @type target: L{callable} @ivar started: Has this thread been started? @type started: L{bool} c C s || _ d| _dS )z7 Create a L{FakeThread} with a target. FN)�target�started)�selfr r r r �__init__) s zFakeThread.__init__c C s d| _ dS )z) Set the "started" flag. TN)r �r r r r �start0 s zFakeThread.startN)r r r r r r r r r r r s r c @ s( e Zd ZdZdd� Zdd� Zdd� ZdS ) � FakeQueuez� A fake L{Queue} implementing C{put} and C{get}. @ivar items: A lit of items placed by C{put} but not yet retrieved by C{get}. @type items: L{list} c C s g | _ dS )z( Create a L{FakeQueue}. N)�itemsr r r r r @ s zFakeQueue.__init__c C s | j �|� dS )zv Put an item into the queue for later retrieval by L{FakeQueue.get}. @param item: any object N)r �append)r �itemr r r �putF s z FakeQueue.putc C s | j st� �| j �d�S )zR Get an item. @return: an item previously put by C{put}. r )r r �popr r r r �getN s z FakeQueue.getN)r r r r r r r r r r r r 7 s r c @ s( e Zd ZdZdd� Zdd� Zdd� ZdS ) �FakeLockzi A stand-in for L{threading.Lock}. @ivar acquired: Whether this lock is presently acquired. c C s d| _ dS )z9 Create a lock in the un-acquired state. FN)�acquiredr r r r r ` s zFakeLock.__init__c C s | j rt� �d| _ dS )zX Acquire the lock. Raise an exception if the lock is already acquired. TN)r! r r r r r �acquiref s zFakeLock.acquirec C s | j st� �d| _ dS )zf Release the lock. Raise an exception if the lock is not presently acquired. FN)r! r r r r r �releasen s zFakeLock.releaseN)r r r r r r"