本文整理汇总了Python中pypy.interpreter.typedef.make_weakref_descr函数的典型用法代码示例。如果您正苦于以下问题:Python make_weakref_descr函数的具体用法?Python make_weakref_descr怎么用?Python make_weakref_descr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了make_weakref_descr函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: interp2app
seek = interp2app(W_IOBase.seek_w),
tell = interp2app(W_IOBase.tell_w),
truncate = interp2app(W_IOBase.truncate_w),
fileno = interp2app(W_IOBase.fileno_w),
isatty = interp2app(W_IOBase.isatty_w),
readable = interp2app(W_IOBase.readable_w),
writable = interp2app(W_IOBase.writable_w),
seekable = interp2app(W_IOBase.seekable_w),
_checkReadable = interp2app(check_readable_w),
_checkWritable = interp2app(check_writable_w),
_checkSeekable = interp2app(check_seekable_w),
_checkClosed = interp2app(W_IOBase.check_closed_w),
closed = GetSetProperty(W_IOBase.closed_get_w),
__dict__ = GetSetProperty(descr_get_dict, descr_set_dict, cls=W_IOBase),
__weakref__ = make_weakref_descr(W_IOBase),
readline = interp2app(W_IOBase.readline_w),
readlines = interp2app(W_IOBase.readlines_w),
writelines = interp2app(W_IOBase.writelines_w),
)
class W_RawIOBase(W_IOBase):
# ________________________________________________________________
# Abstract read methods, based on readinto()
def read_w(self, space, w_size=None):
size = convert_size(space, w_size)
if size < 0:
return space.call_method(self, "readall")
示例2: TypeDef
W_CData.typedef = TypeDef(
'_cffi_backend.CData',
__module__ = '_cffi_backend',
__name__ = '<cdata>',
__repr__ = interp2app(W_CData.repr),
__bool__ = interp2app(W_CData.bool),
__int__ = interp2app(W_CData.int),
__long__ = interp2app(W_CData.long),
__float__ = interp2app(W_CData.float),
__len__ = interp2app(W_CData.len),
__lt__ = interp2app(W_CData.lt),
__le__ = interp2app(W_CData.le),
__eq__ = interp2app(W_CData.eq),
__ne__ = interp2app(W_CData.ne),
__gt__ = interp2app(W_CData.gt),
__ge__ = interp2app(W_CData.ge),
__hash__ = interp2app(W_CData.hash),
__getitem__ = interp2app(W_CData.getitem),
__setitem__ = interp2app(W_CData.setitem),
__add__ = interp2app(W_CData.add),
__radd__ = interp2app(W_CData.add),
__sub__ = interp2app(W_CData.sub),
__getattr__ = interp2app(W_CData.getattr),
__setattr__ = interp2app(W_CData.setattr),
__call__ = interp2app(W_CData.call),
__iter__ = interp2app(W_CData.iter),
__weakref__ = make_weakref_descr(W_CData),
)
W_CData.typedef.acceptable_as_base_class = False
示例3: interp2app
W_Root, W_Root]),
__delslice__ = interp2app(W_InstanceObject.descr_delslice,
unwrap_spec=['self', ObjSpace, W_Root, W_Root]),
__call__ = interp2app(W_InstanceObject.descr_call,
unwrap_spec=['self', ObjSpace, Arguments]),
__nonzero__ = interp2app(W_InstanceObject.descr_nonzero,
unwrap_spec=['self', ObjSpace]),
__cmp__ = interp2app(W_InstanceObject.descr_cmp,
unwrap_spec=['self', ObjSpace, W_Root]),
__hash__ = interp2app(W_InstanceObject.descr_hash,
unwrap_spec=['self', ObjSpace]),
__index__ = interp2app(W_InstanceObject.descr_index,
unwrap_spec=['self', ObjSpace]),
__contains__ = interp2app(W_InstanceObject.descr_contains,
unwrap_spec=['self', ObjSpace, W_Root]),
__pow__ = interp2app(W_InstanceObject.descr_pow,
unwrap_spec=['self', ObjSpace, W_Root, W_Root]),
__rpow__ = interp2app(W_InstanceObject.descr_rpow,
unwrap_spec=['self', ObjSpace, W_Root, W_Root]),
next = interp2app(W_InstanceObject.descr_next,
unwrap_spec=['self', ObjSpace]),
__weakref__ = make_weakref_descr(W_InstanceObject),
__del__ = interp2app(W_InstanceObject.descr_del,
unwrap_spec=['self', ObjSpace]),
**rawdict
)
class W_InstanceObjectWithDel(W_InstanceObject):
def __del__(self):
self._enqueue_for_destruction(self.space)
示例4: mode
doc = "file mode ('r', 'U', 'w', 'a', "
"possibly with 'b' or '+' added)"),
encoding = interp_attrproperty('encoding', cls=W_File),
errors = interp_attrproperty('errors', cls=W_File),
closed = GetSetProperty(descr_file_closed, cls=W_File,
doc="True if the file is closed"),
newlines = GetSetProperty(descr_file_newlines, cls=W_File,
doc="end-of-line convention used in this file"),
softspace= GetSetProperty(descr_file_softspace,
descr_file_setsoftspace,
cls=W_File,
doc="Support for 'print'."),
__repr__ = interp2app(W_File.file__repr__),
writelines = interp2app(W_File.file_writelines),
__exit__ = interp2app(W_File.file__exit__),
__weakref__ = make_weakref_descr(W_File),
**dict([(name, interp2app(getattr(W_File, 'file_' + name)))
for name in W_File._exposed_method_names])
)
# ____________________________________________________________
def wrap_list_of_str(space, lst):
return space.newlist_bytes(lst)
class FileState:
def __init__(self, space):
self.openstreams = {}
def getopenstreams(space):
return space.fromcache(FileState).openstreams
示例5: fget_item
def fget_item(self, space): return self._fget('i')
def fget_length(self, space): return self._fget('l')
def fget_fields(self, space): return self._fget('f')
def fget_args(self, space): return self._fget('a')
def fget_result(self, space): return self._fget('r')
def fget_ellipsis(self, space): return self._fget('E')
def fget_abi(self, space): return self._fget('A')
def fget_elements(self, space): return self._fget('e')
def fget_relements(self, space):return self._fget('R')
W_CType.typedef = TypeDef(
'CTypeDescr',
__module__ = '_cffi_backend',
__repr__ = interp2app(W_CType.repr),
__weakref__ = make_weakref_descr(W_CType),
kind = GetSetProperty(W_CType.fget_kind, doc="kind"),
cname = GetSetProperty(W_CType.fget_cname, doc="C name"),
item = GetSetProperty(W_CType.fget_item, doc="pointer to, or array of"),
length = GetSetProperty(W_CType.fget_length, doc="array length or None"),
fields = GetSetProperty(W_CType.fget_fields, doc="struct or union fields"),
args = GetSetProperty(W_CType.fget_args, doc="function argument types"),
result = GetSetProperty(W_CType.fget_result, doc="function result type"),
ellipsis = GetSetProperty(W_CType.fget_ellipsis, doc="function has '...'"),
abi = GetSetProperty(W_CType.fget_abi, doc="function ABI"),
elements = GetSetProperty(W_CType.fget_elements, doc="enum elements"),
relements = GetSetProperty(W_CType.fget_relements,
doc="enum elements, reversed"),
__dir__ = interp2app(W_CType.dir),
)
W_CType.typedef.acceptable_as_base_class = False
示例6: objects
Methods of socket objects (keyword arguments not allowed):
accept() -- accept a connection, returning new socket and client address
bind(addr) -- bind the socket to a local address
close() -- close the socket
connect(addr) -- connect the socket to a remote address
connect_ex(addr) -- connect, return an error code instead of an exception
dup() -- return a new socket object identical to the current one [*]
fileno() -- return underlying file descriptor
getpeername() -- return remote address [*]
getsockname() -- return local address
getsockopt(level, optname[, buflen]) -- get socket options
gettimeout() -- return timeout or None
listen(n) -- start listening for incoming connections
makefile([mode, [bufsize]]) -- return a file object for the socket [*]
recv(buflen[, flags]) -- receive data
recvfrom(buflen[, flags]) -- receive data and sender's address
sendall(data[, flags]) -- send all data
send(data[, flags]) -- send data, may not send all of it
sendto(data[, flags], addr) -- send data to a given address
setblocking(0 | 1) -- set or clear the blocking I/O flag
setsockopt(level, optname, value) -- set socket options
settimeout(None | float) -- set or clear the timeout
shutdown(how) -- shut down traffic in one or both directions
[*] not available on all platforms!""",
__new__ = descr_socket_new,
__weakref__ = make_weakref_descr(W_RSocket),
** socketmethods
)
示例7: oefmt
w_result = space.call_args(w_init, __args__)
if not space.is_w(w_result, space.w_None):
raise oefmt(space.w_TypeError, "__init__() should return None")
elif __args__.arguments_w or __args__.keywords:
raise oefmt(space.w_TypeError, "this constructor takes no arguments")
return w_inst
W_ClassObject.typedef = TypeDef("classobj",
__new__ = interp2app(descr_classobj_new),
__repr__ = interp2app(W_ClassObject.descr_repr),
__str__ = interp2app(W_ClassObject.descr_str),
__call__ = interp2app(class_descr_call),
__getattribute__ = interp2app(W_ClassObject.descr_getattribute),
__setattr__ = interp2app(W_ClassObject.descr_setattr),
__delattr__ = interp2app(W_ClassObject.descr_delattr),
__weakref__ = make_weakref_descr(W_ClassObject),
)
W_ClassObject.typedef.acceptable_as_base_class = False
def make_unary_instance_method(name):
def unaryop(self, space):
w_meth = self.getattr(space, name, True)
return space.call_function(w_meth)
unaryop.func_name = name
return unaryop
def make_binary_returning_notimplemented_instance_method(name):
def binaryop(self, space, w_other):
try:
w_meth = self.getattr(space, name, False)
示例8: TypeDef
srepat.space = space
srepat.w_pattern = w_pattern # the original uncompiled pattern
srepat.flags = flags
srepat.code = code
srepat.num_groups = groups
srepat.w_groupindex = w_groupindex
srepat.w_indexgroup = w_indexgroup
return w_srepat
W_SRE_Pattern.typedef = TypeDef(
'SRE_Pattern',
__new__ = interp2app(SRE_Pattern__new__),
__copy__ = interp2app(W_SRE_Pattern.cannot_copy_w),
__deepcopy__ = interp2app(W_SRE_Pattern.cannot_copy_w),
__weakref__ = make_weakref_descr(W_SRE_Pattern),
findall = interp2app(W_SRE_Pattern.findall_w),
finditer = interp2app(W_SRE_Pattern.finditer_w),
match = interp2app(W_SRE_Pattern.match_w),
scanner = interp2app(W_SRE_Pattern.finditer_w), # reuse finditer()
search = interp2app(W_SRE_Pattern.search_w),
split = interp2app(W_SRE_Pattern.split_w),
sub = interp2app(W_SRE_Pattern.sub_w),
subn = interp2app(W_SRE_Pattern.subn_w),
flags = interp_attrproperty('flags', W_SRE_Pattern),
groupindex = interp_attrproperty_w('w_groupindex', W_SRE_Pattern),
groups = interp_attrproperty('num_groups', W_SRE_Pattern),
pattern = interp_attrproperty_w('w_pattern', W_SRE_Pattern),
)
# ____________________________________________________________
示例9: W_TeeIterable___new__
def W_TeeIterable___new__(space, w_subtype, w_iterable):
# Obscure and undocumented function. PyPy only supports w_iterable
# being a W_TeeIterable, because the case where it is a general
# iterable is useless and confusing as far as I can tell (as the
# semantics are then slightly different; see the XXX in lib-python's
# test_itertools).
myiter = space.interp_w(W_TeeIterable, w_iterable)
return space.wrap(W_TeeIterable(space, myiter.w_iterator,
myiter.chained_list))
W_TeeIterable.typedef = TypeDef(
'itertools._tee',
__new__ = interp2app(W_TeeIterable___new__),
__iter__ = interp2app(W_TeeIterable.iter_w),
__next__ = interp2app(W_TeeIterable.next_w),
__weakref__ = make_weakref_descr(W_TeeIterable),
)
W_TeeIterable.typedef.acceptable_as_base_class = False
class W_GroupBy(W_Root):
def __init__(self, space, w_iterable, w_fun):
self.space = space
self.w_iterable = self.space.iter(w_iterable)
if space.is_none(w_fun):
self.w_fun = None
else:
self.w_fun = w_fun
self.index = 0
self.lookahead = False
self.exhausted = False
示例10: descr_setitem
self.keepalive = keepalive
def descr_setitem(self, space, w_index, w_obj):
try:
W_Buffer.descr_setitem(self, space, w_index, w_obj)
except OperationError as e:
if e.match(space, space.w_TypeError):
e.w_type = space.w_ValueError
raise
MiniBuffer.typedef = TypeDef(
"_cffi_backend.buffer",
__len__ = interp2app(MiniBuffer.descr_len),
__getitem__ = interp2app(MiniBuffer.descr_getitem),
__setitem__ = interp2app(MiniBuffer.descr_setitem),
__weakref__ = make_weakref_descr(MiniBuffer),
__str__ = interp2app(MiniBuffer.descr_str),
)
MiniBuffer.typedef.acceptable_as_base_class = False
@unwrap_spec(w_cdata=cdataobj.W_CData, size=int)
def buffer(space, w_cdata, size=-1):
ctype = w_cdata.ctype
if isinstance(ctype, ctypeptr.W_CTypePointer):
if size < 0:
structobj = w_cdata.get_structobj()
if (structobj is not None and
isinstance(structobj.ctype, ctypestruct.W_CTypeStructOrUnion)):
size = structobj._sizeof()
if size < 0:
示例11: interp2app
Build an ordered collection accessible from endpoints only.""",
__new__ = interp2app(descr__new__),
__init__ = interp2app(W_Deque.init),
append = interp2app(W_Deque.append),
appendleft = interp2app(W_Deque.appendleft),
clear = interp2app(W_Deque.clear),
count = interp2app(W_Deque.count),
extend = interp2app(W_Deque.extend),
extendleft = interp2app(W_Deque.extendleft),
pop = interp2app(W_Deque.pop),
popleft = interp2app(W_Deque.popleft),
remove = interp2app(W_Deque.remove),
reverse = interp2app(W_Deque.reverse),
rotate = interp2app(W_Deque.rotate),
__weakref__ = make_weakref_descr(W_Deque),
__iter__ = interp2app(W_Deque.iter),
__reversed__ = interp2app(W_Deque.reviter),
__len__ = interp2app(W_Deque.length),
__repr__ = interp2app(W_Deque.repr),
__lt__ = interp2app(W_Deque.lt),
__le__ = interp2app(W_Deque.le),
__eq__ = interp2app(W_Deque.eq),
__ne__ = interp2app(W_Deque.ne),
__gt__ = interp2app(W_Deque.gt),
__ge__ = interp2app(W_Deque.ge),
__hash__ = None,
__iadd__ = interp2app(W_Deque.iadd),
__getitem__ = interp2app(W_Deque.getitem),
__setitem__ = interp2app(W_Deque.setitem),
__delitem__ = interp2app(W_Deque.delitem),