From 59b81c84ded4e2312b2b554d22a51dca89825bc3 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 27 Mar 2025 16:32:16 -0400 Subject: [PATCH] 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 Tested-by: Mike Frysinger Commit-Queue: Mike Frysinger --- repo | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/repo b/repo index d9e28ab0..21085688 100755 --- a/repo +++ b/repo @@ -27,6 +27,7 @@ import platform import shlex import subprocess import sys +from typing import NamedTuple # 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 REPO_MAIN = S_repo + "/main.py" # main script -import collections import errno import json import optparse @@ -672,11 +672,16 @@ def run_git(*args, **kwargs): raise CloneFailure() -# The git version info broken down into components for easy analysis. -# Similar to Python's sys.version_info. -GitVersion = collections.namedtuple( - "GitVersion", ("major", "minor", "micro", "full") -) +class GitVersion(NamedTuple): + """The git version info broken down into components for easy analysis. + + Similar to Python's sys.version_info. + """ + + major: int + minor: int + micro: int + full: int def ParseGitVersion(ver_str=None):