U
    üS‚gõ  ã                   @   sh   d dl mZ d dlmZmZ eZG dd„ deƒZdZda	dd„ Z
d	d
„ Zdd„ Zd dlmZ eeƒ dS )é    )Ú__version__)ÚIFailedFutureÚILoggerc                   @   s   e Zd ZdZdZdS )Ú_Configa¡  
    This holds all valid configuration options, accessed as
    class-level variables. For example, if you were using asyncio:

    .. sourcecode:: python

        txaio.config.loop = asyncio.get_event_loop()

    ``loop`` is populated automatically (while importing one of the
    framework-specific libraries) but can be changed before any call
    into this library. Currently, it's only used by :meth:`call_later`
    If using asyncio, you must set this to an event-loop (by default,
    we use asyncio.get_event_loop). If using Twisted, set this to a
    reactor instance (by default we "from twisted.internet import
    reactor" on the first call to call_later)
    N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Zloop© r
   r
   ú2/tmp/pip-unpacked-wheel-sq6lz6tf/txaio/__init__.pyr   &   s   r   )!Zwith_configÚusing_twistedÚusing_asyncioÚuse_twistedÚuse_asyncioÚconfigZcreate_futureZcreate_future_successZcreate_future_errorZcreate_failureZ	as_futureZ	is_futureÚrejectÚresolveÚcancelZadd_callbacksZgatherZ	is_calledZ
call_laterZfailure_messageZfailure_tracebackZfailure_format_tracebackZmake_batched_timerZmake_loggerZstart_loggingZset_global_log_levelZget_global_log_levelZadd_log_categoriesr   r   ÚsleepÚtime_nsÚperf_counter_nsNc                  C   sN   t d k	rt dkrtd t ¡ƒ‚da ddlm}  t| ƒ dd l}d|_d|_d S )NZtwistedúExplicitly using '{}' alreadyr   )ÚtxTF)Ú_explicit_frameworkÚRuntimeErrorÚformatÚtxaior   Ú_use_frameworkr   r   )r   r   r
   r
   r   r   k   s    r   c                  C   sN   t d k	rt dkrtd t ¡ƒ‚da ddlm}  t| ƒ dd l}d|_d|_d S )NZasyncior   r   )ÚaioFT)r   r   r   r   r   r   r   r   )r   r   r
   r
   r   r   w   s    r   c                 C   s2   ddl }tD ] }|dkrqt||t| |ƒƒ qdS )zc
    Internal helper, to set this modules methods to a specified
    framework helper-methods.
    r   N)r   r   )r   Ú__all__ÚsetattrÚgetattr)Úmoduler   Úmethod_namer
   r
   r   r   ƒ   s
    r   )Ú_unframework)Ztxaio._versionr   Ztxaio.interfacesr   r   ÚversionÚobjectr   r   r   r   r   r   r   r$   r
   r
   r
   r   Ú<module>   s   -