Update typing and other modernization in git client.

Review Request #14324 — Created Feb. 3, 2025 and updated

Information

RBTools
master

Reviewers

This change does some improvements to our type hints, fixes up some doc
typos/errors, and moves to more modern syntax for a few things
(f-strings, list construction, etc).

Ran unit tests.

Summary ID
Update typing and other modernization in git client.
This change does some improvements to our type hints, fixes up some doc typos/errors, and moves to more modern syntax for a few things (f-strings, list construction, etc). Testing Done: Ran unit tests.
5457bdd03805fe4fca704737365ddbad65c0b24b
Description From Last Updated

At this point it'd be nice to just wrap these as a typical multi-line list with one item per line. …

chipx86chipx86

Instead of casting (here and below), we should probably assert.

chipx86chipx86

Instead of a cast, let's assert instead.

chipx86chipx86

For here and other messages, I think the right move is to keep these as-is and start wrapping in gettext. …

chipx86chipx86

Small thing, but when just consuming, we should use Sequence.

chipx86chipx86

Can you put these in alphabetical order?

chipx86chipx86
chipx86
  1. Very nice cleanup. Got a few small suggestions, mostly around ensuring type safety.

  2. rbtools/clients/git.py (Diff revision 1)
     
     
     
    Show all issues

    At this point it'd be nice to just wrap these as a typical multi-line list with one item per line.

    We should probably also type as ClassVar[Sequence[str]]

  3. rbtools/clients/git.py (Diff revision 1)
     
     
    Show all issues

    Instead of casting (here and below), we should probably assert.

  4. rbtools/clients/git.py (Diff revision 1)
     
     
    Show all issues

    Instead of a cast, let's assert instead.

  5. rbtools/clients/git.py (Diff revision 1)
     
     
     
     
    Show all issues

    For here and other messages, I think the right move is to keep these as-is and start wrapping in gettext. The newer bits of code (Patcher, Patch, soem errors, a couple SCMs) are using gettext.

  6. rbtools/clients/tests/test_git.py (Diff revision 1)
     
     
    Show all issues

    Small thing, but when just consuming, we should use Sequence.

  7. rbtools/clients/tests/test_git.py (Diff revision 1)
     
     
     
     
     
     
     
     
     
    Show all issues

    Can you put these in alphabetical order?

  8. 
      
david
Review request changed
Commits:
Summary ID
Update typing and other modernization in git client.
This change does some improvements to our type hints, fixes up some doc typos/errors, and moves to more modern syntax for a few things (f-strings, list construction, etc). Testing Done: Ran unit tests.
5a94a36e4846bf02894202f95ffb8f1d7606d564
Update typing and other modernization in git client.
This change does some improvements to our type hints, fixes up some doc typos/errors, and moves to more modern syntax for a few things (f-strings, list construction, etc). Testing Done: Ran unit tests.
5457bdd03805fe4fca704737365ddbad65c0b24b

Checks run (2 succeeded)

flake8 passed.
JSHint passed.