mirror of
https://github.com/capnproto/pycapnp.git
synced 2025-03-04 08:24:43 +01:00
Fix build for Cython 0.21
This commit is contained in:
parent
e36f0bdc6b
commit
e8ddfb9e91
7 changed files with 135 additions and 135 deletions
|
@ -1,6 +1,6 @@
|
|||
from .capnp.includes.capnp_cpp cimport Maybe, DynamicStruct, Request, PyPromise, VoidPromise, PyPromiseArray, RemotePromise, DynamicCapability, InterfaceSchema, EnumSchema, StructSchema, DynamicValue, Capability, RpcSystem, MessageBuilder, MessageReader, TwoPartyVatNetwork, PyRestorer, AnyPointer, DynamicStruct_Builder, WaitScope, AsyncIoContext, StringPtr, TaskSet
|
||||
from capnp.includes.capnp_cpp cimport Maybe, DynamicStruct, Request, PyPromise, VoidPromise, PyPromiseArray, RemotePromise, DynamicCapability, InterfaceSchema, EnumSchema, StructSchema, DynamicValue, Capability, RpcSystem, MessageBuilder, MessageReader, TwoPartyVatNetwork, PyRestorer, AnyPointer, DynamicStruct_Builder, WaitScope, AsyncIoContext, StringPtr, TaskSet
|
||||
|
||||
from .capnp.includes.schema_cpp cimport ByteArray
|
||||
from capnp.includes.schema_cpp cimport ByteArray
|
||||
|
||||
from non_circular cimport reraise_kj_exception
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@ cdef extern from "../helpers/checkCompiler.h":
|
|||
pass
|
||||
|
||||
from schema_cpp cimport Node, Data, StructNode, EnumNode, InterfaceNode, MessageBuilder, MessageReader
|
||||
from .capnp.helpers.non_circular cimport PythonInterfaceDynamicImpl, reraise_kj_exception, PyRefCounter, PyRestorer, PyEventPort, ErrorHandler
|
||||
from .capnp.includes.types cimport *
|
||||
from capnp.helpers.non_circular cimport PythonInterfaceDynamicImpl, reraise_kj_exception, PyRefCounter, PyRestorer, PyEventPort, ErrorHandler
|
||||
from capnp.includes.types cimport *
|
||||
|
||||
cdef extern from "capnp/common.h" namespace " ::capnp":
|
||||
enum Void:
|
||||
|
@ -43,7 +43,7 @@ cdef extern from "kj/exception.h" namespace " ::kj":
|
|||
int getDurability()
|
||||
StringPtr getDescription()
|
||||
|
||||
cdef extern from "kj/memory.h" namespace " ::kj":
|
||||
cdef extern from "kj/memory.h" namespace " ::kj":
|
||||
cdef cppclass Own[T]:
|
||||
T& operator*()
|
||||
Own[TwoPartyVatNetwork] makeTwoPartyVatNetwork" ::kj::heap< ::capnp::TwoPartyVatNetwork>"(AsyncIoStream& stream, Side)
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
|
||||
from libc.stdint cimport *
|
||||
from capnp_cpp cimport DynamicOrphan
|
||||
from .capnp.helpers.non_circular cimport reraise_kj_exception
|
||||
from capnp.helpers.non_circular cimport reraise_kj_exception
|
||||
|
||||
from .capnp.includes.types cimport *
|
||||
from capnp.includes.types cimport *
|
||||
|
||||
cdef extern from "capnp/dynamic.h" namespace " ::capnp":
|
||||
cdef cppclass DynamicValue:
|
||||
|
@ -34,7 +34,7 @@ cdef extern from "capnp/any.h" namespace " ::capnp":
|
|||
pass
|
||||
cppclass Builder:
|
||||
pass
|
||||
|
||||
|
||||
cdef extern from "capnp/blob.h" namespace " ::capnp":
|
||||
cdef cppclass Data:
|
||||
cppclass Reader:
|
||||
|
@ -118,7 +118,7 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
|
|||
_StructNode_Member_Body_fieldMember " ::capnp::schema::StructNode::Member::Body::Which::FIELD_MEMBER"
|
||||
_StructNode_Member_Body_unionMember " ::capnp::schema::StructNode::Member::Body::Which::UNION_MEMBER"
|
||||
cdef cppclass CodeGeneratorRequest
|
||||
|
||||
|
||||
cdef cppclass InterfaceNode
|
||||
cdef cppclass Value
|
||||
cdef cppclass ConstNode
|
||||
|
@ -131,13 +131,13 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
|
|||
cdef cppclass Annotation
|
||||
cdef cppclass CodeGeneratorRequest:
|
||||
|
||||
|
||||
|
||||
cppclass Reader:
|
||||
|
||||
|
||||
List[CodeGeneratorRequest.Node].Reader getNodes()
|
||||
List[UInt64].Reader getRequestedFiles()
|
||||
cppclass Builder:
|
||||
|
||||
|
||||
List[CodeGeneratorRequest.Node].Builder getNodes()
|
||||
List[CodeGeneratorRequest.Node].Builder initNodes(int)
|
||||
List[UInt64].Builder getRequestedFiles()
|
||||
|
@ -145,22 +145,22 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
|
|||
cdef cppclass InterfaceNode:
|
||||
cppclass Method
|
||||
|
||||
|
||||
|
||||
cppclass Method:
|
||||
cppclass Param
|
||||
|
||||
|
||||
|
||||
|
||||
cppclass Param:
|
||||
|
||||
|
||||
|
||||
|
||||
cppclass Reader:
|
||||
|
||||
|
||||
Value getDefaultValue()
|
||||
Type getType()
|
||||
Text.Reader getName()
|
||||
List[InterfaceNode.Method.Param.Annotation].Reader getAnnotations()
|
||||
cppclass Builder:
|
||||
|
||||
|
||||
Value getDefaultValue()
|
||||
void setDefaultValue(Value)
|
||||
Type getType()
|
||||
|
@ -170,7 +170,7 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
|
|||
List[InterfaceNode.Method.Param.Annotation].Builder getAnnotations()
|
||||
List[InterfaceNode.Method.Param.Annotation].Builder initAnnotations(int)
|
||||
cppclass Reader:
|
||||
|
||||
|
||||
UInt16 getCodeOrder()
|
||||
Text.Reader getName()
|
||||
List[InterfaceNode.Method.InterfaceNode.Method.Param].Reader getParams()
|
||||
|
@ -178,7 +178,7 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
|
|||
Type getReturnType()
|
||||
List[InterfaceNode.Method.Annotation].Reader getAnnotations()
|
||||
cppclass Builder:
|
||||
|
||||
|
||||
UInt16 getCodeOrder()
|
||||
void setCodeOrder(UInt16)
|
||||
Text.Builder getName()
|
||||
|
@ -192,19 +192,19 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
|
|||
List[InterfaceNode.Method.Annotation].Builder getAnnotations()
|
||||
List[InterfaceNode.Method.Annotation].Builder initAnnotations(int)
|
||||
cppclass Reader:
|
||||
|
||||
|
||||
List[InterfaceNode.InterfaceNode.Method].Reader getMethods()
|
||||
cppclass Builder:
|
||||
|
||||
|
||||
List[InterfaceNode.InterfaceNode.Method].Builder getMethods()
|
||||
List[InterfaceNode.InterfaceNode.Method].Builder initMethods(int)
|
||||
cdef cppclass Value:
|
||||
cppclass Body
|
||||
|
||||
|
||||
|
||||
cppclass Body:
|
||||
|
||||
|
||||
|
||||
|
||||
cppclass Reader:
|
||||
int which()
|
||||
UInt32 getUint32Value()
|
||||
|
@ -267,21 +267,21 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
|
|||
Object getObjectValue()
|
||||
void setObjectValue(Object)
|
||||
cppclass Reader:
|
||||
|
||||
|
||||
Value.Body getBody()
|
||||
cppclass Builder:
|
||||
|
||||
|
||||
Value.Body getBody()
|
||||
void setBody(Value.Body)
|
||||
cdef cppclass ConstNode:
|
||||
|
||||
|
||||
|
||||
cppclass Reader:
|
||||
|
||||
|
||||
Type getType()
|
||||
Value getValue()
|
||||
cppclass Builder:
|
||||
|
||||
|
||||
Type getType()
|
||||
void setType(Type)
|
||||
Value getValue()
|
||||
|
@ -289,10 +289,10 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
|
|||
cdef cppclass Type:
|
||||
cppclass Body
|
||||
|
||||
|
||||
|
||||
cppclass Body:
|
||||
|
||||
|
||||
|
||||
|
||||
cppclass Reader:
|
||||
int which()
|
||||
Void getBoolType()
|
||||
|
@ -355,44 +355,44 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
|
|||
Void getInt16Type()
|
||||
void setInt16Type(Void)
|
||||
cppclass Reader:
|
||||
|
||||
|
||||
Type.Body getBody()
|
||||
cppclass Builder:
|
||||
|
||||
|
||||
Type.Body getBody()
|
||||
void setBody(Type.Body)
|
||||
cdef cppclass FileNode:
|
||||
cppclass Import
|
||||
|
||||
|
||||
|
||||
cppclass Import:
|
||||
|
||||
|
||||
|
||||
|
||||
cppclass Reader:
|
||||
|
||||
|
||||
UInt64 getId()
|
||||
Text.Reader getName()
|
||||
cppclass Builder:
|
||||
|
||||
|
||||
UInt64 getId()
|
||||
void setId(UInt64)
|
||||
Text.Builder getName()
|
||||
void setName(Text)
|
||||
cppclass Reader:
|
||||
|
||||
|
||||
List[FileNode.FileNode.Import].Reader getImports()
|
||||
cppclass Builder:
|
||||
|
||||
|
||||
List[FileNode.FileNode.Import].Builder getImports()
|
||||
List[FileNode.FileNode.Import].Builder initImports(int)
|
||||
cdef cppclass Node:
|
||||
cppclass Body
|
||||
cppclass NestedNode
|
||||
|
||||
|
||||
|
||||
cppclass Body:
|
||||
|
||||
|
||||
|
||||
|
||||
cppclass Reader:
|
||||
int which()
|
||||
AnnotationNode getAnnotationNode()
|
||||
|
@ -416,20 +416,20 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
|
|||
FileNode getFileNode()
|
||||
void setFileNode(FileNode)
|
||||
cppclass NestedNode:
|
||||
|
||||
|
||||
|
||||
|
||||
cppclass Reader:
|
||||
|
||||
|
||||
Text.Reader getName()
|
||||
UInt64 getId()
|
||||
cppclass Builder:
|
||||
|
||||
|
||||
Text.Builder getName()
|
||||
void setName(Text)
|
||||
UInt64 getId()
|
||||
void setId(UInt64)
|
||||
cppclass Reader:
|
||||
|
||||
|
||||
Node.Body getBody()
|
||||
Text.Reader getDisplayName()
|
||||
List[Node.Annotation].Reader getAnnotations()
|
||||
|
@ -443,7 +443,7 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
|
|||
bint isConst()
|
||||
bint isAnnotation()
|
||||
cppclass Builder:
|
||||
|
||||
|
||||
Node.Body getBody()
|
||||
void setBody(Node.Body)
|
||||
Text.Builder getDisplayName()
|
||||
|
@ -464,9 +464,9 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
|
|||
bint isAnnotation()
|
||||
cdef cppclass AnnotationNode:
|
||||
|
||||
|
||||
|
||||
cppclass Reader:
|
||||
|
||||
|
||||
Bool getTargetsField()
|
||||
Bool getTargetsConst()
|
||||
Bool getTargetsFile()
|
||||
|
@ -480,7 +480,7 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
|
|||
Bool getTargetsInterface()
|
||||
Bool getTargetsMethod()
|
||||
cppclass Builder:
|
||||
|
||||
|
||||
Bool getTargetsField()
|
||||
void setTargetsField(Bool)
|
||||
Bool getTargetsConst()
|
||||
|
@ -508,17 +508,17 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
|
|||
cdef cppclass EnumNode:
|
||||
cppclass Enumerant
|
||||
|
||||
|
||||
|
||||
cppclass Enumerant:
|
||||
|
||||
|
||||
|
||||
|
||||
cppclass Reader:
|
||||
|
||||
|
||||
UInt16 getCodeOrder()
|
||||
Text.Reader getName()
|
||||
List[EnumNode.Enumerant.Annotation].Reader getAnnotations()
|
||||
cppclass Builder:
|
||||
|
||||
|
||||
UInt16 getCodeOrder()
|
||||
void setCodeOrder(UInt16)
|
||||
Text.Builder getName()
|
||||
|
@ -526,10 +526,10 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
|
|||
List[EnumNode.Enumerant.Annotation].Builder getAnnotations()
|
||||
List[EnumNode.Enumerant.Annotation].Builder initAnnotations(int)
|
||||
cppclass Reader:
|
||||
|
||||
|
||||
List[EnumNode.EnumNode.Enumerant].Reader getEnumerants()
|
||||
cppclass Builder:
|
||||
|
||||
|
||||
List[EnumNode.EnumNode.Enumerant].Builder getEnumerants()
|
||||
List[EnumNode.EnumNode.Enumerant].Builder initEnumerants(int)
|
||||
cdef cppclass StructNode:
|
||||
|
@ -537,27 +537,27 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
|
|||
cppclass Member
|
||||
cppclass Field
|
||||
|
||||
|
||||
|
||||
cppclass Union:
|
||||
|
||||
|
||||
|
||||
|
||||
cppclass Reader:
|
||||
|
||||
|
||||
UInt32 getDiscriminantOffset()
|
||||
List[StructNode.Union.StructNode.Member].Reader getMembers()
|
||||
cppclass Builder:
|
||||
|
||||
|
||||
UInt32 getDiscriminantOffset()
|
||||
void setDiscriminantOffset(UInt32)
|
||||
List[StructNode.Union.StructNode.Member].Builder getMembers()
|
||||
List[StructNode.Union.StructNode.Member].Builder initMembers(int)
|
||||
cppclass Member:
|
||||
cppclass Body
|
||||
|
||||
|
||||
|
||||
|
||||
cppclass Body:
|
||||
|
||||
|
||||
|
||||
|
||||
cppclass Reader:
|
||||
int which()
|
||||
Field getFieldMember()
|
||||
|
@ -569,14 +569,14 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
|
|||
Union getUnionMember()
|
||||
void setUnionMember(Union)
|
||||
cppclass Reader:
|
||||
|
||||
|
||||
UInt16 getOrdinal()
|
||||
StructNode.Member.Body getBody()
|
||||
UInt16 getCodeOrder()
|
||||
Text.Reader getName()
|
||||
List[StructNode.Member.Annotation].Reader getAnnotations()
|
||||
cppclass Builder:
|
||||
|
||||
|
||||
UInt16 getOrdinal()
|
||||
void setOrdinal(UInt16)
|
||||
StructNode.Member.Body getBody()
|
||||
|
@ -588,15 +588,15 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
|
|||
List[StructNode.Member.Annotation].Builder getAnnotations()
|
||||
List[StructNode.Member.Annotation].Builder initAnnotations(int)
|
||||
cppclass Field:
|
||||
|
||||
|
||||
|
||||
|
||||
cppclass Reader:
|
||||
|
||||
|
||||
Value getDefaultValue()
|
||||
Type getType()
|
||||
UInt32 getOffset()
|
||||
cppclass Builder:
|
||||
|
||||
|
||||
Value getDefaultValue()
|
||||
void setDefaultValue(Value)
|
||||
Type getType()
|
||||
|
@ -604,12 +604,12 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
|
|||
UInt32 getOffset()
|
||||
void setOffset(UInt32)
|
||||
cppclass Reader:
|
||||
|
||||
|
||||
UInt16 getDataSectionWordSize()
|
||||
List[StructNode.StructNode.Member].Reader getMembers()
|
||||
UInt16 getPointerSectionSize()
|
||||
cppclass Builder:
|
||||
|
||||
|
||||
UInt16 getDataSectionWordSize()
|
||||
void setDataSectionWordSize(UInt16)
|
||||
List[StructNode.StructNode.Member].Builder getMembers()
|
||||
|
@ -618,13 +618,13 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
|
|||
void setPointerSectionSize(UInt16)
|
||||
cdef cppclass Annotation:
|
||||
|
||||
|
||||
|
||||
cppclass Reader:
|
||||
|
||||
|
||||
UInt64 getId()
|
||||
Value getValue()
|
||||
cppclass Builder:
|
||||
|
||||
|
||||
UInt64 getId()
|
||||
void setId(UInt64)
|
||||
Value getValue()
|
||||
|
@ -658,7 +658,7 @@ cdef extern from "capnp/message.h" namespace " ::capnp":
|
|||
StructNode.Builder initRootStructNode'initRoot< ::capnp::schema::StructNode>'()
|
||||
Annotation.Builder getRootAnnotation'getRoot< ::capnp::schema::Annotation>'()
|
||||
Annotation.Builder initRootAnnotation'initRoot< ::capnp::schema::Annotation>'()
|
||||
|
||||
|
||||
DynamicStruct_Builder getRootDynamicStruct'getRoot< ::capnp::DynamicStruct>'(StructSchema)
|
||||
DynamicStruct_Builder initRootDynamicStruct'initRoot< ::capnp::DynamicStruct>'(StructSchema)
|
||||
void setRootDynamicStruct'setRoot< ::capnp::DynamicStruct::Reader>'(DynamicStruct.Reader)
|
||||
|
@ -682,7 +682,7 @@ cdef extern from "capnp/message.h" namespace " ::capnp":
|
|||
|
||||
DynamicStruct.Reader getRootDynamicStruct'getRoot< ::capnp::DynamicStruct>'(StructSchema)
|
||||
AnyPointer.Reader getRootAnyPointer'getRoot< ::capnp::AnyPointer>'()
|
||||
|
||||
|
||||
cdef cppclass MallocMessageBuilder(MessageBuilder):
|
||||
MallocMessageBuilder()
|
||||
MallocMessageBuilder(int)
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
from .capnp.includes cimport capnp_cpp as capnp
|
||||
from .capnp.includes cimport schema_cpp
|
||||
from .capnp.includes.capnp_cpp cimport Schema as C_Schema, StructSchema as C_StructSchema, InterfaceSchema as C_InterfaceSchema, EnumSchema as C_EnumSchema, DynamicStruct as C_DynamicStruct, DynamicValue as C_DynamicValue, Type as C_Type, DynamicList as C_DynamicList, SchemaParser as C_SchemaParser, ParsedSchema as C_ParsedSchema, VOID, ArrayPtr, StringPtr, String, StringTree, DynamicOrphan as C_DynamicOrphan, AnyPointer as C_DynamicObject, DynamicCapability as C_DynamicCapability, Request, Response, RemotePromise, PyPromise, VoidPromise, CallContext, PyRestorer, RpcSystem, makeRpcServer, makeRpcClient, Capability as C_Capability, TwoPartyVatNetwork as C_TwoPartyVatNetwork, Side, AsyncIoStream, Own, makeTwoPartyVatNetwork, PromiseFulfillerPair as C_PromiseFulfillerPair, copyPromiseFulfillerPair, newPromiseAndFulfiller, PyArray, DynamicStruct_Builder
|
||||
from .capnp.includes.schema_cpp cimport Node as C_Node, EnumNode as C_EnumNode
|
||||
from .capnp.includes.types cimport *
|
||||
from .capnp.helpers.non_circular cimport reraise_kj_exception
|
||||
from .capnp.helpers cimport helpers
|
||||
from capnp.includes cimport capnp_cpp as capnp
|
||||
from capnp.includes cimport schema_cpp
|
||||
from capnp.includes.capnp_cpp cimport Schema as C_Schema, StructSchema as C_StructSchema, InterfaceSchema as C_InterfaceSchema, EnumSchema as C_EnumSchema, DynamicStruct as C_DynamicStruct, DynamicValue as C_DynamicValue, Type as C_Type, DynamicList as C_DynamicList, SchemaParser as C_SchemaParser, ParsedSchema as C_ParsedSchema, VOID, ArrayPtr, StringPtr, String, StringTree, DynamicOrphan as C_DynamicOrphan, AnyPointer as C_DynamicObject, DynamicCapability as C_DynamicCapability, Request, Response, RemotePromise, PyPromise, VoidPromise, CallContext, PyRestorer, RpcSystem, makeRpcServer, makeRpcClient, Capability as C_Capability, TwoPartyVatNetwork as C_TwoPartyVatNetwork, Side, AsyncIoStream, Own, makeTwoPartyVatNetwork, PromiseFulfillerPair as C_PromiseFulfillerPair, copyPromiseFulfillerPair, newPromiseAndFulfiller, PyArray, DynamicStruct_Builder
|
||||
from capnp.includes.schema_cpp cimport Node as C_Node, EnumNode as C_EnumNode
|
||||
from capnp.includes.types cimport *
|
||||
from capnp.helpers.non_circular cimport reraise_kj_exception
|
||||
from capnp.helpers cimport helpers
|
||||
|
||||
cdef class _DynamicStructReader:
|
||||
cdef C_DynamicStruct.Reader thisptr
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
cimport cython
|
||||
|
||||
from .capnp.helpers.helpers cimport makeRpcClientWithRestorer
|
||||
from capnp.helpers.helpers cimport makeRpcClientWithRestorer
|
||||
|
||||
from libc.stdlib cimport malloc, free
|
||||
from cython.operator cimport dereference as deref
|
||||
|
@ -100,7 +100,7 @@ cdef public VoidPromise * call_server_method(PyObject * _server, char * _method_
|
|||
setattr(results, arg_name, arg_val)
|
||||
|
||||
return NULL
|
||||
|
||||
|
||||
cdef public C_Capability.Client * call_py_restorer(PyObject * _restorer, C_DynamicObject.Reader & _reader) except *:
|
||||
restorer = <object>_restorer
|
||||
reader = _DynamicObjectReader()._init(_reader, None)
|
||||
|
@ -149,13 +149,13 @@ def _make_enum(enum_name, *sequential, **named):
|
|||
enums['reverse_mapping'] = reverse
|
||||
return type(enum_name, (), enums)
|
||||
|
||||
_Nature = _make_enum('_Nature',
|
||||
_Nature = _make_enum('_Nature',
|
||||
PRECONDITION = 0,
|
||||
LOCAL_BUG = 1,
|
||||
OS_ERROR = 2,
|
||||
NETWORK_FAILURE = 3,
|
||||
OTHER = 4)
|
||||
_Durability = _make_enum('_Durability',
|
||||
_Durability = _make_enum('_Durability',
|
||||
PERMANENT = 0,
|
||||
TEMPORARY = 1,
|
||||
OVERLOADED = 2)
|
||||
|
@ -207,7 +207,7 @@ class KjException(Exception):
|
|||
self.message = message
|
||||
self.nature = nature
|
||||
self.durability = durability
|
||||
|
||||
|
||||
@property
|
||||
def file(self):
|
||||
return self.wrapper.file
|
||||
|
@ -246,7 +246,7 @@ cdef public object wrap_kj_exception(capnp.Exception & exception):
|
|||
cdef public object wrap_kj_exception_for_reraise(capnp.Exception & exception):
|
||||
wrapper = _KjExceptionWrapper()._init(exception)
|
||||
wrapper_msg = str(wrapper)
|
||||
|
||||
|
||||
nature = wrapper.nature
|
||||
|
||||
if wrapper.nature == 'PRECONDITION':
|
||||
|
@ -415,7 +415,7 @@ cdef class _DynamicResizableListBuilder:
|
|||
person = addressbook.Person.new_message()
|
||||
|
||||
phones = person.init_resizable_list('phones') # This returns a _DynamicResizableListBuilder
|
||||
|
||||
|
||||
phone = phones.add()
|
||||
phone.number = 'foo'
|
||||
phone = phones.add()
|
||||
|
@ -447,7 +447,7 @@ cdef class _DynamicResizableListBuilder:
|
|||
orphan_val = orphan.get()
|
||||
self._list.append((orphan, orphan_val))
|
||||
return orphan_val
|
||||
|
||||
|
||||
def __getitem__(self, index):
|
||||
return self._list[index][1]
|
||||
|
||||
|
@ -477,7 +477,7 @@ cdef class _DynamicListBuilder:
|
|||
person = addressbook.Person.new_message()
|
||||
|
||||
phones = person.init('phones', 2) # This returns a _DynamicListBuilder
|
||||
|
||||
|
||||
phone = phones[0]
|
||||
phone.number = 'foo'
|
||||
phone = phones[1]
|
||||
|
@ -942,7 +942,7 @@ cdef class _DynamicStructBuilder:
|
|||
This class is almost a 1 for 1 wrapping of the Cap'n Proto C++ DynamicStruct::Builder. The only difference is that instead of a `get`/`set` method, __getattr__/__setattr__ is overloaded and the field name is passed onto the C++ equivalent function. This means you just use . syntax to access or set any field. For field names that don't follow valid python naming convention for fields, use the global functions :py:func:`getattr`/:py:func:`setattr`::
|
||||
|
||||
person = addressbook.Person.new_message() # This returns a _DynamicStructBuilder
|
||||
|
||||
|
||||
person.name = 'foo' # using . syntax
|
||||
print person.name # using . syntax
|
||||
|
||||
|
@ -968,15 +968,15 @@ cdef class _DynamicStructBuilder:
|
|||
|
||||
def write(self, file):
|
||||
"""Writes the struct's containing message to the given file object in unpacked binary format.
|
||||
|
||||
|
||||
This is a shortcut for calling capnp._write_message_to_fd(). This can only be called on the
|
||||
message's root struct.
|
||||
|
||||
|
||||
:type file: file
|
||||
:param file: A file or socket object (or anything with a fileno() method), open for write.
|
||||
|
||||
|
||||
:rtype: void
|
||||
|
||||
|
||||
:Raises: :exc:`exceptions.ValueError` if this isn't the message's root struct.
|
||||
"""
|
||||
self._check_write()
|
||||
|
@ -985,15 +985,15 @@ cdef class _DynamicStructBuilder:
|
|||
|
||||
def write_packed(self, file):
|
||||
"""Writes the struct's containing message to the given file object in packed binary format.
|
||||
|
||||
|
||||
This is a shortcut for calling capnp._write_packed_message_to_fd(). This can only be called on
|
||||
the message's root struct.
|
||||
|
||||
|
||||
:type file: file
|
||||
:param file: A file or socket object (or anything with a fileno() method), open for write.
|
||||
|
||||
|
||||
:rtype: void
|
||||
|
||||
|
||||
:Raises: :exc:`exceptions.ValueError` if this isn't the message's root struct.
|
||||
"""
|
||||
self._check_write()
|
||||
|
@ -1044,7 +1044,7 @@ cdef class _DynamicStructBuilder:
|
|||
cdef C_DynamicValue.Builder value = self.thisptr.get(field)
|
||||
|
||||
return to_python_builder(value, self._parent)
|
||||
|
||||
|
||||
def __getattr__(self, field):
|
||||
return self._get(field)
|
||||
|
||||
|
@ -1060,7 +1060,7 @@ cdef class _DynamicStructBuilder:
|
|||
cpdef init(self, field, size=None):
|
||||
"""Method for initializing fields that are of type union/struct/list
|
||||
|
||||
Typically, you don't have to worry about initializing structs/unions, so this method is mainly for lists.
|
||||
Typically, you don't have to worry about initializing structs/unions, so this method is mainly for lists.
|
||||
|
||||
:type field: str
|
||||
:param field: The field name to initialize
|
||||
|
@ -1080,7 +1080,7 @@ cdef class _DynamicStructBuilder:
|
|||
cpdef init_resizable_list(self, field):
|
||||
"""Method for initializing fields that are of type list (of structs)
|
||||
|
||||
This version of init returns a :class:`_DynamicResizableListBuilder` that allows you to add members one at a time (ie. if you don't know the size for sure). This is only meant for lists of Cap'n Proto objects, since for primitive types you can just define a normal python list and fill it yourself.
|
||||
This version of init returns a :class:`_DynamicResizableListBuilder` that allows you to add members one at a time (ie. if you don't know the size for sure). This is only meant for lists of Cap'n Proto objects, since for primitive types you can just define a normal python list and fill it yourself.
|
||||
|
||||
.. warning:: You need to call :meth:`_DynamicResizableListBuilder.finish` on the list object before serializing the Cap'n Proto message. Failure to do so will cause your objects not to be written out as well as leaking orphan structs into your message.
|
||||
|
||||
|
@ -1854,7 +1854,7 @@ cdef class TwoPartyClient:
|
|||
return sock
|
||||
|
||||
cpdef restore(self, objectId) except +reraise_kj_exception:
|
||||
cdef _MessageBuilder builder
|
||||
cdef _MessageBuilder builder
|
||||
cdef _MessageReader reader
|
||||
cdef _DynamicObjectBuilder object_builder
|
||||
cdef _DynamicObjectReader object_reader
|
||||
|
@ -2191,7 +2191,7 @@ class _StructModule(object):
|
|||
if field.which() == 'group':
|
||||
name = field.name.capitalize()
|
||||
union_schema = schema.get_dependency(field.group.typeId).node.struct
|
||||
|
||||
|
||||
if union_schema.discriminantCount == 0:
|
||||
continue
|
||||
|
||||
|
@ -2206,7 +2206,7 @@ class _StructModule(object):
|
|||
|
||||
:type file: file
|
||||
:param file: A python file-like object. It must be a "real" file, with a `fileno()` method.
|
||||
|
||||
|
||||
:type traversal_limit_in_words: int
|
||||
:param traversal_limit_in_words: Limits how many total words of data are allowed to be traversed. Is actually a uint64_t, and values can be up to 2^64-1. Default is 8*1024*1024.
|
||||
|
||||
|
@ -2221,7 +2221,7 @@ class _StructModule(object):
|
|||
|
||||
:type file: file
|
||||
:param file: A python file-like object. It must be a "real" file, with a `fileno()` method.
|
||||
|
||||
|
||||
:type traversal_limit_in_words: int
|
||||
:param traversal_limit_in_words: Limits how many total words of data are allowed to be traversed. Is actually a uint64_t, and values can be up to 2^64-1. Default is 8*1024*1024.
|
||||
|
||||
|
@ -2236,7 +2236,7 @@ class _StructModule(object):
|
|||
|
||||
:type file: file
|
||||
:param file: A python file-like object. It must be a "real" file, with a `fileno()` method.
|
||||
|
||||
|
||||
:type traversal_limit_in_words: int
|
||||
:param traversal_limit_in_words: Limits how many total words of data are allowed to be traversed. Is actually a uint64_t, and values can be up to 2^64-1. Default is 8*1024*1024.
|
||||
|
||||
|
@ -2251,7 +2251,7 @@ class _StructModule(object):
|
|||
|
||||
:type file: file
|
||||
:param file: A python file-like object. It must be a "real" file, with a `fileno()` method.
|
||||
|
||||
|
||||
:type traversal_limit_in_words: int
|
||||
:param traversal_limit_in_words: Limits how many total words of data are allowed to be traversed. Is actually a uint64_t, and values can be up to 2^64-1. Default is 8*1024*1024.
|
||||
|
||||
|
@ -2266,7 +2266,7 @@ class _StructModule(object):
|
|||
|
||||
:type buf: buffer
|
||||
:param buf: Any Python object that supports the buffer interface.
|
||||
|
||||
|
||||
:type traversal_limit_in_words: int
|
||||
:param traversal_limit_in_words: Limits how many total words of data are allowed to be traversed. Is actually a uint64_t, and values can be up to 2^64-1. Default is 8*1024*1024.
|
||||
|
||||
|
@ -2290,7 +2290,7 @@ class _StructModule(object):
|
|||
|
||||
:type buf: buffer
|
||||
:param buf: Any Python object that supports the readable buffer interface.
|
||||
|
||||
|
||||
:type traversal_limit_in_words: int
|
||||
:param traversal_limit_in_words: Limits how many total words of data are allowed to be traversed. Is actually a uint64_t, and values can be up to 2^64-1. Default is 8*1024*1024.
|
||||
|
||||
|
@ -2372,7 +2372,7 @@ cdef class SchemaParser:
|
|||
return ret
|
||||
|
||||
def load(self, file_name, display_name=None, imports=[]):
|
||||
"""Load a Cap'n Proto schema from a file
|
||||
"""Load a Cap'n Proto schema from a file
|
||||
|
||||
You will have to load a schema before you can begin doing anything
|
||||
meaningful with this library. Loading a schema is much like loading
|
||||
|
@ -2538,7 +2538,7 @@ cdef class _MessageBuilder:
|
|||
:return: An AnyPointer that you can set fields in
|
||||
"""
|
||||
return _DynamicObjectBuilder()._init(self.thisptr.getRootAnyPointer(), self)
|
||||
|
||||
|
||||
cpdef set_root(self, value) except +reraise_kj_exception:
|
||||
"""A method for instantiating Cap'n Proto structs by copying from an existing struct
|
||||
|
||||
|
@ -2694,7 +2694,7 @@ cdef class _PackedMessageReader(_MessageReader):
|
|||
opts.traversalLimitInWords = traversal_limit_in_words
|
||||
if nesting_limit is not None:
|
||||
opts.nestingLimit = nesting_limit
|
||||
|
||||
|
||||
self.thisptr = new schema_cpp.PackedMessageReader(stream, opts)
|
||||
return self
|
||||
|
||||
|
@ -2711,13 +2711,13 @@ cdef class _PackedMessageReaderBytes(_MessageReader):
|
|||
opts.traversalLimitInWords = traversal_limit_in_words
|
||||
if nesting_limit is not None:
|
||||
opts.nestingLimit = nesting_limit
|
||||
|
||||
|
||||
cdef const void *ptr
|
||||
cdef Py_ssize_t sz
|
||||
PyObject_AsReadBuffer(buf, &ptr, &sz)
|
||||
|
||||
self.stream = new schema_cpp.ArrayInputStream(schema_cpp.ByteArrayPtr(<byte *>ptr, sz))
|
||||
|
||||
|
||||
self.thisptr = new schema_cpp.PackedMessageReader(deref(self.stream), opts)
|
||||
|
||||
def __dealloc__(self):
|
||||
|
@ -2748,7 +2748,7 @@ cdef class _InputMessageReader(_MessageReader):
|
|||
opts.traversalLimitInWords = traversal_limit_in_words
|
||||
if nesting_limit is not None:
|
||||
opts.nestingLimit = nesting_limit
|
||||
|
||||
|
||||
self.thisptr = new schema_cpp.InputStreamMessageReader(stream, opts)
|
||||
return self
|
||||
|
||||
|
@ -2771,7 +2771,7 @@ cdef class _PackedFdMessageReader(_MessageReader):
|
|||
opts.traversalLimitInWords = traversal_limit_in_words
|
||||
if nesting_limit is not None:
|
||||
opts.nestingLimit = nesting_limit
|
||||
|
||||
|
||||
self.thisptr = new schema_cpp.PackedFdMessageReader(fd, opts)
|
||||
|
||||
cdef class _MultipleMessageReader:
|
||||
|
@ -2784,7 +2784,7 @@ cdef class _MultipleMessageReader:
|
|||
self.schema = schema
|
||||
self.traversal_limit_in_words = traversal_limit_in_words
|
||||
self.nesting_limit = nesting_limit
|
||||
|
||||
|
||||
self.stream = new schema_cpp.FdInputStream(fd)
|
||||
self.buffered_stream = new schema_cpp.BufferedInputStreamWrapper(deref(self.stream))
|
||||
|
||||
|
@ -2815,7 +2815,7 @@ cdef class _MultiplePackedMessageReader:
|
|||
self.schema = schema
|
||||
self.traversal_limit_in_words = traversal_limit_in_words
|
||||
self.nesting_limit = nesting_limit
|
||||
|
||||
|
||||
self.stream = new schema_cpp.FdInputStream(fd)
|
||||
self.buffered_stream = new schema_cpp.BufferedInputStreamWrapper(deref(self.stream))
|
||||
|
||||
|
@ -2846,7 +2846,7 @@ cdef class _FlatArrayMessageReader(_MessageReader):
|
|||
opts.traversalLimitInWords = traversal_limit_in_words
|
||||
if nesting_limit is not None:
|
||||
opts.nestingLimit = nesting_limit
|
||||
|
||||
|
||||
cdef const void *ptr
|
||||
cdef Py_ssize_t sz
|
||||
PyObject_AsReadBuffer(buf, &ptr, &sz)
|
||||
|
@ -2937,7 +2937,7 @@ def _write_packed_message_to_fd(int fd, _MessageBuilder message):
|
|||
_global_schema_parser = None
|
||||
|
||||
def load(file_name, display_name=None, imports=[]):
|
||||
"""Load a Cap'n Proto schema from a file
|
||||
"""Load a Cap'n Proto schema from a file
|
||||
|
||||
You will have to load a schema before you can begin doing anything
|
||||
meaningful with this library. Loading a schema is much like loading
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
cython > 0.19
|
||||
cython >= 0.21
|
||||
setuptools >= 0.8
|
||||
pytest
|
||||
tox
|
||||
tox
|
||||
|
|
4
setup.py
4
setup.py
|
@ -65,12 +65,12 @@ setup(
|
|||
packages=["capnp"],
|
||||
version=VERSION,
|
||||
package_data={'capnp': ['*.pxd', '*.h', '*.capnp', 'helpers/*.pxd', 'helpers/*.h', 'includes/*.pxd', 'lib/*.pxd', 'lib/*.py', 'lib/*.pyx']},
|
||||
ext_modules=cythonize('capnp/lib/*.pyx', language="c++"),
|
||||
ext_modules=cythonize('capnp/lib/*.pyx'),
|
||||
cmdclass = {
|
||||
'clean': clean
|
||||
},
|
||||
install_requires=[
|
||||
'cython > 0.19',
|
||||
'cython >= 0.21',
|
||||
'setuptools >= 0.8'],
|
||||
# PyPi info
|
||||
description="A cython wrapping of the C++ Cap'n Proto library",
|
||||
|
|
Loading…
Add table
Reference in a new issue