Modernize and update the API capabilities object.

Review Request #12608 — Created Sept. 19, 2022 and submitted

Information

RBTools
release-4.x

Reviewers

This small change updates the API capabilities object with modern docs
and type annotations.

Ran unit tests.

Summary ID
Modernize and update the API capabilities object.
This small change updates the API capabilities object with modern docs and type annotations. Testing Done: Ran unit tests.
f0425324df856474b3afa7c994e37574c2e074f4
Description From Last Updated

We should use Dict[str, object] for this, to be a bit more explicit.

chipx86chipx86

I know it was this way before, but we probably don't need to capitalize capabilities.

chipx86chipx86

Missing a trailing period.

chipx86chipx86

This won't permit nested dictionaries or bools. It only allows a flat dictionary of string keys and values. Recursive dicts …

chipx86chipx86

Missing trailing comma.

chipx86chipx86

'typing.Union' imported but unused Column: 1 Error code: F401

reviewbotreviewbot
maubin
  1. Ship It!
  2. 
      
chipx86
  1. 
      
  2. rbtools/api/capabilities.py (Diff revision 1)
     
     
    Show all issues

    We should use Dict[str, object] for this, to be a bit more explicit.

  3. rbtools/commands/__init__.py (Diff revision 1)
     
     
    Show all issues

    I know it was this way before, but we probably don't need to capitalize capabilities.

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

    Missing a trailing period.

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

    This won't permit nested dictionaries or bools. It only allows a flat dictionary of string keys and values.

    Recursive dicts are a problem and our capabilities don't have a specific nesting level for values. So we have to be generic with Dict[str, object].

    (object instead of Any, as the former ensures consistent type safety when reassigning values and the latter says "screw type safety.").

    1. Have to do some assertion nonsense down below to make this work with type checkers, but I guess that's OK.

    2. Nevermind, that fails. Going back to a very basic Dict definition.

  4. rbtools/api/capabilities.py (Diff revision 2)
     
     
    Show all issues

    Missing trailing comma.

  5. 
      
david
Review request changed

Commits:

Summary ID
Modernize and update the API capabilities object.
This small change updates the API capabilities object with modern docs and type annotations. Testing Done: Ran unit tests.
7b3eb0e0157d5663950d2ad432727f6bcdae28e3
Modernize and update the API capabilities object.
This small change updates the API capabilities object with modern docs and type annotations. Testing Done: Ran unit tests.
ec83d7d828062acff42d24220424a88036f15cab

Diff:

Revision 3 (+112 -32)

Show changes

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

david
chipx86
  1. Ship It!
  2. 
      
david
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-4.x (0a23c23)
Loading...