-
Notifications
You must be signed in to change notification settings - Fork 951
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
Use Enums instead of NamedTuple #1222
Milestone
Comments
Currently working on the typing for the coming release 6.0.0 This change will allow me to reduce the noise in the output of mypy. After merging this PR in |
lavigne958
added a commit
that referenced
this issue
Jun 19, 2023
Most of the parameters for the API are `ENUM`s Replace the named tuples that are not fitted for that with enums. Each enum hold one of the choices. The actual string value must be extracted in order to pass strings only to the API using the function `extract_enum_value` using the `enum.value` field if the enum is not `None`. this forces us to filter all arguments that are passed when they can possibly be `None`. thouhgt about setting the default value for each instead but this changes the API call made to the API and that could lead to unwanted behavior for the users. closes #1222
lavigne958
added a commit
that referenced
this issue
Jul 5, 2023
Most of the parameters for the API are `ENUM`s Replace the named tuples that are not fitted for that with enums. Each enum hold one of the choices. The actual string value must be extracted in order to pass strings only to the API using the function `extract_enum_value` using the `enum.value` field if the enum is not `None`. this forces us to filter all arguments that are passed when they can possibly be `None`. thouhgt about setting the default value for each instead but this changes the API call made to the API and that could lead to unwanted behavior for the users. closes #1222
Merged in #1250 closing this issue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Overview
Currently we use
NamedTuple
for the static parameters to send to the API.Replace with
Enum
instances, much better to deal with.Details
The named tuples are more complexe to type and to work with.
With the enums it's much easier and faster.
Mention
Add warnings again in the latest release for the coming breaking change 😬
The text was updated successfully, but these errors were encountered: