• 
      

    Add new resources, part 3/7.

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

    Information

    RBTools
    master

    Reviewers

    This change adds the following new resource implementations:
    - RepositoryItemResource
    - RepositoryListResource
    - RepositoryBranchItemResource
    - RepositoryBranchListResource
    - RepositoryCommitItemResource
    - RepositoryCommitListResource
    - RepositoryGroupItemResource
    - RepositoryGroupListResource
    - RepositoryInfoResource
    - RepositoryUserItemResource
    - RepositoryUserListResource

    This involves one update to our base ListResource implementation (and
    various related plumbing) to allow subclasses to force a specific class
    type to be used for items. In the case of repository branches and
    commits, these are list resources that do not have an associated item
    endpoint or mimetype, and so the basic _wrap_field() and create
    functionality was returning a plain ItemResource. For this case,
    ListResource subclasses can now set _item_resource_type to force a
    specific item resource subclass instead.

    • Ran unit tests.
    • Used the new resources from a test script and saw that everything
      worked as expected.
    Summary ID
    Add new resources, part 3/7.
    This change adds the following new resource implementations: - RepositoryItemResource - RepositoryListResource - RepositoryBranchItemResource - RepositoryBranchListResource - RepositoryCommitItemResource - RepositoryCommitListResource - RepositoryGroupItemResource - RepositoryGroupListResource - RepositoryInfoResource - RepositoryUserItemResource - RepositoryUserListResource This involves one update to our base ListResource implementation (and various related plumbing) to allow subclasses to force a specific class type to be used for items. In the case of repository branches and commits, these are list resources that do not have an associated item endpoint or mimetype, and so the basic `_wrap_field()` and create functionality was returning a plain `ItemResource`. For this case, `ListResource` subclasses can now set `_item_resource_type` to force a specific item resource subclass instead. Testing Done: - Ran unit tests. - Used the new resources from a test script and saw that everything worked as expected.
    549a3f62b393c192f28faa46867d96dcf9dceddf
    Description From Last Updated

    redefinition of unused 'Unpack' from line 11 Column: 5 Error code: F811

    reviewbotreviewbot

    line too long (80 > 79 characters) Column: 80 Error code: E501

    reviewbotreviewbot

    While here, can we update create_resource to be keyword-only (with deprecation)? If not, we should at least make this new …

    chipx86chipx86

    Needs a Version Added here and a Version Changed in the function doc body.

    chipx86chipx86

    Some notes regarding keyword-only arguments. This applies to other methods below.

    chipx86chipx86

    Same notes regarding version documentation. This applies to other methods below.

    chipx86chipx86

    This should now be a Mapping.

    chipx86chipx86

    This should also be a Mapping. Same elsewhere.

    chipx86chipx86

    Missing a trailing period.

    chipx86chipx86

    Needs a Version Added here and Version Changed above.

    maubinmaubin
    Checks run (1 failed, 1 succeeded)
    flake8 failed.
    JSHint passed.

    flake8

    david
    david
    chipx86
    1. 
        
    2. rbtools/api/factory.py (Diff revision 3)
       
       
      Show all issues

      While here, can we update create_resource to be keyword-only (with deprecation)?

      If not, we should at least make this new one keyword-only.

      1. There's a lot of call sites (mostly in tests). I'll do this in a separate change, so this one doesn't get muddied up further.

    3. rbtools/api/factory.py (Diff revision 3)
       
       
       
      Show all issues

      Needs a Version Added here and a Version Changed in the function doc body.

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

      Some notes regarding keyword-only arguments.

      This applies to other methods below.

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

      Same notes regarding version documentation.

      This applies to other methods below.

    6. Show all issues

      This should now be a Mapping.

    7. rbtools/api/resource/repository.py (Diff revision 3)
       
       
      Show all issues

      This should also be a Mapping.

      Same elsewhere.

    8. Show all issues

      Missing a trailing period.

    9. 
        
    david
    maubin
    1. 
        
    2. rbtools/api/resource/base.py (Diff revision 4)
       
       
       
      Show all issues

      Needs a Version Added here and Version Changed above.

    3. 
        
    david
    chipx86
    1. Ship It!
    2. 
        
    david
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to master (24a1de7)