diff options
| author | Mike Frysinger <vapier@google.com> | 2025-03-27 16:32:16 -0400 |
|---|---|---|
| committer | LUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2025-03-28 19:13:49 -0700 |
| commit | 59b81c84ded4e2312b2b554d22a51dca89825bc3 (patch) | |
| tree | 4be3e56b9dfdb6ead08a0a3160f6fc84a79f4b86 | |
| parent | 507d46360097b830b0ad6a3c6f137c54a1b0ed8c (diff) | |
| download | git-repo-59b81c84ded4e2312b2b554d22a51dca89825bc3.tar.gz | |
launcher: change collections.namedtuple to typing.NamedTuple
Since we require Python 3.6 now in the launcher, switch to NamedTuple
so we get better documentation & typing information.
Change-Id: Ic58fdc07db02fc49166eccbbc3e527f474973424
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/463721
Reviewed-by: Gavin Mak <gavinmak@google.com>
Tested-by: Mike Frysinger <vapier@google.com>
Commit-Queue: Mike Frysinger <vapier@google.com>
| -rwxr-xr-x | repo | 17 |
1 files changed, 11 insertions, 6 deletions
| @@ -27,6 +27,7 @@ import platform | |||
| 27 | import shlex | 27 | import shlex |
| 28 | import subprocess | 28 | import subprocess |
| 29 | import sys | 29 | import sys |
| 30 | from typing import NamedTuple | ||
| 30 | 31 | ||
| 31 | 32 | ||
| 32 | # These should never be newer than the main.py version since this needs to be a | 33 | # These should never be newer than the main.py version since this needs to be a |
| @@ -217,7 +218,6 @@ S_manifests = "manifests" # special manifest repository | |||
| 217 | REPO_MAIN = S_repo + "/main.py" # main script | 218 | REPO_MAIN = S_repo + "/main.py" # main script |
| 218 | 219 | ||
| 219 | 220 | ||
| 220 | import collections | ||
| 221 | import errno | 221 | import errno |
| 222 | import json | 222 | import json |
| 223 | import optparse | 223 | import optparse |
| @@ -672,11 +672,16 @@ def run_git(*args, **kwargs): | |||
| 672 | raise CloneFailure() | 672 | raise CloneFailure() |
| 673 | 673 | ||
| 674 | 674 | ||
| 675 | # The git version info broken down into components for easy analysis. | 675 | class GitVersion(NamedTuple): |
| 676 | # Similar to Python's sys.version_info. | 676 | """The git version info broken down into components for easy analysis. |
| 677 | GitVersion = collections.namedtuple( | 677 | |
| 678 | "GitVersion", ("major", "minor", "micro", "full") | 678 | Similar to Python's sys.version_info. |
| 679 | ) | 679 | """ |
| 680 | |||
| 681 | major: int | ||
| 682 | minor: int | ||
| 683 | micro: int | ||
| 684 | full: int | ||
| 680 | 685 | ||
| 681 | 686 | ||
| 682 | def ParseGitVersion(ver_str=None): | 687 | def ParseGitVersion(ver_str=None): |
