Jason Paryani
8c559cc8b1
Add handling of DynamicObject
2013-09-18 17:19:57 -07:00
Jason Paryani
fa5fe5a92c
Fix bug in to_dict not handling which fields properly. Also add
...
exception for fields of type Object, since they're currently unhandled
2013-09-05 16:43:54 -07:00
Jason Paryani
a3f4cf3726
Fix lists of lists or dicts for from_dict
2013-09-04 22:00:42 -07:00
Jason Paryani
6516b7b178
Fix nested lists of structs for from_dict
2013-09-04 21:57:52 -07:00
Jason Paryani
0187d123c9
Fix from_dict for PyPy
2013-09-04 21:53:13 -07:00
Jason Paryani
effacb872f
Fix problem with to_dict
2013-09-04 11:20:05 -07:00
Jason Paryani
777f6b3bce
Fix to_bytes for python3
2013-09-03 22:25:12 -07:00
Jason Paryani
76a354f647
Fix problems from merge
2013-09-03 14:35:34 -07:00
Jason Paryani
5411486d56
Merge branch 'develop' of git://github.com/amluto/capnpc-python-cpp into amluto-develop
...
Conflicts:
capnp/capnp.pyx
2013-09-03 14:34:43 -07:00
Andy Lutomirski
cd0fe97710
Add _DynamicStructBuilder.to_bytes() and <struct module>.read_from_memory
...
to_bytes is not very efficient (it makes one necessary copy and one
unnecessary copy), but it will simplify a lot of use cases.
read_from_memory should be maximally efficient for most input types
(including mmap).
2013-09-03 14:01:07 -07:00
Jason Paryani
dbad76f4ce
Fix new typo...
2013-09-03 11:56:05 -07:00
Jason Paryani
9a410d54ab
Fix typo in read
2013-09-03 11:55:16 -07:00
Jason Paryani
74e27f940f
Change == on StructSchema to return cbool
2013-09-03 11:54:58 -07:00
Andy Lutomirski
b3264a7292
Add Builder and Reader ABCs for each struct type
...
This has zero overhead if not used. I decided that it was simpler
to use ABCs instead of real classes, given that using real classes
offers little benefit.
This also implements == and != for StructSchema objects.
2013-09-03 11:01:12 -07:00
Jason Paryani
80d2e59c08
Fix handling of empty path '' in load_module
2013-09-03 01:03:29 -07:00
Jason Paryani
83e30f5a30
Add from_dict
2013-09-03 01:00:52 -07:00
Jason Paryani
c900690b96
Fix bug in exception handling for which(). Also standardize exceptions
...
to always be ValueError. Add the beginnings of to_dict()
2013-09-03 00:25:32 -07:00
Jason Paryani
4e0db3d16a
Fix up minor things with import hook
2013-09-03 00:21:15 -07:00
Jason Paryani
891f0d28e5
Change import hook to require modules to end in '_capnp'
2013-09-01 23:55:29 -07:00
Jason Paryani
98c9b959f7
Fix up bug with import hook on python3/pypy
2013-09-01 22:24:46 -07:00
Jason Paryani
5600f9939a
Add import monkey patch function
2013-09-01 21:31:39 -07:00
Jason Paryani
1317527893
Change naming for functions to conform to PEP 8. Also deprecate old
...
read/write api.
2013-09-01 20:10:57 -07:00
Jason Paryani
6fcdf841e4
Update preferred method for reading/writing messages from files
2013-09-01 02:13:19 -07:00
Jason Paryani
c3ae2bee67
Change DynamicValue.Reader lists to be returned as _DynamicListReader
2013-09-01 00:09:46 -07:00
Jason Paryani
684f8ead70
Unify setters for DynamicList and DynamicStruct
2013-08-31 20:00:57 -07:00
Jason Paryani
fe991e7857
Fix int/long handling for python3 by removing redundant code
2013-08-31 19:30:07 -07:00
Kenton Varda
1cfea9c846
Add shortcuts for reading from / writing to files. In Python, it doesn't make much sense to force people to muck around with MessageReaders and MessageBuilders since everything is landing on the heap anyway. Instead, let's make it easy: MyType.read[Packed]From(file) reads a file and returns a MyType reader. MyType.newMessage() returns a MyType builder representing the root of a new message. You can call this builder's write[Packed]To(file) method to write it to a file.
2013-08-31 18:19:02 -07:00
Kenton Varda
6731d7eb7d
Store Builders by value rather than allocate them separately on the heap (matches treatment of Readers). v0.3 fixes the bug that made this not work.
2013-08-31 17:22:11 -07:00
Kenton Varda
86b742e91d
Wrap MessageBuilder::setRoot().
2013-08-31 17:07:44 -07:00
Kenton Varda
0478ee3081
Add tests based on TestAllTypes from the C++ test.capnp. Fix problems uncovered in capnp.pyx. Requires capnproto-c++-0.3.0-rc5, as I found a bug in the base library.
2013-08-31 16:44:54 -07:00
Kenton Varda
10c6f40c2e
Implement __str__ and __repr__ for struct and list builders. __str__ uses prettyPrint while __repr__ shows the type name and the low-whitespace stringification. Also implement __repr__ for StructSchema, just because why not?
2013-08-31 15:07:13 -07:00
Kenton Varda
688cecffab
Remove stray print statement.
2013-08-31 13:21:29 -07:00
Jason Paryani
3772198e82
Fix up docs for new C++ RC
2013-08-30 23:13:20 -07:00
Jason Paryani
f7fbe5bdb3
Change load to use a global SchemaParser. Make structs settable as field
2013-08-29 21:03:00 -07:00
Jason Paryani
1d09bb71dd
Fix docstring typo in PackedFdMessageReader
2013-08-29 18:49:32 -07:00
Jason Paryani
f0aa4d996b
Add docstrings for new functions and _DynamicResizableListBuilder
2013-08-29 18:46:17 -07:00
Jason Paryani
97cfef4243
Lowercase schema so it conforms to member naming conventions
2013-08-28 23:11:28 -07:00
Jason Paryani
28b4c442bd
Fix change in C++ API of deleted default constructors for builders
2013-08-28 22:55:18 -07:00
Jason Paryani
64b3baa575
Merge branch 'master' of https://github.com/amluto/capnpc-python-cpp into develop
...
Conflicts:
capnp/capnp.pyx
capnp/capnp_cpp.pxd
2013-08-28 16:09:33 -07:00
Andy Lutomirski
2fe61781f5
Expose _StructSchema's raw node
2013-08-28 14:46:53 -07:00
Andy Lutomirski
79ae83a6cb
Add some useful _StructSchema, reader, and builder methods
...
This adds:
- _StructSchema.fieldnames
- _DynamicStructBuilder.as_reader
- _DynamicStruct{Reader,Builder}.schema and __dir__
This makes the reader and builder types much easier to navigate in ipython.
2013-08-28 14:34:37 -07:00
Jason Paryani
172c2fd900
Change orphan list semantics a bit
2013-08-27 10:55:06 -07:00
Jason Paryani
448ea93891
Add full orphan functionality. Also, allow special orphan lists
...
that can grow over time.
2013-08-26 22:00:12 -07:00
Jason Paryani
c31d63087a
Finish up adding docstrings to all public classes/methods
2013-08-26 19:27:58 -07:00
Jason Paryani
7b33513bdb
Add a ton of docstrings and add to official docs
2013-08-26 16:16:58 -07:00
Jason Paryani
0856cf413b
Remove a bunch of cruft. Also re-namespace all private methods with _
2013-08-26 15:07:13 -07:00
Jason Paryani
48f8d995a6
Refactor clean various cruft
2013-08-26 14:57:48 -07:00
Jason Paryani
38ba5249c3
Add DynamicOrphan
2013-08-26 14:45:15 -07:00
Jason Paryani
a4d2bd6020
Add some docstrings
2013-08-26 10:07:54 -07:00
Jason Paryani
c6250962e6
Add handling of constants in schemas
2013-08-25 17:07:08 -07:00