• 
      

    Add stub functionality for base resources and implement review request.

    Review Request #14337 — Created Feb. 10, 2025 and submitted

    Information

    RBTools
    master

    Reviewers

    This change adds support for @api_stub for the base resource class,
    used for "special" links (create/update/delete/etc) as well as for any
    resource-specific links.

    This also adds a new decorator, @request_method_returns, which works
    like @request_method, but can plumb through a specific return type.
    This has been used to make ResourceLinkField generic, so that calls to
    a ResourceLinkField.get() method can specify their return type as a
    specific resource subclass.

    Stubs for common special methods have been added to Resource,
    ItemResource, and ListResource. This change also adds resource-specific
    stubs to ReviewRequestItemResource, for those links where we have
    existing resource classes to reference. I've also added type hints for
    the review request attributes.

    • Ran unit tests.
    • Smoke tested rbt commands.
    • Ran a test script with debug logging to see that the stub debug info
      looked as expected.
    Summary ID
    Add stub functionality for base resources and implement review request.
    This change adds support for `@api_stub` for the base resource class, used for "special" links (create/update/delete/etc) as well as for any resource-specific links. This also adds a new decorator, `@request_method_returns`, which works like `@request_method`, but can plumb through a specific return type. This has been used to make `ResourceLinkField` generic, so that calls to a `ResourceLinkField.get()` method can specify their return type as a specific resource subclass. Stubs for common special methods have been added to Resource, ItemResource, and ListResource. This change also adds resource-specific stubs to ReviewRequestItemResource, for those links where we have existing resource classes to reference. I've also added type hints for the review request attributes. Testing Done: - Ran unit tests. - Smoke tested rbt commands. - Ran a test script with debug logging to see that the stub debug info looked as expected.
    f39898895b23afca59ccf4646b5c8055b678d1cc
    Description From Last Updated

    A couple things that were already there, but worth fixing: NoReturn sorts before Optional, and TYPE_CHECKING before TypeVar.

    chipx86chipx86

    There's an extra blank line here.

    chipx86chipx86

    This should be documented, and under the Instance Variables header.

    chipx86chipx86

    Same here.

    chipx86chipx86
    maubin
    1. Ship It!
    2. 
        
    chipx86
    1. 
        
    2. rbtools/api/resource/base.py (Diff revision 1)
       
       
      Show all issues

      A couple things that were already there, but worth fixing: NoReturn sorts before Optional, and TYPE_CHECKING before TypeVar.

    3. rbtools/api/resource/base.py (Diff revision 1)
       
       
       
       
       
       
      Show all issues

      There's an extra blank line here.

    4. rbtools/api/resource/mixins.py (Diff revision 1)
       
       
      Show all issues

      This should be documented, and under the Instance Variables header.

    5. rbtools/api/resource/mixins.py (Diff revision 1)
       
       
      Show all issues

      Same here.

    6. 
        
    david
    chipx86
    1. Ship It!
    2. 
        
    david
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to master (04926a1)