]> git.madduck.net Git - etc/vim.git/blobdiff - scripts/make_width_table.py

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Fix long lines with power operator(s) getting splitted before line length (#3942)
[etc/vim.git] / scripts / make_width_table.py
index 09aca9c34b56bba43241a6e6f277b6fc83352d0d..3c7cae60f7fbffd2a309fba37894eaeb0474607d 100644 (file)
@@ -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")