Make ReviewUI generic for typing purposes.

Review Request #13696 — Created April 4, 2024 and submitted

Information

Review Board
release-7.x

Reviewers

This change adds generic typing for the ReviewUI class, allowing us to
specify in the subclass what the object type, comment type, and
serialized comment type are. This prevents the need for a bunch of
cast calls in the subclasses.

Ran unit tests.

Summary ID
Make ReviewUI generic for typing purposes.
This change adds generic typing for the ReviewUI class, allowing us to specify in the subclass what the object type, comment type, and serialized comment type are. This prevents the need for a bunch of `cast` calls in the subclasses. Testing Done: Ran unit tests.
4780bc5de7e4922139e18f51c16f02a4bcd559b1
Description From Last Updated

Can we document these and add Version Added?

chipx86chipx86

While you're doing work on these, can you wrap these in ClassVar?

chipx86chipx86

We should probably use Sequence here, unless we want to explicitly return a mutable list.

chipx86chipx86

collections.abc.Iterator doesn't support generics on Python 3.8.

chipx86chipx86

Maybe we should use Sequence for these?

chipx86chipx86
chipx86
  1. 
      
  2. reviewboard/reviews/ui/base.py (Diff revision 1)
     
     
     
     
     
     
    Show all issues

    Can we document these and add Version Added?

  3. reviewboard/reviews/ui/base.py (Diff revision 1)
     
     
    Show all issues

    While you're doing work on these, can you wrap these in ClassVar?

  4. reviewboard/reviews/ui/base.py (Diff revision 1)
     
     
    Show all issues

    We should probably use Sequence here, unless we want to explicitly return a mutable list.

  5. reviewboard/reviews/ui/markdownui.py (Diff revision 1)
     
     
    Show all issues

    collections.abc.Iterator doesn't support generics on Python 3.8.

  6. reviewboard/reviews/ui/text.py (Diff revision 1)
     
     
    Show all issues

    Maybe we should use Sequence for these?

  7. 
      
david
maubin
  1. Ship It!
  2. 
      
david
Review request changed
Status:
Completed
Change Summary:
Pushed to release-7.x (8faa5a1)