X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/ef6e079901d53a42dfae4ab10b081ce7a73a47b5..882d8795c6ff65c02f2657e596391748d1b6b7f5:/scripts/make_width_table.py?ds=sidebyside diff --git a/scripts/make_width_table.py b/scripts/make_width_table.py index 09aca9c..3c7cae6 100644 --- a/scripts/make_width_table.py +++ b/scripts/make_width_table.py @@ -15,11 +15,12 @@ You can do this by running: pip install -U wcwidth """ + import sys from os.path import basename, dirname, join from typing import Iterable, Tuple -import wcwidth +import wcwidth # type: ignore[import] def make_width_table() -> Iterable[Tuple[int, int, int]]: @@ -49,21 +50,13 @@ def make_width_table() -> Iterable[Tuple[int, int, int]]: def main() -> None: table_path = join(dirname(__file__), "..", "src", "black", "_width_table.py") with open(table_path, "w") as f: - f.write( - f"""# Generated by {basename(__file__)} + f.write(f"""# Generated by {basename(__file__)} # wcwidth {wcwidth.__version__} # Unicode {wcwidth.list_versions()[-1]} -import sys -from typing import List, Tuple - -if sys.version_info < (3, 8): - from typing_extensions import Final -else: - from typing import Final +from typing import Final, List, Tuple WIDTH_TABLE: Final[List[Tuple[int, int, int]]] = [ -""" - ) +""") for triple in make_width_table(): f.write(f" {triple!r},\n") f.write("]\n")