Add framework for typing query arguments to methods.

Review Request #14339 — Created Feb. 10, 2025 and submitted — Latest diff uploaded

Information

RBTools
master

Reviewers

This change adds some machinery for rewriting query argument names so we
can more easily deal with API endpoints that use hyphens in parameters.

A couple new classes have been added for basic parameter lists for GET
operations on item and list resources, that include the built-in request
parameters that are supported for all resources.

I've also added additional TypedDicts for existing resource subclasses
which have special parameters for their GET operations. This makes it so
something like root.get_review_requests(branch=False) will pop up a
warning that the branch parameter must be str.

  • Ran unit tests.
  • Used a test script to verify that typing was correctly passed through
    for methods that take kwargs for query parameters.

Diff Revision 2

This is not the most recent revision of the diff. The latest diff is revision 3. See what's changed.

orig
1
2
3

Commits

First Last Summary ID Author
Add framework for typing query arguments to methods.
This change adds some machinery for rewriting query argument names so we can more easily deal with API endpoints that use hyphens in parameters. A couple new classes have been added for basic parameter lists for GET operations on item and list resources, that include the built-in request parameters that are supported for all resources. I've also added additional TypedDicts for existing resource subclasses which have special parameters for their GET operations. This makes it so something like `root.get_review_requests(branch=False)` will pop up a warning that the `branch` parameter must be `str`. Testing Done: - Ran unit tests. - Used a test script to verify that typing was correctly passed through for methods that take kwargs for query parameters.
d13021e064b3427f1e9cd74d84f6cf9329f2278f David Trowbridge
rbtools/api/resource/base.py
rbtools/api/resource/diff.py
rbtools/api/resource/diff_file_attachment.py
rbtools/api/resource/draft_diff_commit.py
rbtools/api/resource/file_diff.py
rbtools/api/resource/mixins.py
rbtools/api/resource/review_request.py
rbtools/api/resource/root.py
rbtools/api/resource/validate_diff_commit.py
Loading...