Update typing and other modernization in git client.
Review Request #14324 — Created Feb. 3, 2025 and updated
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 |
---|---|
3eb174ba8faa7ed1a7736dd0c9256f728b22ab1d |
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. … |
|
|||
Instead of casting (here and below), we should probably assert. |
|
|||
Instead of a cast, let's assert instead. |
|
|||
For here and other messages, I think the right move is to keep these as-is and start wrapping in gettext. … |
|
|||
Small thing, but when just consuming, we should use Sequence. |
|
|||
Can you put these in alphabetical order? |
|
|||
Nit: I think this should be Union[str, Sequence[str]] |
![]() |
|||
Nit: I think this should be Sequence[bytes] |
![]() |
|||
Same here. |
![]() |
|||
Also a nit: While here can you wrap None in double backticks |
![]() |
|||
Same Sequence nit here. |
![]() |
|||
Same Sequence nit here. |
![]() |
|||
Since we're changing this, we should maybe use Sequence now. |
|
|||
We shouldn't override types in subclasses. They should be defined once in the parent, so the type checker can verify … |
|
|||
This should probably be a Mapping. |
|
|||
Localized strings with multiple variables need to use names instead of positional markers. Also, why the change in the code … |
|
|||
This should maybe return a Sequence, unless we should be modifying the result. |
|
|||
This needs to continue using named placeholders. |
|
|||
Here, too. |
|
|||
This should maybe be a Mapping. |
|
|||
This type is set in the parent, so we shouldn't override it here. |
|
|||
multiple spaces before operator Column: 17 Error code: E221 |
![]() |
|||
multiple spaces before operator Column: 22 Error code: E221 |
![]() |
|||
multiple spaces before operator Column: 20 Error code: E221 |
![]() |
|||
multiple spaces before operator Column: 35 Error code: E221 |
![]() |
|||
line too long (81 > 79 characters) Column: 80 Error code: E501 |
![]() |
|||
line too long (81 > 79 characters) Column: 80 Error code: E501 |
![]() |
|||
There are no open 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]]
-
-
-
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. -
-
- Commits:
-
Summary ID 5a94a36e4846bf02894202f95ffb8f1d7606d564 5457bdd03805fe4fca704737365ddbad65c0b24b - Diff:
-
Revision 2 (+938 -562)
Checks run (2 succeeded)
- Change Summary:
-
Make requested fixes (plus another couple
Sequence
changes that I found) - Commits:
-
Summary ID 5457bdd03805fe4fca704737365ddbad65c0b24b ec5312625ffb8a58d94f15084bb6ce12dff411fd
Checks run (2 succeeded)
-
-
-
We shouldn't override types in subclasses. They should be defined once in the parent, so the type checker can verify the assigned value against the parent type. Same goes for the ones below.
-
-
Localized strings with multiple variables need to use names instead of positional markers.
Also, why the change in the code to
.format()
instead of%
? I'm not opposed, but we've never really bothered with the former before. -
-
-
-
-
- Commits:
-
Summary ID ec5312625ffb8a58d94f15084bb6ce12dff411fd ff9479e44b3dc471d00792fda5ba9627844fce58
Checks run (1 failed, 1 succeeded)
flake8
- Commits:
-
Summary ID ff9479e44b3dc471d00792fda5ba9627844fce58 e7a8b082115d25662179d1c709dca5770d51ff5b