D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
usr
/
lib
/
python3.6
/
site-packages
/
pip
/
_vendor
/
urllib3
/
util
/
Filename :
wait.py
back
Copy
from .selectors import ( HAS_SELECT, DefaultSelector, EVENT_READ, EVENT_WRITE ) def _wait_for_io_events(socks, events, timeout=None): """ Waits for IO events to be available from a list of sockets or optionally a single socket if passed in. Returns a list of sockets that can be interacted with immediately. """ if not HAS_SELECT: raise ValueError('Platform does not have a selector') if not isinstance(socks, list): # Probably just a single socket. if hasattr(socks, "fileno"): socks = [socks] # Otherwise it might be a non-list iterable. else: socks = list(socks) with DefaultSelector() as selector: for sock in socks: selector.register(sock, events) return [key[0].fileobj for key in selector.select(timeout) if key[1] & events] def wait_for_read(socks, timeout=None): """ Waits for reading to be available from a list of sockets or optionally a single socket if passed in. Returns a list of sockets that can be read from immediately. """ return _wait_for_io_events(socks, EVENT_READ, timeout) def wait_for_write(socks, timeout=None): """ Waits for writing to be available from a list of sockets or optionally a single socket if passed in. Returns a list of sockets that can be written to immediately. """ return _wait_for_io_events(socks, EVENT_WRITE, timeout)
Name
Size
Last Modified
Owner
Permissions
Actions
__pycache__
Dir
May 29 2024 3:41:23
root
0755
__init__.py
1.02
KB
April 06 2024 1:40:45
root
0644
connection.py
4.138
KB
April 06 2024 1:40:45
root
0644
request.py
3.618
KB
April 06 2024 1:40:45
root
0644
response.py
2.288
KB
April 06 2024 1:40:45
root
0644
retry.py
14.75
KB
April 06 2024 1:40:45
root
0644
selectors.py
20.651
KB
April 06 2024 1:40:45
root
0644
ssl_.py
11.928
KB
April 06 2024 1:40:45
root
0644
timeout.py
9.528
KB
April 06 2024 1:40:45
root
0644
url.py
6.639
KB
April 06 2024 1:40:45
root
0644
wait.py
1.417
KB
April 06 2024 1:40:45
root
0644
2017 © D7net | D704T team