Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
idna / lib / python2.7 / site-packages / eventlet / hubs / __init__.pyc
Size: Mime:
ó
 ‹EYc@sÔddlZddlmZddlmZmZddddgZejdƒZ	e	j
ƒZd	„Zdd
„Zd„ZddlmZdddejdd
„Zd„Zd„Zdefd„ƒYZdS(iÿÿÿÿN(tpatcher(t	greenletstsixtuse_hubtget_hubtget_default_hubt
trampolinet	threadingcCsªtjdƒ}yddl}|jjSWnztk
r¥yddl}|jjSWq¦tk
r¡t|dƒrˆddl	}|jj
Sddl}|jjSq¦XnXdS(sVSelect the default hub implementation based on what multiplexing
    libraries are installed.  The order that the hubs are tried is:

    * epoll
    * kqueue
    * poll
    * select

    It won't automatically select the pyevent hub, because it's not
    python-thread-safe.

    .. include:: ../doc/common.txt
    .. note :: |internal|
    tselectiÿÿÿÿNtpoll(
Rtoriginalteventlet.hubs.epollsthubstepollstImportErrorteventlet.hubs.kqueuetkqueuethasattrteventlet.hubs.pollR	teventlet.hubs.selectstselects(Rteventlet((sK/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/hubs/__init__.pyR
s


cCs¼|dkr$tjjddƒ}n|dkr<tƒ}nttdƒrTt`nt|t	j
ƒr‘|jƒs~tdƒ‚d|ks–d|krí|jƒj
dƒ\}}}t|tƒtƒ|gƒ}|rŽt||ƒ}qŽq‘t}yddl}Wntk
rd}nX|dk	rcx7|jdd	d
|ƒD]}|jƒt}}PqBWn|s‘td|tƒtƒdgƒ}q‘nt|dƒr¯|jt_n	|t_dS(
s
Use the module *mod*, containing a class called Hub, as the
    event hub. Usually not required; the default hub is usually fine.

    Mod can be an actual module, a string, or None.  If *mod* is a module,
    it uses it directly.   If *mod* is a string and contains either '.' or ':'
    use_hub tries to import the hub using the 'package.subpackage.module:Class'
    convention, otherwise use_hub looks for a matching setuptools entry point
    in the 'eventlet.hubs' group to load or finally tries to import
    `eventlet.hubs.mod` and use that as the hub module.  If *mod* is None,
    use_hub uses the default hub.  Only call use_hub during application
    initialization,  because it resets the hub's state and any existing
    timers or listeners will never be resumed.
    tEVENTLET_HUBthubsNeed to specify a hubt.t:iÿÿÿÿNtgroups
eventlet.hubstnameseventlet.hubs.tHub(tNonetostenvirontgetRRt_threadlocalRt
isinstanceRtstring_typeststriptAssertionErrort	partitiont
__import__tglobalstlocalstgetattrtFalset
pkg_resourcesRtiter_entry_pointstloadtTrueR(tmodt
modulenamet_t	classnametfoundR,tentry((sK/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/hubs/__init__.pyR5s:	

%cCs^y
tj}WnJtk
rYytjWntk
rBtƒnXtjƒ}t_nX|S(sKGet the current event hub singleton object.

    .. note :: |internal|
    (R!RtAttributeErrorRR(R((sK/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/hubs/__init__.pyRis


(ttimeoutcsJd}tƒ}tjƒ‰|jˆk	s6tdƒ‚|o?|sOtdƒ‚y|jƒ}Wntk
rx|}nX|dk	r¬‡fd†}	|j||	|ƒ}nz}|rÜ|j|j	|ˆj
ˆj|ƒ}
n-|r	|j|j|ˆj
ˆj|ƒ}
nz|j
ƒSWd|j
|
ƒXWd|dk	rE|jƒnXdS(s<Suspend the current coroutine until the given socket object or file
    descriptor is ready to *read*, ready to *write*, or the specified
    *timeout* elapses, depending on arguments specified.

    To wait for *fd* to be ready to read, pass *read* ``=True``; ready to
    write, pass *write* ``=True``. To specify a timeout, pass the *timeout*
    argument in seconds.

    If the specified *timeout* elapses before the socket is ready to read or
    write, *timeout_exc* will be raised instead of ``trampoline()``
    returning normally.

    .. note :: |internal|
    s0do not call blocking functions from the mainloops1not allowed to trampoline for reading and writingcsˆj|ƒdS(N(tthrow(texc(tcurrent(sK/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/hubs/__init__.pyt_timeout™sN(RRtgreenlett
getcurrentR%tfilenoR6tschedule_call_globaltaddtREADtswitchR8tWRITEtremovetcancel(tfdtreadtwriteR7ttimeout_exctmark_as_closedttRR>R;tlistener((R:sK/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/hubs/__init__.pyR}s,	

''cCstƒ}|j|ƒdS(sŽ
    A particular file descriptor has been explicitly closed. Register for any
    waiting listeners to be notified on the next run loop.
    N(Rtnotify_close(RFR((sK/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/hubs/__init__.pyRM«s	cCstƒ}|j|ƒdS(sª
    Some file descriptors may be closed 'silently' - that is, by the garbage
    collector, by an external library, etc. When the OS returns a file descriptor
    from an open call (or something similar), this may be the only indication we
    have that the FD has been closed and then recycled.
    We let the hub know that the old file descriptor is dead; any stuck listeners
    will be disabled and notified in turn.
    N(Rtmark_as_reopened(RFR((sK/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/hubs/__init__.pyt
notify_opened´s		tIOClosedcBseZRS((t__name__t
__module__(((sK/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/hubs/__init__.pyRPÁs(RRRteventlet.supportRR<Rt__all__R
RtlocalR!RRRRR7tTimeoutRRMROtIOErrorRP(((sK/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/hubs/__init__.pyt<module>s	(4		,