-
Notifications
You must be signed in to change notification settings - Fork 93
Dataclass-based ASCS Packets #688
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
664d285
to
94d132f
Compare
I believe there are still a lot of places to polish, so this is just an initial draft for reviews. |
I like the idea. Having support for proper typechecking via dataclasses is a great way to go (easier that designing type-checking plugins). We'll need to make sure that we keep things still compatible with Python >= 3.9. |
Thanks! I will work on #686 first, and them continue here. |
A problem here is that with There are 2 solutions to do this:
|
0183d3a
to
ff73adb
Compare
This PR is ready for review. Let's get started from ASCS packets since the test is more comprehensive here. |
I'll take a look shortly. I need to refresh my memory on deferred type annotation evaluation. |
I think there may be a slight variant on this model that may be a bit simpler, a bit easier to read, and would still let us use
|
This has been used in Navi for a while. Recently I resolved several critical issues and I think it's a time to bring it into Bumble upstream.
An obvious benefit to use dataclasses is IDE and type checker integration.
Unlike #430, this design properly utilize the existing effort, especially field specs. For nested fields, we may need to set another field in metadata like
Annotated[list, 1, '[' or ']' ]
as stack operator, though usually we only support up to 2 layers.return_parameters_fields cannot be benifit from this, because current type checker cannot associate two classes. But BTW, return_parameters_fields is actually not necessary to be inside decorator, so later we may have a PR to move them from decorators to classes.