def attrgetter(attr, *attrs): if attrs: getters = [single_attr_getter(a) for a in (attr,) + attrs] def getter(obj): return tuple([getter(obj) for getter in getters]) else: getter = single_attr_getter(attr) return builtinify(getter)
def itemgetter(item, *items): if items: list_of_indices = [item] + list(items) def getter(obj): return tuple([obj[i] for i in list_of_indices]) else: def getter(obj): return obj[item] return builtinify(getter)
def make_new_hash(name, funcname): def new_hash(string=b''): return new(name, string) new_hash.__name__ = funcname return builtinify(new_hash)
class A(object): a = lambda *args: args b = __pypy__.builtinify(a)
from _cffi_ssl._stdssl import (_PROTOCOL_NAMES, _OPENSSL_API_VERSION, _test_decode_cert, _SSLContext, _DEFAULT_CIPHERS) from _cffi_ssl import _stdssl from _cffi_ssl._stdssl import * OP_SINGLE_DH_USE = lib.SSL_OP_SINGLE_DH_USE OP_SINGLE_ECDH_USE = lib.SSL_OP_SINGLE_ECDH_USE try: from __pypy__ import builtinify except ImportError: builtinify = lambda f: f RAND_add = builtinify(RAND_add) RAND_bytes = builtinify(RAND_bytes) RAND_pseudo_bytes = builtinify(RAND_pseudo_bytes) RAND_status = builtinify(RAND_status) # RAND_egd is optional and might not be available on e.g. libressl if hasattr(_stdssl, 'RAND_egd'): RAND_egd = builtinify(RAND_egd) import sys if sys.platform == "win32": if 'enum_certificates' not in globals(): def enum_certificates(*args, **kwds): import warnings warnings.warn("ssl.enum_certificates() is not implemented") return []
def methodcaller(method_name, *args, **kwargs): def call(obj): return getattr(obj, method_name)(*args, **kwargs) return builtinify(call)