Commit Graph
11 Commits
Author SHA1 Message Date
Michael OsthegeandGitHub 9b5594adbe Format field comments also as docstrings (#304)
Closes #303

* Format field comments also as docstrings
To make it clear that they refer to the item above.
* Fix placement of enum item docstrings
* Add line breaks after class attribute or enum item docstrings
2022-01-27 09:25:48 +11:00
efokschanerandGitHub d260f071e0 Client and Service Stubs take 1 request parameter, not one for each field (#311) 2022-01-17 19:58:57 +01:00
Nat NoordanusandBasileus bb646fe26f Fix template bug resulting in empty __post_init__ methods 2021-04-02 10:13:08 +11:00
MinJune KimandGitHub 8a215367ad Allow empty services (#222)
Fixes issue #220
2021-03-12 21:49:58 +01:00
Tim SchmidtandGitHub 1d54ef8f99 Generate grpclib service stubs (#170) 2020-12-04 22:22:11 +01:00
034e2e7da0 Add support for recursive messages (#130)
Changes message initialization (`__post_init__`) so that default values
are no longer eagerly created to prevent infinite recursion when
initializing recursive messages.

As a result, `PLACEHOLDER` will be present in the message for any
uninitialized fields.  So, an implementation of `__get_attribute__` is
added that checks for `PLACEHOLDER` and lazily creates and stores
default field values.

And, because `PLACEHOLDER` values don't compare equal with zero values,
a custom implementation of `__eq__` is provided, and the code generation
template is updated so that messages generate with `@dataclass(eq=False)`.

Also add new Message __repr__ implementation that skips PLACEHOLDER 
values and orders keys by number from the proto.

Co-authored-by: Christopher Chambers <chris@peanutcode.com>
Co-authored-by: nat <n@natn.me>
Co-authored-by: James <50501825+Gobot1234@users.noreply.github.com>
2020-08-30 21:04:36 +02:00
Adrian Garcia BadaraccoandGitHub c93351ef21 Factor code template compilation out into a separate module 2020-08-09 20:06:39 +02:00
Arun Babu NeelicattuandGitHub 0cd9510b54 Support deprecated message and fields (#126) 2020-07-30 14:47:01 +02:00
Adrian Garcia BadaraccoandGitHub b5dcac1250 REF: Refactor plugin.py to use modular dataclasses in tree-like structure to represent parsed data (#121)
Refactor plugin to parse input into data-class based hierarchical structure
2020-07-25 19:44:02 +02:00
Arun Babu NeelicattuandBouke Versteegh 0ba0692dec Handle mutable default arguments cleanly
When generating code, ensure that default list/dict arguments are
initialised in local scope if unspecified or `None`.
2020-07-11 22:33:44 +02:00
Arun Babu NeelicattuandBouke Versteegh 459d12b24d Move betterproto → src/betterproto
This change avoids some nasty import issues and also ensures that the
right code is tested and arbitrary code is not included when packaging.
2020-07-11 19:51:01 +02:00