code stringlengths 66 870k | docstring stringlengths 19 26.7k | func_name stringlengths 1 138 | language stringclasses 1
value | repo stringlengths 7 68 | path stringlengths 5 324 | url stringlengths 46 389 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
def strxor_c(term, c):
"""Return term xored with a sequence of characters c."""
expect_byte_string(term)
if not 0 <= c < 256:
raise ValueError("c must be in range(256)")
result = create_string_buffer(len(term))
_raw_strxor.strxor_c(term, c, result, c_size_t(len(term)))
return get_raw_bu... | Return term xored with a sequence of characters c. | strxor_c | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/Cryptodome/Util/strxor.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/Cryptodome/Util/strxor.py | MIT |
def pycryptodome_filename(dir_comps, filename):
"""Return the complete file name for the module
dir_comps : list of string
The list of directory names in the PyCryptodome package.
The first element must be "Cryptodome".
filename : string
The filename (inclusing extension) in the ta... | Return the complete file name for the module
dir_comps : list of string
The list of directory names in the PyCryptodome package.
The first element must be "Cryptodome".
filename : string
The filename (inclusing extension) in the target directory.
| pycryptodome_filename | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/Cryptodome/Util/_file_system.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/Cryptodome/Util/_file_system.py | MIT |
def ceil_shift(n, b):
"""Return ceil(n / 2**b) without performing any floating-point or division operations.
This is done by right-shifting n by b bits and incrementing the result by 1
if any '1' bits were shifted out.
"""
if not isinstance(n, (int, long)) or not isinstance(b, (int, long)):
... | Return ceil(n / 2**b) without performing any floating-point or division operations.
This is done by right-shifting n by b bits and incrementing the result by 1
if any '1' bits were shifted out.
| ceil_shift | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/Cryptodome/Util/_number_new.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/Cryptodome/Util/_number_new.py | MIT |
def ceil_div(a, b):
"""Return ceil(a / b) without performing any floating-point operations."""
if not isinstance(a, (int, long)) or not isinstance(b, (int, long)):
raise TypeError("unsupported operand type(s): %r and %r" % (type(a).__name__, type(b).__name__))
(q, r) = divmod(a, b)
if r:
... | Return ceil(a / b) without performing any floating-point operations. | ceil_div | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/Cryptodome/Util/_number_new.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/Cryptodome/Util/_number_new.py | MIT |
def exact_log2(num):
"""Find and return an integer i >= 0 such that num == 2**i.
If no such integer exists, this function raises ValueError.
"""
if not isinstance(num, (int, long)):
raise TypeError("unsupported operand type: %r" % (type(num).__name__,))
n = long(num)
if n <= 0:
... | Find and return an integer i >= 0 such that num == 2**i.
If no such integer exists, this function raises ValueError.
| exact_log2 | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/Cryptodome/Util/_number_new.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/Cryptodome/Util/_number_new.py | MIT |
def exact_div(p, d, allow_divzero=False):
"""Find and return an integer n such that p == n * d
If no such integer exists, this function raises ValueError.
Both operands must be integers.
If the second operand is zero, this function will raise ZeroDivisionError
unless allow_divzero is true (defaul... | Find and return an integer n such that p == n * d
If no such integer exists, this function raises ValueError.
Both operands must be integers.
If the second operand is zero, this function will raise ZeroDivisionError
unless allow_divzero is true (default: False).
| exact_div | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/Cryptodome/Util/_number_new.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/Cryptodome/Util/_number_new.py | MIT |
def load_lib(name, cdecl):
"""Load a shared library and return a handle to it.
@name, either an absolute path or the name of a library
in the system search path.
@cdecl, the C function declarations.
"""
lib = ffi.dlopen(name)
ffi.cdef(cdecl)
re... | Load a shared library and return a handle to it.
@name, either an absolute path or the name of a library
in the system search path.
@cdecl, the C function declarations.
| load_lib | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/Cryptodome/Util/_raw_api.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/Cryptodome/Util/_raw_api.py | MIT |
def load_pycryptodome_raw_lib(name, cdecl):
"""Load a shared library and return a handle to it.
@name, the name of the library expressed as a PyCryptodome module,
for instance Cryptodome.Cipher._raw_cbc.
@cdecl, the C function declarations.
"""
split = name.split(".")
dir_comps, ... | Load a shared library and return a handle to it.
@name, the name of the library expressed as a PyCryptodome module,
for instance Cryptodome.Cipher._raw_cbc.
@cdecl, the C function declarations.
| load_pycryptodome_raw_lib | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/Cryptodome/Util/_raw_api.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/Cryptodome/Util/_raw_api.py | MIT |
def __init__(self, listener, locals=None, banner=None, **server_args):
"""
:keyword locals: If given, a dictionary of "builtin" values that will be available
at the top-level.
:keyword banner: If geven, a string that will be printed to each connecting user.
"""
Stream... |
:keyword locals: If given, a dictionary of "builtin" values that will be available
at the top-level.
:keyword banner: If geven, a string that will be printed to each connecting user.
| __init__ | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/backdoor.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/backdoor.py | MIT |
def handle(self, conn, address):
"""
Interact with one remote user.
.. versionchanged:: 1.1b2 Each connection gets its own
``locals`` dictionary. Previously they were shared in a
potentially unsafe manner.
"""
fobj = conn.makefile(mode="rw")
fobj ... |
Interact with one remote user.
.. versionchanged:: 1.1b2 Each connection gets its own
``locals`` dictionary. Previously they were shared in a
potentially unsafe manner.
| handle | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/backdoor.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/backdoor.py | MIT |
def start(self):
"""Start accepting the connections.
If an address was provided in the constructor, then also create a socket,
bind it and put it into the listening mode.
"""
self.init_socket()
self._stop_event.clear()
try:
self.start_accepting()
... | Start accepting the connections.
If an address was provided in the constructor, then also create a socket,
bind it and put it into the listening mode.
| start | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/baseserver.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/baseserver.py | MIT |
def close(self):
"""Close the listener socket and stop accepting."""
self._stop_event.set()
try:
self.stop_accepting()
finally:
try:
self.socket.close()
except Exception:
pass
finally:
self.__... | Close the listener socket and stop accepting. | close | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/baseserver.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/baseserver.py | MIT |
def stop(self, timeout=None):
"""
Stop accepting the connections and close the listening socket.
If the server uses a pool to spawn the requests, then
:meth:`stop` also waits for all the handlers to exit. If there
are still handlers executing after *timeout* has expired
... |
Stop accepting the connections and close the listening socket.
If the server uses a pool to spawn the requests, then
:meth:`stop` also waits for all the handlers to exit. If there
are still handlers executing after *timeout* has expired
(default 1 second, :attr:`stop_timeout`),... | stop | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/baseserver.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/baseserver.py | MIT |
def serve_forever(self, stop_timeout=None):
"""Start the server if it hasn't been already started and wait until it's stopped."""
# add test that serve_forever exists on stop()
if not self.started:
self.start()
try:
self._stop_event.wait()
finally:
... | Start the server if it hasn't been already started and wait until it's stopped. | serve_forever | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/baseserver.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/baseserver.py | MIT |
def __import__(*args, **kwargs):
"""
__import__(name, globals=None, locals=None, fromlist=(), level=0) -> object
Normally python protects imports against concurrency by doing some locking
at the C level (at least, it does that in CPython). This function just
wraps the normal __import__ functionali... |
__import__(name, globals=None, locals=None, fromlist=(), level=0) -> object
Normally python protects imports against concurrency by doing some locking
at the C level (at least, it does that in CPython). This function just
wraps the normal __import__ functionality in a recursive lock, ensuring that
... | __import__ | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/builtins.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/builtins.py | MIT |
def _python_callback(handle, revents):
"""
Returns an integer having one of three values:
- -1
An exception occurred during the callback and you must call
:func:`_python_handle_error` to deal with it. The Python watcher
object will have the exception tuple saved in ``_exc_info``.
- 0
... |
Returns an integer having one of three values:
- -1
An exception occurred during the callback and you must call
:func:`_python_handle_error` to deal with it. The Python watcher
object will have the exception tuple saved in ``_exc_info``.
- 0
Everything went according to plan. You s... | _python_callback | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/corecffi.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/corecffi.py | MIT |
def rawlink(self, callback):
"""
Register a callback to call when this object is ready.
*callback* will be called in the :class:`Hub <gevent.hub.Hub>`, so it must not use blocking gevent API.
*callback* will be passed one argument: this instance.
"""
if not callable(call... |
Register a callback to call when this object is ready.
*callback* will be called in the :class:`Hub <gevent.hub.Hub>`, so it must not use blocking gevent API.
*callback* will be passed one argument: this instance.
| rawlink | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/event.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/event.py | MIT |
def unlink(self, callback):
"""Remove the callback set by :meth:`rawlink`"""
try:
self._links.remove(callback)
except KeyError:
pass | Remove the callback set by :meth:`rawlink` | unlink | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/event.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/event.py | MIT |
def exc_info(self):
"""
The three-tuple of exception information if :meth:`set_exception` was called.
"""
if self._exc_info:
return (self._exc_info[0], self._exc_info[1], load_traceback(self._exc_info[2]))
return () |
The three-tuple of exception information if :meth:`set_exception` was called.
| exc_info | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/event.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/event.py | MIT |
def set_exception(self, exception, exc_info=None):
"""Store the exception and wake up any waiters.
All greenlets blocking on :meth:`get` or :meth:`wait` are awakened.
Subsequent calls to :meth:`wait` and :meth:`get` will not block at all.
:keyword tuple exc_info: If given, a standard t... | Store the exception and wake up any waiters.
All greenlets blocking on :meth:`get` or :meth:`wait` are awakened.
Subsequent calls to :meth:`wait` and :meth:`get` will not block at all.
:keyword tuple exc_info: If given, a standard three-tuple of type, value, :class:`traceback`
as r... | set_exception | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/event.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/event.py | MIT |
def get(self, block=True, timeout=None):
"""Return the stored value or raise the exception.
If this instance already holds a value or an exception, return or raise it immediatelly.
Otherwise, block until another greenlet calls :meth:`set` or :meth:`set_exception` or
until the optional ... | Return the stored value or raise the exception.
If this instance already holds a value or an exception, return or raise it immediatelly.
Otherwise, block until another greenlet calls :meth:`set` or :meth:`set_exception` or
until the optional timeout occurs.
When the *timeout* argument... | get | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/event.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/event.py | MIT |
def __init__(self, fobj, *args, **kwargs):
"""
:param fobj: The underlying file-like object to wrap, or an integer fileno
that will be pass to :func:`os.fdopen` along with everything in *args*.
:keyword bool lock: If True (the default) then all operations will
be performed ... |
:param fobj: The underlying file-like object to wrap, or an integer fileno
that will be pass to :func:`os.fdopen` along with everything in *args*.
:keyword bool lock: If True (the default) then all operations will
be performed one-by-one. Note that this does not guarantee that, if... | __init__ | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/fileobject.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/fileobject.py | MIT |
def close(self):
"""
.. versionchanged:: 1.1b1
The file object is closed using the threadpool. Note that whether or
not this action is synchronous or asynchronous is not documented.
"""
fobj = self.io
if fobj is None:
return
self.io = Non... |
.. versionchanged:: 1.1b1
The file object is closed using the threadpool. Note that whether or
not this action is synchronous or asynchronous is not documented.
| close | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/fileobject.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/fileobject.py | MIT |
def __init__(self, run=None, *args, **kwargs):
"""
Greenlet constructor.
:param args: The arguments passed to the ``run`` function.
:param kwargs: The keyword arguments passed to the ``run`` function.
:keyword run: The callable object to run. If not given, this object's
... |
Greenlet constructor.
:param args: The arguments passed to the ``run`` function.
:param kwargs: The keyword arguments passed to the ``run`` function.
:keyword run: The callable object to run. If not given, this object's
`_run` method will be invoked (typically defined by su... | __init__ | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/greenlet.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/greenlet.py | MIT |
def exc_info(self):
"""Holds the exc_info three-tuple raised by the function if the greenlet finished with an error.
Otherwise a false value."""
e = self._exc_info
if e:
return (e[0], e[1], load_traceback(e[2])) | Holds the exc_info three-tuple raised by the function if the greenlet finished with an error.
Otherwise a false value. | exc_info | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/greenlet.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/greenlet.py | MIT |
def throw(self, *args):
"""Immediatelly switch into the greenlet and raise an exception in it.
Should only be called from the HUB, otherwise the current greenlet is left unscheduled forever.
To raise an exception in a safe manner from any greenlet, use :meth:`kill`.
If a greenlet was s... | Immediatelly switch into the greenlet and raise an exception in it.
Should only be called from the HUB, otherwise the current greenlet is left unscheduled forever.
To raise an exception in a safe manner from any greenlet, use :meth:`kill`.
If a greenlet was started but never switched to yet, t... | throw | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/greenlet.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/greenlet.py | MIT |
def start(self):
"""Schedule the greenlet to run in this loop iteration"""
if self._start_event is None:
self._start_event = self.parent.loop.run_callback(self.switch) | Schedule the greenlet to run in this loop iteration | start | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/greenlet.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/greenlet.py | MIT |
def start_later(self, seconds):
"""Schedule the greenlet to run in the future loop iteration *seconds* later"""
if self._start_event is None:
self._start_event = self.parent.loop.timer(seconds)
self._start_event.start(self.switch) | Schedule the greenlet to run in the future loop iteration *seconds* later | start_later | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/greenlet.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/greenlet.py | MIT |
def spawn(cls, *args, **kwargs):
"""
Create a new :class:`Greenlet` object and schedule it to run ``function(*args, **kwargs)``.
This can be used as ``gevent.spawn`` or ``Greenlet.spawn``.
The arguments are passed to :meth:`Greenlet.__init__`.
.. versionchanged:: 1.1b1
... |
Create a new :class:`Greenlet` object and schedule it to run ``function(*args, **kwargs)``.
This can be used as ``gevent.spawn`` or ``Greenlet.spawn``.
The arguments are passed to :meth:`Greenlet.__init__`.
.. versionchanged:: 1.1b1
If a *function* is given that is not cal... | spawn | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/greenlet.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/greenlet.py | MIT |
def spawn_later(cls, seconds, *args, **kwargs):
"""
Create and return a new Greenlet object scheduled to run ``function(*args, **kwargs)``
in the future loop iteration *seconds* later. This can be used as ``Greenlet.spawn_later``
or ``gevent.spawn_later``.
The arguments are pass... |
Create and return a new Greenlet object scheduled to run ``function(*args, **kwargs)``
in the future loop iteration *seconds* later. This can be used as ``Greenlet.spawn_later``
or ``gevent.spawn_later``.
The arguments are passed to :meth:`Greenlet.__init__`.
.. versionchanged... | spawn_later | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/greenlet.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/greenlet.py | MIT |
def kill(self, exception=GreenletExit, block=True, timeout=None):
"""
Raise the ``exception`` in the greenlet.
If ``block`` is ``True`` (the default), wait until the greenlet dies or the optional timeout expires.
If block is ``False``, the current greenlet is not unscheduled.
T... |
Raise the ``exception`` in the greenlet.
If ``block`` is ``True`` (the default), wait until the greenlet dies or the optional timeout expires.
If block is ``False``, the current greenlet is not unscheduled.
The function always returns ``None`` and never raises an error.
.. no... | kill | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/greenlet.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/greenlet.py | MIT |
def get(self, block=True, timeout=None):
"""Return the result the greenlet has returned or re-raise the exception it has raised.
If block is ``False``, raise :class:`gevent.Timeout` if the greenlet is still alive.
If block is ``True``, unschedule the current greenlet until the result is availab... | Return the result the greenlet has returned or re-raise the exception it has raised.
If block is ``False``, raise :class:`gevent.Timeout` if the greenlet is still alive.
If block is ``True``, unschedule the current greenlet until the result is available
or the timeout expires. In the latter cas... | get | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/greenlet.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/greenlet.py | MIT |
def join(self, timeout=None):
"""Wait until the greenlet finishes or *timeout* expires.
Return ``None`` regardless.
"""
if self.ready():
return
switch = getcurrent().switch
self.rawlink(switch)
try:
t = Timeout._start_new_or_dummy(timeout)... | Wait until the greenlet finishes or *timeout* expires.
Return ``None`` regardless.
| join | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/greenlet.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/greenlet.py | MIT |
def rawlink(self, callback):
"""Register a callable to be executed when the greenlet finishes execution.
The *callback* will be called with this instance as an argument.
.. caution:: The callable will be called in the HUB greenlet.
"""
if not callable(callback):
rai... | Register a callable to be executed when the greenlet finishes execution.
The *callback* will be called with this instance as an argument.
.. caution:: The callable will be called in the HUB greenlet.
| rawlink | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/greenlet.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/greenlet.py | MIT |
def unlink(self, callback):
"""Remove the callback set by :meth:`link` or :meth:`rawlink`"""
try:
self._links.remove(callback)
except ValueError:
pass | Remove the callback set by :meth:`link` or :meth:`rawlink` | unlink | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/greenlet.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/greenlet.py | MIT |
def joinall(greenlets, timeout=None, raise_error=False, count=None):
"""
Wait for the ``greenlets`` to finish.
:param greenlets: A sequence (supporting :func:`len`) of greenlets to wait for.
:keyword float timeout: If given, the maximum number of seconds to wait.
:return: A sequence of the greenlet... |
Wait for the ``greenlets`` to finish.
:param greenlets: A sequence (supporting :func:`len`) of greenlets to wait for.
:keyword float timeout: If given, the maximum number of seconds to wait.
:return: A sequence of the greenlets that finished before the timeout (if any)
expired.
| joinall | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/greenlet.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/greenlet.py | MIT |
def killall(greenlets, exception=GreenletExit, block=True, timeout=None):
"""
Forceably terminate all the ``greenlets`` by causing them to raise ``exception``.
:param greenlets: A **bounded** iterable of the non-None greenlets to terminate.
*All* the items in this iterable must be greenlets that bel... |
Forceably terminate all the ``greenlets`` by causing them to raise ``exception``.
:param greenlets: A **bounded** iterable of the non-None greenlets to terminate.
*All* the items in this iterable must be greenlets that belong to the same thread.
:keyword exception: The exception to raise in the gre... | killall | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/greenlet.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/greenlet.py | MIT |
def spawn_raw(function, *args, **kwargs):
"""
Create a new :class:`greenlet.greenlet` object and schedule it to
run ``function(*args, **kwargs)``.
This returns a raw :class:`~greenlet.greenlet` which does not have all the useful
methods that :class:`gevent.Greenlet` has. Typically, applications
... |
Create a new :class:`greenlet.greenlet` object and schedule it to
run ``function(*args, **kwargs)``.
This returns a raw :class:`~greenlet.greenlet` which does not have all the useful
methods that :class:`gevent.Greenlet` has. Typically, applications
should prefer :func:`~gevent.spawn`, but this me... | spawn_raw | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/hub.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/hub.py | MIT |
def sleep(seconds=0, ref=True):
"""
Put the current greenlet to sleep for at least *seconds*.
*seconds* may be specified as an integer, or a float if fractional
seconds are desired.
.. tip:: In the current implementation, a value of 0 (the default)
means to yield execution to any other runn... |
Put the current greenlet to sleep for at least *seconds*.
*seconds* may be specified as an integer, or a float if fractional
seconds are desired.
.. tip:: In the current implementation, a value of 0 (the default)
means to yield execution to any other runnable greenlets, but
this greenle... | sleep | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/hub.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/hub.py | MIT |
def idle(priority=0):
"""
Cause the calling greenlet to wait until the event loop is idle.
Idle is defined as having no other events of the same or higher
*priority* pending. That is, as long as sockets, timeouts or even
signals of the same or higher priority are being processed, the loop
is no... |
Cause the calling greenlet to wait until the event loop is idle.
Idle is defined as having no other events of the same or higher
*priority* pending. That is, as long as sockets, timeouts or even
signals of the same or higher priority are being processed, the loop
is not idle.
.. seealso:: :fu... | idle | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/hub.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/hub.py | MIT |
def kill(greenlet, exception=GreenletExit):
"""
Kill greenlet asynchronously. The current greenlet is not unscheduled.
.. note::
The method :meth:`Greenlet.kill` method does the same and
more (and the same caveats listed there apply here). However, the MAIN
greenlet - the one that ... |
Kill greenlet asynchronously. The current greenlet is not unscheduled.
.. note::
The method :meth:`Greenlet.kill` method does the same and
more (and the same caveats listed there apply here). However, the MAIN
greenlet - the one that exists initially - does not have a
``kill()... | kill | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/hub.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/hub.py | MIT |
def reinit():
"""
Prepare the gevent hub to run in a new (forked) process.
This should be called *immediately* after :func:`os.fork` in the
child process. This is done automatically by
:func:`gevent.os.fork` or if the :mod:`os` module has been
monkey-patched. If this function is not called in a... |
Prepare the gevent hub to run in a new (forked) process.
This should be called *immediately* after :func:`os.fork` in the
child process. This is done automatically by
:func:`gevent.os.fork` or if the :mod:`os` module has been
monkey-patched. If this function is not called in a forked
process, ... | reinit | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/hub.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/hub.py | MIT |
def get_hub_class():
"""Return the type of hub to use for the current thread.
If there's no type of hub for the current thread yet, 'gevent.hub.Hub' is used.
"""
hubtype = _threadlocal.Hub
if hubtype is None:
hubtype = _threadlocal.Hub = Hub
return hubtype | Return the type of hub to use for the current thread.
If there's no type of hub for the current thread yet, 'gevent.hub.Hub' is used.
| get_hub_class | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/hub.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/hub.py | MIT |
def get_hub(*args, **kwargs):
"""
Return the hub for the current thread.
If a hub does not exist in the current thread, a new one is
created of the type returned by :func:`get_hub_class`.
"""
hub = _threadlocal.hub
if hub is None:
hubtype = get_hub_class()
hub = _threadlocal... |
Return the hub for the current thread.
If a hub does not exist in the current thread, a new one is
created of the type returned by :func:`get_hub_class`.
| get_hub | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/hub.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/hub.py | MIT |
def handle_error(self, context, type, value, tb):
"""
Called by the event loop when an error occurs. The arguments
type, value, and tb are the standard tuple returned by :func:`sys.exc_info`.
Applications can set a property on the hub with this same signature
to override the err... |
Called by the event loop when an error occurs. The arguments
type, value, and tb are the standard tuple returned by :func:`sys.exc_info`.
Applications can set a property on the hub with this same signature
to override the error handling provided by this class.
Errors that are ... | handle_error | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/hub.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/hub.py | MIT |
def wait(self, watcher):
"""
Wait until the *watcher* (which should not be started) is ready.
The current greenlet will be unscheduled during this time.
.. seealso:: :class:`gevent.core.io`, :class:`gevent.core.timer`,
:class:`gevent.core.signal`, :class:`gevent.core.idle`,... |
Wait until the *watcher* (which should not be started) is ready.
The current greenlet will be unscheduled during this time.
.. seealso:: :class:`gevent.core.io`, :class:`gevent.core.timer`,
:class:`gevent.core.signal`, :class:`gevent.core.idle`, :class:`gevent.core.prepare`,
... | wait | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/hub.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/hub.py | MIT |
def cancel_wait(self, watcher, error):
"""
Cancel an in-progress call to :meth:`wait` by throwing the given *error*
in the waiting greenlet.
"""
if watcher.callback is not None:
self.loop.run_callback(self._cancel_wait, watcher, error) |
Cancel an in-progress call to :meth:`wait` by throwing the given *error*
in the waiting greenlet.
| cancel_wait | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/hub.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/hub.py | MIT |
def run(self):
"""
Entry-point to running the loop. This method is called automatically
when the hub greenlet is scheduled; do not call it directly.
:raises LoopExit: If the loop finishes running. This means
that there are no other scheduled greenlets, and no active
... |
Entry-point to running the loop. This method is called automatically
when the hub greenlet is scheduled; do not call it directly.
:raises LoopExit: If the loop finishes running. This means
that there are no other scheduled greenlets, and no active
watchers or servers. In ... | run | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/hub.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/hub.py | MIT |
def join(self, timeout=None):
"""Wait for the event loop to finish. Exits only when there are
no more spawned greenlets, started servers, active timeouts or watchers.
If *timeout* is provided, wait no longer for the specified number of seconds.
Returns True if exited because the loop f... | Wait for the event loop to finish. Exits only when there are
no more spawned greenlets, started servers, active timeouts or watchers.
If *timeout* is provided, wait no longer for the specified number of seconds.
Returns True if exited because the loop finished execution.
Returns False ... | join | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/hub.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/hub.py | MIT |
def exc_info(self):
"Holds the exception info passed to :meth:`throw` if :meth:`throw` was called. Otherwise ``None``."
if self._exception is not _NONE:
return self._exception | Holds the exception info passed to :meth:`throw` if :meth:`throw` was called. Otherwise ``None``. | exc_info | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/hub.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/hub.py | MIT |
def switch(self, value=None):
"""Switch to the greenlet if one's available. Otherwise store the value."""
greenlet = self.greenlet
if greenlet is None:
self.value = value
self._exception = None
else:
assert getcurrent() is self.hub, "Can only use Waite... | Switch to the greenlet if one's available. Otherwise store the value. | switch | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/hub.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/hub.py | MIT |
def throw(self, *throw_args):
"""Switch to the greenlet with the exception. If there's no greenlet, store the exception."""
greenlet = self.greenlet
if greenlet is None:
self._exception = throw_args
else:
assert getcurrent() is self.hub, "Can only use Waiter.switc... | Switch to the greenlet with the exception. If there's no greenlet, store the exception. | throw | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/hub.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/hub.py | MIT |
def get(self):
"""If a value/an exception is stored, return/raise it. Otherwise until switch() or throw() is called."""
if self._exception is not _NONE:
if self._exception is None:
return self.value
else:
getcurrent().throw(*self._exception)
... | If a value/an exception is stored, return/raise it. Otherwise until switch() or throw() is called. | get | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/hub.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/hub.py | MIT |
def iwait(objects, timeout=None, count=None):
"""
Iteratively yield *objects* as they are ready, until all (or *count*) are ready
or *timeout* expired.
:param objects: A sequence (supporting :func:`len`) containing objects
implementing the wait protocol (rawlink() and unlink()).
:keyword in... |
Iteratively yield *objects* as they are ready, until all (or *count*) are ready
or *timeout* expired.
:param objects: A sequence (supporting :func:`len`) containing objects
implementing the wait protocol (rawlink() and unlink()).
:keyword int count: If not `None`, then a number specifying the ... | iwait | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/hub.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/hub.py | MIT |
def wait(objects=None, timeout=None, count=None):
"""
Wait for ``objects`` to become ready or for event loop to finish.
If ``objects`` is provided, it must be a list containing objects
implementing the wait protocol (rawlink() and unlink() methods):
- :class:`gevent.Greenlet` instance
- :class... |
Wait for ``objects`` to become ready or for event loop to finish.
If ``objects`` is provided, it must be a list containing objects
implementing the wait protocol (rawlink() and unlink() methods):
- :class:`gevent.Greenlet` instance
- :class:`gevent.event.Event` instance
- :class:`gevent.lock.... | wait | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/hub.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/hub.py | MIT |
def create_dict(self):
"""Create a new dict for the current thread, and return it."""
localdict = {}
key = self.key
thread = getcurrent()
idt = id(thread)
# If we are working with a gevent.greenlet.Greenlet, we can
# pro-actively clear out with a link. Use rawlin... | Create a new dict for the current thread, and return it. | create_dict | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/local.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/local.py | MIT |
def get_original(mod_name, item_name):
"""Retrieve the original object from a module.
If the object has not been patched, then that object will still be retrieved.
:param item_name: A string or sequence of strings naming the attribute(s) on the module
``mod_name`` to return.
:return: The origi... | Retrieve the original object from a module.
If the object has not been patched, then that object will still be retrieved.
:param item_name: A string or sequence of strings naming the attribute(s) on the module
``mod_name`` to return.
:return: The original value if a string was given for ``item_nam... | get_original | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/monkey.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/monkey.py | MIT |
def patch_sys(stdin=True, stdout=True, stderr=True):
"""Patch sys.std[in,out,err] to use a cooperative IO via a threadpool.
This is relatively dangerous and can have unintended consequences such as hanging
the process or `misinterpreting control keys`_ when ``input`` and ``raw_input``
are used.
Th... | Patch sys.std[in,out,err] to use a cooperative IO via a threadpool.
This is relatively dangerous and can have unintended consequences such as hanging
the process or `misinterpreting control keys`_ when ``input`` and ``raw_input``
are used.
This method does nothing on Python 3. The Python 3 interpreter... | patch_sys | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/monkey.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/monkey.py | MIT |
def patch_time():
"""Replace :func:`time.sleep` with :func:`gevent.sleep`."""
from gevent.hub import sleep
import time
patch_item(time, 'sleep', sleep) | Replace :func:`time.sleep` with :func:`gevent.sleep`. | patch_time | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/monkey.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/monkey.py | MIT |
def patch_thread(threading=True, _threading_local=True, Event=False, logging=True,
existing_locks=True,
_warnings=None):
"""
Replace the standard :mod:`thread` module to make it greenlet-based.
- If *threading* is true (the default), also patch ``threading``.
- If *_th... |
Replace the standard :mod:`thread` module to make it greenlet-based.
- If *threading* is true (the default), also patch ``threading``.
- If *_threading_local* is true (the default), also patch ``_threading_local.local``.
- If *logging* is True (the default), also patch locks taken if the logging modul... | patch_thread | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/monkey.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/monkey.py | MIT |
def patch_socket(dns=True, aggressive=True):
"""Replace the standard socket object with gevent's cooperative sockets.
If ``dns`` is true, also patch dns functions in :mod:`socket`.
"""
from gevent import socket
# Note: although it seems like it's not strictly necessary to monkey patch 'create_conne... | Replace the standard socket object with gevent's cooperative sockets.
If ``dns`` is true, also patch dns functions in :mod:`socket`.
| patch_socket | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/monkey.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/monkey.py | MIT |
def patch_select(aggressive=True):
"""
Replace :func:`select.select` with :func:`gevent.select.select`
and :func:`select.poll` with :class:`gevent.select.poll` (where available).
If ``aggressive`` is true (the default), also remove other
blocking functions from :mod:`select` and (on Python 3.4 and
... |
Replace :func:`select.select` with :func:`gevent.select.select`
and :func:`select.poll` with :class:`gevent.select.poll` (where available).
If ``aggressive`` is true (the default), also remove other
blocking functions from :mod:`select` and (on Python 3.4 and
above) :mod:`selectors`:
- :func:... | patch_select | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/monkey.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/monkey.py | MIT |
def patch_all(socket=True, dns=True, time=True, select=True, thread=True, os=True, ssl=True, httplib=False,
subprocess=True, sys=False, aggressive=True, Event=False,
builtins=True, signal=True):
"""
Do all of the default monkey patching (calls every other applicable
function in t... |
Do all of the default monkey patching (calls every other applicable
function in this module).
.. versionchanged:: 1.1
Issue a :mod:`warning <warnings>` if this function is called multiple times
with different arguments. The second and subsequent calls will only add more
patches, they ... | patch_all | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/monkey.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/monkey.py | MIT |
def make_nonblocking(fd):
"""Put the file descriptor *fd* into non-blocking mode if possible.
:return: A boolean value that evaluates to True if successful."""
flags = fcntl.fcntl(fd, fcntl.F_GETFL, 0)
if not bool(flags & os.O_NONBLOCK):
fcntl.fcntl(fd, fcntl.F_SETFL, flags ... | Put the file descriptor *fd* into non-blocking mode if possible.
:return: A boolean value that evaluates to True if successful. | make_nonblocking | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/os.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/os.py | MIT |
def nb_read(fd, n):
"""Read up to `n` bytes from file descriptor `fd`. Return a string
containing the bytes read. If end-of-file is reached, an empty string
is returned.
The descriptor must be in non-blocking mode.
"""
hub, event = None, None
while True:
... | Read up to `n` bytes from file descriptor `fd`. Return a string
containing the bytes read. If end-of-file is reached, an empty string
is returned.
The descriptor must be in non-blocking mode.
| nb_read | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/os.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/os.py | MIT |
def nb_write(fd, buf):
"""Write bytes from buffer `buf` to file descriptor `fd`. Return the
number of bytes written.
The file descriptor must be in non-blocking mode.
"""
hub, event = None, None
while True:
try:
return _write(fd, buf)
... | Write bytes from buffer `buf` to file descriptor `fd`. Return the
number of bytes written.
The file descriptor must be in non-blocking mode.
| nb_write | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/os.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/os.py | MIT |
def fork_gevent():
"""
Forks the process using :func:`os.fork` and prepares the
child process to continue using gevent before returning.
.. note::
The PID returned by this function may not be waitable with
either the original :func:`os.waitpid` or this module's
... |
Forks the process using :func:`os.fork` and prepares the
child process to continue using gevent before returning.
.. note::
The PID returned by this function may not be waitable with
either the original :func:`os.waitpid` or this module's
:func:`waitpid` an... | fork_gevent | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/os.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/os.py | MIT |
def waitpid(pid, options):
"""
Wait for a child process to finish.
If the child process was spawned using :func:`fork_and_watch`, then this
function behaves cooperatively. If not, it *may* have race conditions; see
:func:`fork_gevent` for more information.
... |
Wait for a child process to finish.
If the child process was spawned using :func:`fork_and_watch`, then this
function behaves cooperatively. If not, it *may* have race conditions; see
:func:`fork_gevent` for more information.
The arguments are as for the un... | waitpid | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/os.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/os.py | MIT |
def fork_and_watch(callback=None, loop=None, ref=False, fork=fork_gevent):
"""
Fork a child process and start a child watcher for it in the parent process.
This call cooperates with :func:`waitpid` to enable cooperatively waiting
for children to finish. When monkey-patch... |
Fork a child process and start a child watcher for it in the parent process.
This call cooperates with :func:`waitpid` to enable cooperatively waiting
for children to finish. When monkey-patching, these functions are patched in as
:func:`os.fork` and :func:`os.waitpid`,... | fork_and_watch | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/os.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/os.py | MIT |
def forkpty_and_watch(callback=None, loop=None, ref=False, forkpty=forkpty_gevent):
"""
Like :func:`fork_and_watch`, except using :func:`forkpty_gevent`.
Availability: Some Unix systems.
.. versionadded:: 1.1b5
"""
result ... |
Like :func:`fork_and_watch`, except using :func:`forkpty_gevent`.
Availability: Some Unix systems.
.. versionadded:: 1.1b5
| forkpty_and_watch | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/os.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/os.py | MIT |
def fork(*args, **kwargs):
"""
Forks a child process and starts a child watcher for it in the
parent process so that ``waitpid`` and SIGCHLD work as expected.
This implementation of ``fork`` is a wrapper for :func:`fork_and_watch`
when the... |
Forks a child process and starts a child watcher for it in the
parent process so that ``waitpid`` and SIGCHLD work as expected.
This implementation of ``fork`` is a wrapper for :func:`fork_and_watch`
when the environment variable ``GEVENT_NOWAITPID`` is ... | fork | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/os.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/os.py | MIT |
def forkpty(*args, **kwargs):
"""
Like :func:`fork`, but using :func:`forkpty_gevent`.
This implementation of ``forkpty`` is a wrapper for :func:`forkpty_and_watch`
when the environment variable ``GEVENT_NOWAITPID`` is *not* defined.
... |
Like :func:`fork`, but using :func:`forkpty_gevent`.
This implementation of ``forkpty`` is a wrapper for :func:`forkpty_and_watch`
when the environment variable ``GEVENT_NOWAITPID`` is *not* defined.
This is the default and should be used... | forkpty | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/os.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/os.py | MIT |
def __init__(self, func, iterable, spawn=None, maxsize=None, _zipped=False):
"""
An iterator that.
:keyword int maxsize: If given and not-None, specifies the maximum number of
finished results that will be allowed to accumulated awaiting the reader;
more than that number... |
An iterator that.
:keyword int maxsize: If given and not-None, specifies the maximum number of
finished results that will be allowed to accumulated awaiting the reader;
more than that number of results will cause map function greenlets to begin
to block. This is mos... | __init__ | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/pool.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/pool.py | MIT |
def apply_cb(self, func, args=None, kwds=None, callback=None):
"""
:meth:`apply` the given *func*, and, if a *callback* is given, run it with the
results of *func* (unless an exception was raised.)
The *callback* may be called synchronously or asynchronously. If called
asynchron... |
:meth:`apply` the given *func*, and, if a *callback* is given, run it with the
results of *func* (unless an exception was raised.)
The *callback* may be called synchronously or asynchronously. If called
asynchronously, it will not be tracked by this group. (:class:`Group` and :class:`P... | apply_cb | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/pool.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/pool.py | MIT |
def apply_async(self, func, args=None, kwds=None, callback=None):
"""
A variant of the apply() method which returns a Greenlet object.
If *callback* is specified, then it should be a callable which
accepts a single argument. When the result becomes ready
callback is applied to i... |
A variant of the apply() method which returns a Greenlet object.
If *callback* is specified, then it should be a callable which
accepts a single argument. When the result becomes ready
callback is applied to it (unless the call failed).
| apply_async | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/pool.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/pool.py | MIT |
def apply(self, func, args=None, kwds=None):
"""
Rough quivalent of the :func:`apply()` builtin function blocking until
the result is ready and returning it.
The ``func`` will *usually*, but not *always*, be run in a way
that allows the current greenlet to switch out (for exampl... |
Rough quivalent of the :func:`apply()` builtin function blocking until
the result is ready and returning it.
The ``func`` will *usually*, but not *always*, be run in a way
that allows the current greenlet to switch out (for example,
in a new greenlet or thread, depending on imp... | apply | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/pool.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/pool.py | MIT |
def add(self, greenlet):
"""
Begin tracking the greenlet.
If this group is :meth:`full`, then this method may block
until it is possible to track the greenlet.
"""
try:
rawlink = greenlet.rawlink
except AttributeError:
pass # non-Greenlet... |
Begin tracking the greenlet.
If this group is :meth:`full`, then this method may block
until it is possible to track the greenlet.
| add | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/pool.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/pool.py | MIT |
def spawn(self, *args, **kwargs):
"""
Begin a new greenlet with the given arguments (which are passed
to the greenlet constructor) and add it to the collection of greenlets
this group is monitoring.
:return: The newly started greenlet.
"""
greenlet = self.greenle... |
Begin a new greenlet with the given arguments (which are passed
to the greenlet constructor) and add it to the collection of greenlets
this group is monitoring.
:return: The newly started greenlet.
| spawn | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/pool.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/pool.py | MIT |
def join(self, timeout=None, raise_error=False):
"""
Wait for this group to become empty *at least once*.
If there are no greenlets in the group, returns immediately.
.. note:: By the time the waiting code (the caller of this
method) regains control, a greenlet may have been... |
Wait for this group to become empty *at least once*.
If there are no greenlets in the group, returns immediately.
.. note:: By the time the waiting code (the caller of this
method) regains control, a greenlet may have been added to
this group, and so this object may no l... | join | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/pool.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/pool.py | MIT |
def kill(self, exception=GreenletExit, block=True, timeout=None):
"""
Kill all greenlets being tracked by this group.
"""
timer = Timeout._start_new_or_dummy(timeout)
try:
try:
while self.greenlets:
for greenlet in list(self.greenle... |
Kill all greenlets being tracked by this group.
| kill | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/pool.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/pool.py | MIT |
def killone(self, greenlet, exception=GreenletExit, block=True, timeout=None):
"""
If the given *greenlet* is running and being tracked by this group,
kill it.
"""
if greenlet not in self.dying and greenlet in self.greenlets:
greenlet.kill(exception, block=False)
... |
If the given *greenlet* is running and being tracked by this group,
kill it.
| killone | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/pool.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/pool.py | MIT |
def free_count(self):
"""
Return a number indicating *approximately* how many more members
can be added to this pool.
"""
if self.size is None:
return 1
return max(0, self.size - len(self)) |
Return a number indicating *approximately* how many more members
can be added to this pool.
| free_count | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/pool.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/pool.py | MIT |
def add(self, greenlet):
"""
Begin tracking the given greenlet, blocking until space is available.
.. seealso:: :meth:`Group.add`
"""
self._semaphore.acquire()
try:
Group.add(self, greenlet)
except:
self._semaphore.release()
ra... |
Begin tracking the given greenlet, blocking until space is available.
.. seealso:: :meth:`Group.add`
| add | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/pool.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/pool.py | MIT |
def handle(self):
"""
The main request handling method, called by the server.
This method runs a request handling loop, calling
:meth:`handle_one_request` until all requests on the
connection have been handled (that is, it implements
keep-alive).
"""
try:... |
The main request handling method, called by the server.
This method runs a request handling loop, calling
:meth:`handle_one_request` until all requests on the
connection have been handled (that is, it implements
keep-alive).
| handle | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/pywsgi.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/pywsgi.py | MIT |
def read_request(self, raw_requestline):
"""
Parse the incoming request.
Parses various headers into ``self.headers`` using
:attr:`MessageClass`. Other attributes that are set upon a successful
return of this method include ``self.content_length`` and ``self.close_connection``.
... |
Parse the incoming request.
Parses various headers into ``self.headers`` using
:attr:`MessageClass`. Other attributes that are set upon a successful
return of this method include ``self.content_length`` and ``self.close_connection``.
:param str raw_requestline: A native :class... | read_request | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/pywsgi.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/pywsgi.py | MIT |
def read_requestline(self):
"""
Read and return the HTTP request line.
Under both Python 2 and 3, this should return the native
``str`` type; under Python 3, this probably means the bytes read
from the network need to be decoded (using the ISO-8859-1 charset, aka
latin-1... |
Read and return the HTTP request line.
Under both Python 2 and 3, this should return the native
``str`` type; under Python 3, this probably means the bytes read
from the network need to be decoded (using the ISO-8859-1 charset, aka
latin-1).
| read_requestline | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/pywsgi.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/pywsgi.py | MIT |
def start_response(self, status, headers, exc_info=None):
"""
.. versionchanged:: 1.1b5
Pro-actively handle checking the encoding of the status line
and headers during this method. On Python 2, avoid some
extra encodings.
"""
if exc_info:
... |
.. versionchanged:: 1.1b5
Pro-actively handle checking the encoding of the status line
and headers during this method. On Python 2, avoid some
extra encodings.
| start_response | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/pywsgi.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/pywsgi.py | MIT |
def get_environ(self):
"""
Construct and return a new WSGI environment dictionary for a specific request.
This should begin with asking the server for the base environment
using :meth:`WSGIServer.get_environ`, and then proceed to add the
request specific values.
By the ... |
Construct and return a new WSGI environment dictionary for a specific request.
This should begin with asking the server for the base environment
using :meth:`WSGIServer.get_environ`, and then proceed to add the
request specific values.
By the time this method is invoked the re... | get_environ | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/pywsgi.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/pywsgi.py | MIT |
def __init__(self, logger, level=20):
"""
Write information to the *logger* at the given *level* (default to INFO).
"""
self._logger = logger
self._level = level |
Write information to the *logger* at the given *level* (default to INFO).
| __init__ | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/pywsgi.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/pywsgi.py | MIT |
def update_environ(self):
"""
Called before the first request is handled to fill in WSGI environment values.
This includes getting the correct server name and port.
"""
address = self.address
if isinstance(address, tuple):
if 'SERVER_NAME' not in self.environ... |
Called before the first request is handled to fill in WSGI environment values.
This includes getting the correct server name and port.
| update_environ | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/pywsgi.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/pywsgi.py | MIT |
def put(self, item, block=True, timeout=None):
"""Put an item into the queue.
If optional arg *block* is true and *timeout* is ``None`` (the default),
block if necessary until a free slot is available. If *timeout* is
a positive number, it blocks at most *timeout* seconds and raises
... | Put an item into the queue.
If optional arg *block* is true and *timeout* is ``None`` (the default),
block if necessary until a free slot is available. If *timeout* is
a positive number, it blocks at most *timeout* seconds and raises
the :class:`Full` exception if no free slot was avail... | put | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/queue.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/queue.py | MIT |
def get(self, block=True, timeout=None):
"""Remove and return an item from the queue.
If optional args *block* is true and *timeout* is ``None`` (the default),
block if necessary until an item is available. If *timeout* is a positive number,
it blocks at most *timeout* seconds and raise... | Remove and return an item from the queue.
If optional args *block* is true and *timeout* is ``None`` (the default),
block if necessary until an item is available. If *timeout* is a positive number,
it blocks at most *timeout* seconds and raises the :class:`Empty` exception
if no item wa... | get | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/queue.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/queue.py | MIT |
def peek(self, block=True, timeout=None):
"""Return an item from the queue without removing it.
If optional args *block* is true and *timeout* is ``None`` (the default),
block if necessary until an item is available. If *timeout* is a positive number,
it blocks at most *timeout* seconds... | Return an item from the queue without removing it.
If optional args *block* is true and *timeout* is ``None`` (the default),
block if necessary until an item is available. If *timeout* is a positive number,
it blocks at most *timeout* seconds and raises the :class:`Empty` exception
if n... | peek | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/queue.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/queue.py | MIT |
def __init__(self, maxsize=None, items=None, unfinished_tasks=None):
"""
.. versionchanged:: 1.1a1
If *unfinished_tasks* is not given, then all the given *items*
(if any) will be considered unfinished.
"""
from gevent.event import Event
Queue.__init__(self... |
.. versionchanged:: 1.1a1
If *unfinished_tasks* is not given, then all the given *items*
(if any) will be considered unfinished.
| __init__ | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/queue.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/queue.py | MIT |
def task_done(self):
'''Indicate that a formerly enqueued task is complete. Used by queue consumer threads.
For each :meth:`get <Queue.get>` used to fetch a task, a subsequent call to :meth:`task_done` tells the queue
that the processing on the task is complete.
If a :meth:`join` is cur... | Indicate that a formerly enqueued task is complete. Used by queue consumer threads.
For each :meth:`get <Queue.get>` used to fetch a task, a subsequent call to :meth:`task_done` tells the queue
that the processing on the task is complete.
If a :meth:`join` is currently blocking, it will resume ... | task_done | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/queue.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/queue.py | MIT |
def select(rlist, wlist, xlist, timeout=None):
"""An implementation of :meth:`select.select` that blocks only the current greenlet.
Note: *xlist* is ignored.
"""
watchers = []
loop = get_hub().loop
io = loop.io
MAXPRI = loop.MAXPRI
result = SelectResult()
try:
try:
... | An implementation of :meth:`select.select` that blocks only the current greenlet.
Note: *xlist* is ignored.
| select | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/select.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/select.py | MIT |
def _tcp_listener(address, backlog=50, reuse_addr=None, family=_socket.AF_INET):
"""A shortcut to create a TCP socket, bind it and put it into listening state."""
sock = socket(family=family)
if reuse_addr is not None:
sock.setsockopt(_socket.SOL_SOCKET, _socket.SO_REUSEADDR, reuse_addr)
try:
... | A shortcut to create a TCP socket, bind it and put it into listening state. | _tcp_listener | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/server.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/server.py | MIT |
def getsignal(signalnum):
"""
Exactly the same as :func:`signal.signal` except where
:const:`signal.SIGCHLD` is concerned.
"""
if signalnum != _signal.SIGCHLD:
return _signal_getsignal(signalnum)
global _child_handler
if _child_handler is _INITIAL:
_child_handler = _signal_g... |
Exactly the same as :func:`signal.signal` except where
:const:`signal.SIGCHLD` is concerned.
| getsignal | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/signal.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/signal.py | MIT |
def signal(signalnum, handler):
"""
Exactly the same as :func:`signal.signal` except where
:const:`signal.SIGCHLD` is concerned.
.. note::
A :const:`signal.SIGCHLD` handler installed with this function
will only be triggered for children that are forked using
:func:`gevent.os.fork... |
Exactly the same as :func:`signal.signal` except where
:const:`signal.SIGCHLD` is concerned.
.. note::
A :const:`signal.SIGCHLD` handler installed with this function
will only be triggered for children that are forked using
:func:`gevent.os.fork` (:func:`gevent.os.fork_and_watch`);
... | signal | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/signal.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/signal.py | MIT |
def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT, source_address=None):
"""Connect to *address* and return the socket object.
Convenience function. Connect to *address* (a 2-tuple ``(host,
port)``) and return the socket object. Passing the optional
*timeout* parameter will set the timeo... | Connect to *address* and return the socket object.
Convenience function. Connect to *address* (a 2-tuple ``(host,
port)``) and return the socket object. Passing the optional
*timeout* parameter will set the timeout on the socket instance
before attempting to connect. If no *timeout* is supplied, the... | create_connection | python | mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/gevent/socket.py | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/master/app/pylibs/win32/gevent/socket.py | MIT |
Subsets and Splits
Django Code with Docstrings
Filters Python code examples from Django repository that contain Django-related code, helping identify relevant code snippets for understanding Django framework usage patterns.
SQL Console for Shuu12121/python-treesitter-filtered-datasetsV2
Retrieves specific code examples from the Flask repository but doesn't provide meaningful analysis or patterns beyond basic data retrieval.
HTTPX Repo Code and Docstrings
Retrieves specific code examples from the httpx repository, which is useful for understanding how particular libraries are used but doesn't provide broader analytical insights about the dataset.
Requests Repo Docstrings & Code
Retrieves code examples with their docstrings and file paths from the requests repository, providing basic filtering but limited analytical value beyond finding specific code samples.
Quart Repo Docstrings & Code
Retrieves code examples with their docstrings from the Quart repository, providing basic code samples but offering limited analytical value for understanding broader patterns or relationships in the dataset.