Skip to content

Commit 59b81c8

Browse files
vapierLUCI
authored and
LUCI
committed
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 <[email protected]> Tested-by: Mike Frysinger <[email protected]> Commit-Queue: Mike Frysinger <[email protected]>
1 parent 507d463 commit 59b81c8

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

repo

+11-6
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import platform
2727
import shlex
2828
import subprocess
2929
import sys
30+
from typing import NamedTuple
3031

3132

3233
# 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
217218
REPO_MAIN = S_repo + "/main.py" # main script
218219

219220

220-
import collections
221221
import errno
222222
import json
223223
import optparse
@@ -672,11 +672,16 @@ def run_git(*args, **kwargs):
672672
raise CloneFailure()
673673

674674

675-
# The git version info broken down into components for easy analysis.
676-
# Similar to Python's sys.version_info.
677-
GitVersion = collections.namedtuple(
678-
"GitVersion", ("major", "minor", "micro", "full")
679-
)
675+
class GitVersion(NamedTuple):
676+
"""The git version info broken down into components for easy analysis.
677+
678+
Similar to Python's sys.version_info.
679+
"""
680+
681+
major: int
682+
minor: int
683+
micro: int
684+
full: int
680685

681686

682687
def ParseGitVersion(ver_str=None):

0 commit comments

Comments
 (0)