Add typing for Repository, Tool, and the managers.

Review Request #14032 — Created July 12, 2024 and submitted

Information

Review Board
release-7.x

Reviewers

Repository is one of the main models used in Review Board, and until
now, we lacked any typing for the functions.

This change adds typing for Repository, RepositoryManager, Tool,
and ToolManager. It should ensure we don't pass incorrect parameters
to anything in these classes.

Unit tests pass.

Summary ID
Add typing for Repository, Tool, and the managers.
`Repository` is one of the main models used in Review Board, and until now, we lacked any typing for the functions. This change adds typing for `Repository`, `RepositoryManager`, `Tool`, and `ToolManager`. It should ensure we don't pass incorrect parameters to anything in these classes.
80d4de5e87f12f2ed9c6970c20c0bddf8a7082b8
Description From Last Updated

I've been adding blank lines within the TYPE_CHECKING imports to mirror the sections in regular imports.

daviddavid

Why the quotes here?

daviddavid
david
  1. 
      
  2. reviewboard/scmtools/managers.py (Diff revision 1)
     
     
     
    Show all issues

    I've been adding blank lines within the TYPE_CHECKING imports to mirror the sections in regular imports.

  3. reviewboard/scmtools/managers.py (Diff revision 1)
     
     
    Show all issues

    Why the quotes here?

    1. We can't safely import Tool within managers.py (circular import), and Manager doesn't actually care what goes into the [...] but type checkers will understand it's a type reference. So the docs say to put the type in quotes.

  4. reviewboard/scmtools/models.py (Diff revision 1)
     
     

    eek

  5. 
      
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-7.x (335d124)