Convert Python type hinting to be PEP-585 Compliant (#4083)

Python [PEP-585](https://peps.python.org/pep-0585/) replaces a number of
`typing` module types with built-in equivalents and `collections.abc`
versions as of Python 3.9, with the aim of eventually removing the
`typing` module versions of these classes altogether. Since the minimum
required version of Python listed in the [Contribution Tools
document](https://github.com/carbon-language/carbon-lang/blob/trunk/docs/project/contribution_tools.md#main-tools)
is 3.9, the type hints in the various python files in the repo can be
updated to this style of type hint without a need for backwards
compatibility.

Feel free to close if this isn't a desired change at this time!

---------

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
Jack McCluskey
2024-06-26 19:32:37 +00:00
committed by GitHub
co-authored by Jon Ross-Perkins
parent 5a8dfda4f0
commit 319c3caf99
7 changed files with 54 additions and 52 deletions
+2 -2
View File
@@ -14,7 +14,7 @@ from pathlib import Path
import platform
import shutil
import time
from typing import Dict, Optional
from typing import Optional
import urllib.request
_BAZEL_TOOLS_URL = (
@@ -161,7 +161,7 @@ def _get_platform_ext() -> str:
return ""
def _select_hash(hashes: Dict[str, str], version: str) -> str:
def _select_hash(hashes: dict[str, str], version: str) -> str:
# Ensure the platform version is supported and has a hash.
if version not in hashes:
# If this because a platform support issue, we may need to print errors.