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
@@ -11,7 +11,7 @@ import glob
import os
import subprocess
import sys
from typing import List, Optional
from typing import Optional
_CPP_REFACTORING = "./cpp_refactoring/cpp_refactoring"
_H_EXTS = {".h", ".hpp"}
@@ -21,7 +21,7 @@ _CPP_EXTS = {".c", ".cc", ".cpp", ".cxx"}
class _Workflow:
_parsed_args: argparse.Namespace
_data_dir: str
_cpp_files: Optional[List[str]]
_cpp_files: Optional[list[str]]
def __init__(self) -> None:
"""Parses command-line arguments and flags."""