id int64 0 190k | prompt stringlengths 21 13.4M | docstring stringlengths 1 12k ⌀ |
|---|---|---|
172,778 | import sys
import types
import pythoncom
import pywintypes
import win32api
import win32con
import winerror
from pythoncom import (
DISPATCH_METHOD,
DISPATCH_PROPERTYGET,
DISPATCH_PROPERTYPUT,
DISPATCH_PROPERTYPUTREF,
DISPID_COLLECT,
DISPID_CONSTRUCTOR,
DISPID_DESTRUCTOR,
DISPID_EVALUATE,... | Create a new instance of the specified IID The COM framework **always** calls this function to create a new instance for the specified CLSID. This function looks up the registry for the name of a policy, creates the policy, and asks the policy to create the specified object by calling the _CreateInstance_ method. Exact... |
172,779 | import sys
import types
import pythoncom
import pywintypes
import win32api
import win32con
import winerror
from pythoncom import (
DISPATCH_METHOD,
DISPATCH_PROPERTYGET,
DISPATCH_PROPERTYPUT,
DISPATCH_PROPERTYPUTREF,
DISPID_COLLECT,
DISPID_CONSTRUCTOR,
DISPID_DESTRUCTOR,
DISPID_EVALUATE,... | Call a function specified by name. Call a function specified by 'module.function' and return the result. |
172,780 | import os
import sys
import pythoncom
import win32api
import win32con
import winerror
def _get_string(path, base=win32con.HKEY_CLASSES_ROOT):
"Get a string value from the registry."
try:
return win32api.RegQueryValue(base, path)
except win32api.error:
return None
The provided code snippet i... | Given a CLSID for a server and option name, return the option value |
172,781 | import os
import sys
import pythoncom
import win32api
import win32con
import winerror
CATID_PythonCOMServer = "{B3EF80D0-68E2-11D0-A689-00C04FD658FF}"
def _cat_registrar():
return pythoncom.CoCreateInstance(
pythoncom.CLSID_StdComponentCategoriesMgr,
None,
pythoncom.CLSCTX_INPROC_SERVER,
... | Register the Python COM Server component category. |
172,782 | import traceback
import types
import pythoncom
import win32com.client
import winerror
from pywintypes import IIDType
from . import build
debugging = 0
def debug_print(*args):
if debugging:
for arg in args:
print(arg, end=" ")
print() | null |
172,783 | import traceback
import types
import pythoncom
import win32com.client
import winerror
from pywintypes import IIDType
from . import build
debugging_attr = 0
def debug_attr_print(*args):
if debugging_attr:
for arg in args:
print(arg, end=" ")
print() | null |
172,784 | import traceback
import types
import pythoncom
import win32com.client
import winerror
from pywintypes import IIDType
from . import build
def MakeMethod(func, inst, cls):
return types.MethodType(func, inst) | null |
172,785 | import traceback
import types
import pythoncom
import win32com.client
import winerror
from pywintypes import IIDType
from . import build
def _GetDescInvokeType(entry, invoke_type):
# determine the wFlags argument passed as input to IDispatch::Invoke
# Only ever called by __getattr__ and __setattr__ from dynam... | null |
172,786 | import traceback
import types
import pythoncom
import win32com.client
import winerror
from pywintypes import IIDType
from . import build
def _GetGoodDispatchAndUserName(IDispatch, userName, clsctx):
# Get a dispatch object, and a 'user name' (ie, the name as
# displayed to the user in repr() etc.
if userNa... | null |
172,787 | import traceback
import types
import pythoncom
import win32com.client
import winerror
from pywintypes import IIDType
from . import build
def _GetGoodDispatchAndUserName(IDispatch, userName, clsctx):
# Get a dispatch object, and a 'user name' (ie, the name as
# displayed to the user in repr() etc.
if userNa... | Dispatch with no type info |
172,788 | import pythoncom
from win32com.client import Dispatch, _get_good_object_
class EnumVARIANT(Enumerator):
def __init__(self, enum, resultCLSID=None):
self.resultCLSID = resultCLSID
Enumerator.__init__(self, enum)
def _make_retval_(self, result):
return _get_good_object_(result, resultCLSID... | Wrap an object in a VARIANT enumerator. All VT_DISPATCHs returned by the enumerator are converted to wrapper objects (which may be either a class instance, or a dynamic.Dispatch type object). |
172,789 | mapCLSIDToClass = {}
The provided code snippet includes necessary dependencies for implementing the `RegisterCLSID` function. Write a Python function `def RegisterCLSID(clsid, pythonClass)` to solve the following problem:
Register a class that wraps a CLSID This function allows a CLSID to be globally associated with a... | Register a class that wraps a CLSID This function allows a CLSID to be globally associated with a class. Certain module will automatically convert an IDispatch object to an instance of the associated class. |
172,790 | mapCLSIDToClass = {}
The provided code snippet includes necessary dependencies for implementing the `RegisterCLSIDsFromDict` function. Write a Python function `def RegisterCLSIDsFromDict(dict)` to solve the following problem:
Register a dictionary of CLSID's and classes. This module performs the same function as @Regi... | Register a dictionary of CLSID's and classes. This module performs the same function as @RegisterCLSID@, but for an entire dictionary of associations. Typically called by makepy generated modules at import time. |
172,791 | import os
import sys
import time
import pythoncom
import win32com
from . import build
def MakeDefaultArgsForPropertyPut(argsDesc):
ret = []
for desc in argsDesc[1:]:
default = build.MakeDefaultArgRepr(desc)
if default is None:
break
ret.append(default)
return tuple(ret) | null |
172,792 | import os
import sys
import time
import pythoncom
import win32com
from . import build
def MakeMapLineEntry(dispid, wFlags, retType, argTypes, user, resultCLSID):
# Strip the default value
argTypes = tuple([what[:2] for what in argTypes])
return '(%s, %d, %s, %s, "%s", %s)' % (
dispid,
wFlag... | null |
172,793 | import os
import sys
import time
import pythoncom
import win32com
from . import build
def MakeEventMethodName(eventName):
if eventName[:2] == "On":
return eventName
else:
return "On" + eventName
def WriteSinkEventMap(obj, stream):
print("\t_dispid_to_func_ = {", file=stream)
for name, e... | null |
172,794 | import os
import sys
import time
import pythoncom
import win32com
from . import build
def WriteAliasesForItem(item, aliasItems, stream):
for alias in aliasItems.values():
if item.doc and alias.aliasDoc and (alias.aliasDoc[0] == item.doc[0]):
alias.WriteAliasItem(aliasItems, stream) | null |
172,795 | usageHelp = """ \
Usage:
makepy.py [-i] [-v|q] [-h] [-u] [-o output_file] [-d] [typelib, ...]
-i -- Show information for the specified typelib.
-v -- Verbose output.
-q -- Quiet output.
-h -- Do not generate hidden methods.
-u -- Python 1.5 and earlier: Do NOT convert all Unicode objects to
... | null |
172,796 | import importlib
import os
import sys
import pythoncom
from win32com.client import Dispatch, gencache, genpy, selecttlb
def GetTypeLibsForSpec(arg):
"""Given an argument on the command line (either a file name, library
description, or ProgID of an object) return a list of actual typelibs
to use."""
type... | null |
172,797 | import glob
import os
import sys
from importlib import reload
import pythoncom
import pywintypes
import win32com
import win32com.client
from . import CLSIDToClass
import pickle as pickle
def _LoadDicts():
# Load the dictionary from a .zip file if that is where we live.
if is_zip:
import io as io
... | null |
172,798 | import glob
import os
import sys
from importlib import reload
import pythoncom
import pywintypes
import win32com
import win32com.client
from . import CLSIDToClass
import pickle as pickle
The provided code snippet includes necessary dependencies for implementing the `SplitGeneratedFileName` function. Write a Python fun... | Reverse of GetGeneratedFileName() |
172,799 | import glob
import os
import sys
from importlib import reload
import pythoncom
import pywintypes
import win32com
import win32com.client
from . import CLSIDToClass
import pickle as pickle
def GetClassForCLSID(clsid):
"""Get a Python class for a CLSID
Given a CLSID, return a Python class which wraps the COM objec... | Get a Python class for a Program ID Given a Program ID, return a Python class which wraps the COM object Returns the Python class, or None if no module is available. Params progid -- A COM ProgramID or IID (eg, "Word.Application") |
172,800 | import glob
import os
import sys
from importlib import reload
import pythoncom
import pywintypes
import win32com
import win32com.client
from . import CLSIDToClass
import pickle as pickle
def GetModuleForCLSID(clsid):
"""Get a Python module for a CLSID
Given a CLSID, return a Python module which contains the
... | Get a Python module for a Program ID Given a Program ID, return a Python module which contains the class which wraps the COM object. Returns the Python module, or None if no module is available. Params progid -- A COM ProgramID or IID (eg, "Word.Application") |
172,801 | import glob
import os
import sys
from importlib import reload
import pythoncom
import pywintypes
import win32com
import win32com.client
from . import CLSIDToClass
bForDemandDefault = 0
demandGeneratedTypeLibraries = {}
import pickle as pickle
def GetModuleForTypelib(typelibCLSID, lcid, major, minor):
"""Get a Pyth... | Check we have support for a type library, generating if not. Given a PyITypeLib interface generate and import the necessary support files if necessary. This is useful for getting makepy support for a typelibrary that is not registered - the caller can locate and load the type library itself, rather than relying on COM ... |
172,802 | import glob
import os
import sys
from importlib import reload
import pythoncom
import pywintypes
import win32com
import win32com.client
from . import CLSIDToClass
versionRedirectMap = {}
demandGeneratedTypeLibraries = {}
import pickle as pickle
The provided code snippet includes necessary dependencies for implementing... | Drop any references to a typelib previously added with EnsureModuleForTypelibInterface and forDemand |
172,803 | import glob
import os
import sys
from importlib import reload
import pythoncom
import pywintypes
import win32com
import win32com.client
from . import CLSIDToClass
import pickle as pickle
def GetModuleForCLSID(clsid):
"""Get a Python module for a CLSID
Given a CLSID, return a Python module which contains the
... | Given a COM prog_id, return an object that is using makepy support, building if necessary |
172,804 | import glob
import os
import sys
from importlib import reload
import pythoncom
import pywintypes
import win32com
import win32com.client
from . import CLSIDToClass
clsidToTypelib = {}
import pickle as pickle
def GetModuleForTypelib(typelibCLSID, lcid, major, minor):
"""Get a Python module for a type library ID
G... | null |
172,805 | import datetime
import string
import sys
from keyword import iskeyword
import pythoncom
import winerror
from pywintypes import TimeType
def _makeDocString(s):
if sys.version_info < (3,):
s = s.encode("mbcs")
return repr(s) | null |
172,806 | import datetime
import string
import sys
from keyword import iskeyword
import pythoncom
import winerror
from pywintypes import TimeType
class NotSupportedException(Exception):
pass # Raised when we cant support a param type.
typeSubstMap = {
pythoncom.VT_INT: pythoncom.VT_I4,
pythoncom.VT_UINT: pythoncom.V... | null |
172,807 | import datetime
import string
import sys
from keyword import iskeyword
import pythoncom
import winerror
from pywintypes import TimeType
def MakePublicAttributeName(className, is_global=False):
# Given a class attribute that needs to be public, convert it to a
# reasonable name.
# Also need to be careful tha... | Builds list of args to the underlying Invoke method. |
172,808 | import datetime
import string
import sys
from keyword import iskeyword
import pythoncom
import winerror
from pywintypes import TimeType
def MakePublicAttributeName(className, is_global=False):
# Given a class attribute that needs to be public, convert it to a
# reasonable name.
# Also need to be careful tha... | Builds a Python declaration for a method. |
172,809 | import logging
import json
import re
from datetime import date, datetime, time, timezone
import traceback
import importlib
from typing import Any, Dict, Optional, Union, List, Tuple
from inspect import istraceback
from collections import OrderedDict
Union: _SpecialForm = ...
Optional: _SpecialForm = ...
... | Merges extra attributes from LogRecord object into target dictionary :param record: logging.LogRecord :param target: dict to update :param reserved: dict or list with reserved keys to skip :param rename_fields: an optional dict, used to rename field names in the output. Rename levelname to log.level: {'levelname': 'log... |
172,810 | import codecs
import os
import shlex
import signal
import socket
import subprocess
import threading
import time
from shutil import which
from .winpty import PTY
The provided code snippet includes necessary dependencies for implementing the `_read_in_thread` function. Write a Python function `def _read_in_thread(addres... | Read data from the pty in a thread. |
172,811 | import re
from typing import Match, Tuple, Union, cast
from zmq.backend import zmq_version_info
__version__: str = "25.0.2"
__revision__: str = ''
The provided code snippet includes necessary dependencies for implementing the `pyzmq_version` function. Write a Python function `def pyzmq_version() -> str` to solve the f... | return the version of pyzmq as a string |
172,812 | import re
from typing import Match, Tuple, Union, cast
from zmq.backend import zmq_version_info
version_info: Union[Tuple[int, int, int], Tuple[int, int, int, float]] = (
VERSION_MAJOR,
VERSION_MINOR,
VERSION_PATCH,
)
class Tuple(BaseTypingInstance):
def _is_homogenous(self):
# To specify a var... | return the pyzmq version as a tuple of at least three numbers If pyzmq is a development version, `inf` will be appended after the third integer. |
172,813 | import re
from typing import Match, Tuple, Union, cast
from zmq.backend import zmq_version_info
The provided code snippet includes necessary dependencies for implementing the `zmq_version` function. Write a Python function `def zmq_version() -> str` to solve the following problem:
return the version of libzmq as a str... | return the version of libzmq as a string |
172,814 | import zmq
from zmq.backend import Frame as FrameBase
from .attrsettr import AttributeSetter
def _draft(v, feature):
zmq.error._check_version(v, feature)
if not zmq.DRAFT_API:
raise RuntimeError(
"libzmq and pyzmq must be built with draft support for %s" % feature
) | null |
172,815 | from typing import Any, Dict, List, Optional, Tuple
from zmq.backend import zmq_poll
from zmq.constants import POLLERR, POLLIN, POLLOUT
Optional: _SpecialForm = ...
List = _Alias()
POLLIN: int = PollEvent.POLLIN
POLLOUT: int = PollEvent.POLLOUT
POLLERR: int = PollEvent.POLLERR
The provided code snipp... | select(rlist, wlist, xlist, timeout=None) -> (rlist, wlist, xlist) Return the result of poll as a lists of sockets ready for r/w/exception. This has the same interface as Python's built-in ``select.select()`` function. Parameters ---------- timeout : float, int, optional The timeout in seconds. If None, no timeout (inf... |
172,816 | import atexit
import os
from threading import Lock
from typing import (
Any,
Callable,
Dict,
Generic,
List,
Optional,
Type,
TypeVar,
Union,
overload,
)
from warnings import warn
from weakref import WeakSet
from zmq.backend import Context as ContextBase
from zmq.constants import C... | null |
172,817 | import atexit
import os
import re
import signal
import socket
import sys
import warnings
from getpass import getpass, getuser
from multiprocessing import Process
def _try_passwordless_openssh(server, keyfile):
"""Try passwordless login with shell ssh command."""
if pexpect is None:
raise ImportError("pe... | Attempt to make an ssh connection without a password. This is mainly used for requiring password input only once when many tunnels may be connected to the same server. If paramiko is None, the default for the platform is chosen. |
172,818 | import atexit
import os
import re
import signal
import socket
import sys
import warnings
from getpass import getpass, getuser
from multiprocessing import Process
def open_tunnel(addr, server, keyfile=None, password=None, paramiko=None, timeout=60):
"""Open a tunneled connection from a 0MQ url.
For use inside tu... | Connect a socket to an address via an ssh tunnel. This is a wrapper for socket.connect(addr), when addr is not accessible from the local machine. It simply creates an ssh tunnel using the remaining args, and calls socket.connect('tcp://localhost:lport') where lport is the randomly selected local port of the tunnel. |
172,819 | import asyncio
import selectors
import sys
import warnings
from asyncio import Future, SelectorEventLoop
from weakref import WeakKeyDictionary
import zmq as _zmq
from zmq import _future
_selectors: WeakKeyDictionary = WeakKeyDictionary()
import asyncio
from asyncio import Future, SelectorEventLoop
class AddThreadSele... | Get selector-compatible loop Returns an object with ``add_reader`` family of methods, either the loop itself or a SelectorThread instance. Workaround Windows proactor removal of *reader methods, which we need for zmq sockets. |
172,820 | import asyncio
import selectors
import sys
import warnings
from asyncio import Future, SelectorEventLoop
from weakref import WeakKeyDictionary
import zmq as _zmq
from zmq import _future
import asyncio
from asyncio import Future, SelectorEventLoop
The provided code snippet includes necessary dependencies for implement... | no-op on non-Windows |
172,821 | import asyncio
import selectors
import sys
import warnings
from asyncio import Future, SelectorEventLoop
from weakref import WeakKeyDictionary
import zmq as _zmq
from zmq import _future
def _deprecated():
if _deprecated.called: # type: ignore
return
_deprecated.called = True # type: ignore
warning... | DEPRECATED: No longer needed in pyzmq 17 |
172,822 | from functools import wraps
import zmq
class _ContextDecorator(_Decorator):
"""Decorator subclass for Contexts"""
def __init__(self):
super().__init__(zmq.Context)
The provided code snippet includes necessary dependencies for implementing the `context` function. Write a Python function `def context(*ar... | Decorator for adding a Context to a function. Usage:: @context() def foo(ctx): ... .. versionadded:: 15.3 :param str name: the keyword argument passed to decorated function |
172,823 | from functools import wraps
import zmq
class _SocketDecorator(_Decorator):
"""Decorator subclass for sockets
Gets the context from other args.
"""
def process_decorator_args(self, *args, **kwargs):
"""Also grab context_name out of kwargs"""
kw_name, args, kwargs = super().process_decorat... | Decorator for adding a socket to a function. Usage:: @socket(zmq.PUSH) def foo(push): ... .. versionadded:: 15.3 :param str name: the keyword argument passed to decorated function :param str context_name: the keyword only argument to identify context object |
172,824 | import datetime
import glob
import os
from typing import Dict, Optional, Tuple, Union
import zmq
_cert_secret_banner = """# **** Generated on {0} by pyzmq ****
# ZeroMQ CURVE **Secret** Certificate
# DO NOT PROVIDE THIS FILE TO OTHER USERS nor change its permissions.
"""
_cert_public_banner = """# **** Gener... | Create zmq certificates. Returns the file paths to the public and secret certificate files. |
172,825 | import datetime
import glob
import os
from typing import Dict, Optional, Tuple, Union
import zmq
def load_certificate(
filename: Union[str, os.PathLike]
) -> Tuple[bytes, Optional[bytes]]:
"""Load public and secret key from a zmq certificate.
Returns (public_key, secret_key)
If the certificate file only... | Load public keys from all certificates in a directory |
172,826 | import warnings
def _deprecated():
warnings.warn(
"zmq.eventloop.ioloop is deprecated in pyzmq 17."
" pyzmq now works with default tornado and asyncio eventloops.",
DeprecationWarning,
stacklevel=3,
)
_deprecated()
from tornado.ioloop import *
from tornado.ioloop import IOLoop
... | DEPRECATED pyzmq 17 no longer needs any special integration for tornado. |
172,827 | import time
import warnings
from typing import Tuple
from zmq import ETERM, POLLERR, POLLIN, POLLOUT, Poller, ZMQError
tornado_version: Tuple = ()
try:
import tornado
tornado_version = tornado.version_info
except (ImportError, AttributeError):
pass
from .minitornado.ioloop import PeriodicCallback, PollIOLoo... | set the tornado IOLoop instance with the pyzmq IOLoop. After calling this function, tornado's IOLoop.instance() and pyzmq's IOLoop.instance() will return the same object. An assertion error will be raised if tornado's IOLoop has been initialized prior to calling this function. |
172,828 | import sys
import time
import warnings
from typing import Tuple
import gevent
from gevent.event import AsyncResult
from gevent.hub import get_hub
import zmq
from zmq import Context as _original_Context
from zmq import Socket as _original_Socket
from .poll import _Poller
The provided code snippet includes necessary dep... | simple wrapper for stopping an Event, allowing for method rename in gevent 1.0 |
172,829 | import zmq
from zmq.green import Poller
Poller = _Poller
The provided code snippet includes necessary dependencies for implementing the `device` function. Write a Python function `def device(device_type, isocket, osocket)` to solve the following problem:
Start a zeromq device (gevent-compatible). Unlike the true zmq.... | Start a zeromq device (gevent-compatible). Unlike the true zmq.device, this does not release the GIL. Parameters ---------- device_type : (QUEUE, FORWARDER, STREAMER) The type of device to start (ignored). isocket : Socket The Socket instance for the incoming traffic. osocket : Socket The Socket instance for the outbou... |
172,830 | import zmq
def _relay(ins, outs, sides, prefix, swap_ids):
msg = ins.recv_multipart()
if swap_ids:
msg[:2] = msg[:2][::-1]
outs.send_multipart(msg)
sides.send_multipart([prefix] + msg)
def monitored_queue(
in_socket, out_socket, mon_socket, in_prefix=b'in', out_prefix=b'out'
):
swap_ids... | null |
172,831 | from zmq.error import InterruptedSystemCall, _check_rc, _check_version
from ._cffi import ffi
from ._cffi import lib as C
def _check_version(
min_version_info: Union[Tuple[int], Tuple[int, int], Tuple[int, int, int]],
msg: str = "Feature",
):
"""Check for libzmq
raises ZMQVersionError if current zmq v... | Check for zmq capability by name (e.g. 'ipc', 'curve') .. versionadded:: libzmq-4.1 .. versionadded:: 14.1 |
172,832 | from zmq.error import InterruptedSystemCall, _check_rc, _check_version
from ._cffi import ffi
from ._cffi import lib as C
def _check_rc(rc, errno=None, error_without_errno=True):
"""internal utility for checking zmq return condition
and raising the appropriate Exception class
"""
if rc == -1:
... | generate a Z85 key pair for use with zmq.CURVE security Requires libzmq (≥ 4.0) to have been built with CURVE support. Returns ------- (public, secret) : two bytestrings The public and private key pair as 40 byte z85-encoded bytestrings. |
172,833 | from zmq.error import InterruptedSystemCall, _check_rc, _check_version
from ._cffi import ffi
from ._cffi import lib as C
def _check_rc(rc, errno=None, error_without_errno=True):
"""internal utility for checking zmq return condition
and raising the appropriate Exception class
"""
if rc == -1:
... | Compute the public key corresponding to a private key for use with zmq.CURVE security Requires libzmq (≥ 4.2) to have been built with CURVE support. Parameters ---------- private The private key as a 40 byte z85-encoded bytestring Returns ------- bytestring The public key as a 40 byte z85-encoded bytestring. |
172,834 | from ._cffi import ffi
from ._cffi import lib as C
from .socket import Socket
from .utils import _retry_sys_call
def proxy(frontend, backend, capture=None):
if isinstance(capture, Socket):
capture = capture._zmq_socket
else:
capture = ffi.NULL
_retry_sys_call(C.zmq_proxy, frontend._zmq_socke... | null |
172,835 | from ._cffi import ffi
from ._cffi import lib as C
from .socket import Socket
from .utils import _retry_sys_call
class Socket:
context = None
socket_type = None
_zmq_socket = None
_closed = None
_ref = None
_shadow = False
copy_threshold = 0
def __init__(self, context=None, socket_type... | proxy_steerable(frontend, backend, capture, control) Start a zeromq proxy with control flow. .. versionadded:: libzmq-4.1 .. versionadded:: 18.0 Parameters ---------- frontend : Socket The Socket instance for the incoming traffic. backend : Socket The Socket instance for the outbound traffic. capture : Socket (optional... |
172,836 | import warnings
from zmq.error import InterruptedSystemCall, _check_rc
from ._cffi import ffi
from ._cffi import lib as C
def _make_zmq_pollitem(socket, flags):
def _make_zmq_pollitem_fromfd(socket_fd, flags):
class InterruptedSystemCall(ZMQError, InterruptedError):
def __init__(self, errno="ignored", msg="ignore... | null |
172,837 | import errno as errno_mod
from ._cffi import ffi
from ._cffi import lib as C
new_int64_pointer = lambda: (ffi.new('int64_t*'), nsp(ffi.sizeof('int64_t')))
new_int_pointer = lambda: (ffi.new('int*'), nsp(ffi.sizeof('int')))
new_binary_data = lambda length: (
ffi.new('char[%d]' % (length)),
nsp(ffi.sizeof('char')... | null |
172,838 | import errno as errno_mod
from ._cffi import ffi
from ._cffi import lib as C
import zmq
from zmq.constants import SocketOption, _OptType
from zmq.error import ZMQError, _check_rc, _check_version
from .message import Frame
from .utils import _retry_sys_call
class _OptType(Enum):
int = 'int'
int64 = 'int64'
... | null |
172,839 | import errno as errno_mod
from ._cffi import ffi
from ._cffi import lib as C
value_int64_pointer = lambda val: (ffi.new('int64_t*', val), ffi.sizeof('int64_t'))
value_int_pointer = lambda val: (ffi.new('int*', val), ffi.sizeof('int'))
value_binary_data = lambda val, length: (
ffi.new('char[%d]' % (length + 1), val)... | null |
172,840 | from ._cffi import ffi
from ._cffi import lib as C
def strerror(errno):
s = ffi.string(C.zmq_strerror(errno))
if not isinstance(s, str):
# py3
s = s.decode()
return s | null |
172,841 | import errno
from threading import Event
import zmq
import zmq.error
from zmq.constants import ETERM
from ._cffi import ffi
from ._cffi import lib as C
The provided code snippet includes necessary dependencies for implementing the `_content` function. Write a Python function `def _content(obj)` to solve the following ... | Return content of obj as bytes |
172,842 | import errno
from threading import Event
import zmq
import zmq.error
from zmq.constants import ETERM
from ._cffi import ffi
from ._cffi import lib as C
ETERM: int = Errno.ETERM
def _check_rc(rc):
err = C.zmq_errno()
if rc == -1:
if err == errno.EINTR:
raise zmq.error.InterrruptedSystemCall... | null |
172,843 | from importlib import import_module
from typing import Dict
public_api = [
'Context',
'Socket',
'Frame',
'Message',
'device',
'proxy',
'proxy_steerable',
'zmq_poll',
'strerror',
'zmq_errno',
'has',
'curve_keypair',
'curve_public',
'zmq_version_info',
'IPC_PATH... | Select the pyzmq backend |
172,844 | import struct
Z85MAP = {c: idx for idx, c in enumerate(Z85CHARS)}
_85s = [85**i for i in range(5)][::-1]
def encode(rawbytes):
"""encode raw bytes into Z85"""
# Accepts only byte arrays bounded to 4 bytes
if len(rawbytes) % 4:
raise ValueError("length must be multiple of 4, not %i" % len(rawbytes))
... | decode Z85 bytes to raw bytes, accepts ASCII string |
172,845 | import struct
from typing import Awaitable, List, Union, overload
import zmq
import zmq.asyncio
from zmq._typing import TypedDict
from zmq.error import _check_version
class _MonitorMessage(TypedDict):
event: int
value: int
endpoint: bytes
class Awaitable(Protocol[_T_co]):
def __await__(self) -> Generat... | null |
172,846 | import struct
from typing import Awaitable, List, Union, overload
import zmq
import zmq.asyncio
from zmq._typing import TypedDict
from zmq.error import _check_version
class _MonitorMessage(TypedDict):
event: int
value: int
endpoint: bytes
def recv_monitor_message(
socket: zmq.Socket[bytes],
flags: ... | null |
172,847 | import struct
from typing import Awaitable, List, Union, overload
import zmq
import zmq.asyncio
from zmq._typing import TypedDict
from zmq.error import _check_version
class _MonitorMessage(TypedDict):
event: int
value: int
endpoint: bytes
def parse_monitor_message(msg: List[bytes]) -> _MonitorMessage:
"... | Receive and decode the given raw message from the monitoring socket and return a dict. Requires libzmq ≥ 4.0 The returned dict will have the following entries: event : int, the event id as described in libzmq.zmq_socket_monitor value : int, the event value associated with the event, see libzmq.zmq_socket_monitor endpoi... |
172,848 | import json
from typing import Any, Dict, List, Union
Any = object()
The provided code snippet includes necessary dependencies for implementing the `dumps` function. Write a Python function `def dumps(o: Any, **kwargs) -> bytes` to solve the following problem:
Serialize object to JSON bytes (utf-8). Keyword arguments... | Serialize object to JSON bytes (utf-8). Keyword arguments are passed along to :py:func:`json.dumps`. |
172,849 | import json
from typing import Any, Dict, List, Union
Union: _SpecialForm = ...
List = _Alias()
Dict = _Alias()
The provided code snippet includes necessary dependencies for implementing the `loads` function. Write a Python function `def loads(s: Union[bytes, str], **kwargs) -> Union[Dict, List, str, ... | Load object from JSON bytes (utf-8). Keyword arguments are passed along to :py:func:`json.loads`. |
172,850 | import warnings
import warnings
warnings.warn("Importing from numpy.testing.utils is deprecated "
"since 1.15.0, import from numpy.testing instead.",
DeprecationWarning, stacklevel=2)
The provided code snippet includes necessary dependencies for implementing the `cast_bytes` function. Wri... | cast unicode or bytes to bytes |
172,851 | import warnings
import warnings
warnings.warn("Importing from numpy.testing.utils is deprecated "
"since 1.15.0, import from numpy.testing instead.",
DeprecationWarning, stacklevel=2)
The provided code snippet includes necessary dependencies for implementing the `cast_unicode` function. W... | cast bytes or unicode to unicode |
172,852 | from typing import Any
Any = object()
The provided code snippet includes necessary dependencies for implementing the `cast_int_addr` function. Write a Python function `def cast_int_addr(n: Any) -> int` to solve the following problem:
Cast an address to a Python int This could be a Python integer or a CFFI pointer
He... | Cast an address to a Python int This could be a Python integer or a CFFI pointer |
172,853 | from typing import List, Tuple, Union
Union: _SpecialForm = ...
List = _Alias()
class Tuple(BaseTypingInstance):
def _is_homogenous(self):
# To specify a variable-length tuple of homogeneous type, Tuple[T, ...]
# is used.
return self._generics_manager.is_homogenous_tuple()
... | null |
172,854 | from typing import List, Tuple, Union
Union: _SpecialForm = ...
List = _Alias()
class Tuple(BaseTypingInstance):
def _is_homogenous(self):
# To specify a variable-length tuple of homogeneous type, Tuple[T, ...]
# is used.
return self._generics_manager.is_homogenous_tuple()
... | null |
172,855 | from typing import List, Tuple, Union
Union: _SpecialForm = ...
List = _Alias()
class Tuple(BaseTypingInstance):
def _is_homogenous(self):
# To specify a variable-length tuple of homogeneous type, Tuple[T, ...]
# is used.
return self._generics_manager.is_homogenous_tuple()
... | null |
172,856 | from typing import List, Tuple, Union
Union: _SpecialForm = ...
List = _Alias()
class Tuple(BaseTypingInstance):
def _is_homogenous(self):
# To specify a variable-length tuple of homogeneous type, Tuple[T, ...]
# is used.
return self._generics_manager.is_homogenous_tuple()
... | null |
172,857 | from typing import List, Tuple, Union
Union: _SpecialForm = ...
List = _Alias()
class Tuple(BaseTypingInstance):
def _is_homogenous(self):
def py__simple_getitem__(self, index):
def py__iter__(self, contextualized_node=None):
def py__getitem__(self, index_value_set, contextualized_... | null |
172,858 | from typing import List, Tuple, Union
Union: _SpecialForm = ...
List = _Alias()
class Tuple(BaseTypingInstance):
def _is_homogenous(self):
# To specify a variable-length tuple of homogeneous type, Tuple[T, ...]
# is used.
return self._generics_manager.is_homogenous_tuple()
... | null |
172,859 | from typing import List, Tuple, Union
Union: _SpecialForm = ...
List = _Alias()
class Tuple(BaseTypingInstance):
def _is_homogenous(self):
# To specify a variable-length tuple of homogeneous type, Tuple[T, ...]
# is used.
return self._generics_manager.is_homogenous_tuple()
... | null |
172,860 | from typing import List, Tuple, Union
Union: _SpecialForm = ...
List = _Alias()
class Tuple(BaseTypingInstance):
def _is_homogenous(self):
# To specify a variable-length tuple of homogeneous type, Tuple[T, ...]
# is used.
return self._generics_manager.is_homogenous_tuple()
... | null |
172,861 | from typing import List, Tuple, Union
Union: _SpecialForm = ...
List = _Alias()
class Tuple(BaseTypingInstance):
def _is_homogenous(self):
# To specify a variable-length tuple of homogeneous type, Tuple[T, ...]
# is used.
return self._generics_manager.is_homogenous_tuple()
... | null |
172,862 | from typing import List, Tuple, Union
Union: _SpecialForm = ...
List = _Alias()
class Tuple(BaseTypingInstance):
def _is_homogenous(self):
# To specify a variable-length tuple of homogeneous type, Tuple[T, ...]
# is used.
return self._generics_manager.is_homogenous_tuple()
... | null |
172,863 | from typing import List, Tuple, Union
Union: _SpecialForm = ...
List = _Alias()
class Tuple(BaseTypingInstance):
def _is_homogenous(self):
# To specify a variable-length tuple of homogeneous type, Tuple[T, ...]
# is used.
return self._generics_manager.is_homogenous_tuple()
... | null |
172,864 | from typing import List, Tuple, Union
Union: _SpecialForm = ...
List = _Alias()
class Tuple(BaseTypingInstance):
def _is_homogenous(self):
def py__simple_getitem__(self, index):
def py__iter__(self, contextualized_node=None):
def py__getitem__(self, index_value_set, contextualized_... | null |
172,865 | from typing import List, Tuple, Union
Union: _SpecialForm = ...
List = _Alias()
class Tuple(BaseTypingInstance):
def _is_homogenous(self):
# To specify a variable-length tuple of homogeneous type, Tuple[T, ...]
# is used.
return self._generics_manager.is_homogenous_tuple()
... | null |
172,866 | from typing import List, Tuple, Union
Union: _SpecialForm = ...
List = _Alias()
class Tuple(BaseTypingInstance):
def _is_homogenous(self):
# To specify a variable-length tuple of homogeneous type, Tuple[T, ...]
# is used.
return self._generics_manager.is_homogenous_tuple()
... | null |
172,867 | from typing import List, Tuple, Union
Union: _SpecialForm = ...
List = _Alias()
class Tuple(BaseTypingInstance):
def _is_homogenous(self):
# To specify a variable-length tuple of homogeneous type, Tuple[T, ...]
# is used.
return self._generics_manager.is_homogenous_tuple()
... | null |
172,868 | from typing import List, Tuple, Union
Union: _SpecialForm = ...
List = _Alias()
class Tuple(BaseTypingInstance):
def _is_homogenous(self):
# To specify a variable-length tuple of homogeneous type, Tuple[T, ...]
# is used.
return self._generics_manager.is_homogenous_tuple()
... | null |
172,869 | from typing import List, Tuple, Union
Union: _SpecialForm = ...
List = _Alias()
class Tuple(BaseTypingInstance):
def _is_homogenous(self):
# To specify a variable-length tuple of homogeneous type, Tuple[T, ...]
# is used.
return self._generics_manager.is_homogenous_tuple()
... | null |
172,870 | from typing import List, Tuple, Union
Union: _SpecialForm = ...
List = _Alias()
class Tuple(BaseTypingInstance):
def _is_homogenous(self):
# To specify a variable-length tuple of homogeneous type, Tuple[T, ...]
# is used.
return self._generics_manager.is_homogenous_tuple()
... | null |
172,871 | from typing import List, Tuple, Union
Union: _SpecialForm = ...
List = _Alias()
class Tuple(BaseTypingInstance):
def _is_homogenous(self):
def py__simple_getitem__(self, index):
def py__iter__(self, contextualized_node=None):
def py__getitem__(self, index_value_set, contextualized_... | null |
172,872 | from typing import List, Tuple, Union
Union: _SpecialForm = ...
List = _Alias()
class Tuple(BaseTypingInstance):
def _is_homogenous(self):
# To specify a variable-length tuple of homogeneous type, Tuple[T, ...]
# is used.
return self._generics_manager.is_homogenous_tuple()
... | null |
172,873 | from typing import List, Tuple, Union
Union: _SpecialForm = ...
List = _Alias()
class Tuple(BaseTypingInstance):
def _is_homogenous(self):
# To specify a variable-length tuple of homogeneous type, Tuple[T, ...]
# is used.
return self._generics_manager.is_homogenous_tuple()
... | null |
172,874 | from typing import List, Tuple, Union
Union: _SpecialForm = ...
List = _Alias()
class Tuple(BaseTypingInstance):
def _is_homogenous(self):
# To specify a variable-length tuple of homogeneous type, Tuple[T, ...]
# is used.
return self._generics_manager.is_homogenous_tuple()
... | null |
172,875 | from typing import List, Tuple, Union
Union: _SpecialForm = ...
List = _Alias()
class Tuple(BaseTypingInstance):
def _is_homogenous(self):
# To specify a variable-length tuple of homogeneous type, Tuple[T, ...]
# is used.
return self._generics_manager.is_homogenous_tuple()
... | null |
172,876 | from typing import List, Tuple, Union
Union: _SpecialForm = ...
List = _Alias()
class Tuple(BaseTypingInstance):
def _is_homogenous(self):
# To specify a variable-length tuple of homogeneous type, Tuple[T, ...]
# is used.
return self._generics_manager.is_homogenous_tuple()
... | null |
172,877 | from typing import List, Tuple, Union
Union: _SpecialForm = ...
List = _Alias()
class Tuple(BaseTypingInstance):
def _is_homogenous(self):
def py__simple_getitem__(self, index):
def py__iter__(self, contextualized_node=None):
def py__getitem__(self, index_value_set, contextualized_... | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.