← Back
Editing: base.cpython-38.pyc
U �q�[� � @ s� d Z ddlmZmZ ddlZddlmZmZ ddlZddl Z ddl mZmZm Z ddlZddlmZmZmZmZmZmZmZmZmZ ddlmZmZmZmZmZmZ ddl m!Z"m#Z$m%Z& dd l'm(Z(m)Z)m*Z* dd l+m,Z,m-Z- ddl.m/Z0m1Z1 ddl2m3Z3m4Z4 dd l5m6Z6 ddl'm7Z7 ee�e6G dd� d���Z8ee�G dd� de9��Z:ee�e6G dd� d���Z;G dd� de9�Z<eeeeee�G dd� de9��Z=e1�>� �r�ee=e� ee�e6G dd� d���Z?G dd� dej@�ZAG dd� de9�ZBg ZCdS )z8 Very basic functionality for a Reactor implementation. � )�division�absolute_importN)�implementer�classImplements)�heappush�heappop�heapify) �IReactorCore�IReactorTime�IReactorThreads�IResolverSimple�IReactorPluggableResolver�IReactorPluggableNameResolver� IConnector�IDelayedCall�_ISupportsExitSignalCapturing)�fdesc�main�error�abstract�defer�threads)�GAIResolver�ComplexResolverSimplifier�SimpleResolverComplexifier)�log�failure�reflect)�unicode� iteritems)�seconds�platform)�Deferred�DeferredList)� _oldStyle)� threadablec @ sh e Zd ZdZdZefdd�Zdd� Zdd� Zd d � Z dd� Z d d� Zdd� Zdd� Z dd� Zdd� ZdS )�DelayedCallFNc C s\ ||||f\| _ | _| _| _|| _|| _|| _d | _| _d| _ | j rXt�� dd� | _ dS )aR @param time: Seconds from the epoch at which to call C{func}. @param func: The callable to call. @param args: The positional arguments to pass to the callable. @param kw: The keyword arguments to pass to the callable. @param cancel: A callable which will be called with this DelayedCall before cancellation. @param reset: A callable which will be called with this DelayedCall after changing this DelayedCall's scheduled execution time. The callable should adjust any necessary scheduling details to ensure this DelayedCall is invoked at the new appropriate time. @param seconds: If provided, a no-argument callable which will be used to determine the current time any time that information is needed. r N���)�time�func�args�kw�resetter� cancellerr � cancelled�called�delayed_time�debug� traceback�format_stack�creator)�selfr( r) r* r+ �cancel�resetr � r8 �7/usr/lib/python3/dist-packages/twisted/internet/base.py�__init__4 s zDelayedCall.__init__c C s | j | j S )z�Return the time at which this call will fire @rtype: C{float} @return: The number of seconds after the epoch at which this call is scheduled to be made. �r( r0 �r5 r8 r8 r9 �getTimeO s zDelayedCall.getTimec C sL | j rtj�n:| jrtj�n,| �| � d| _ | jr<t| �| _| ` | ` | `dS )z�Unschedule this call @raise AlreadyCancelled: Raised if this call has already been unscheduled. @raise AlreadyCalled: Raised if this call has already been made. � N)r. r �AlreadyCancelledr/ � AlreadyCalledr- r1 �repr�_reprr) r* r+ r<