From f7869b52fc183362f7018ac2b50acfbd9aa8831a Mon Sep 17 00:00:00 2001 From: "Jeffrey C. Ollie" Date: Sun, 6 Jul 2025 02:45:03 -0500 Subject: [PATCH] backport nerd font attribute generator to Python 3.11 --- src/font/nerd_font_codegen.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/font/nerd_font_codegen.py b/src/font/nerd_font_codegen.py index 9d0606de9..1bb7ad4af 100644 --- a/src/font/nerd_font_codegen.py +++ b/src/font/nerd_font_codegen.py @@ -14,11 +14,10 @@ import sys from collections import defaultdict from contextlib import suppress from types import SimpleNamespace -from typing import Literal, TypedDict, cast +from typing import Literal, TypedDict, cast, TypeAlias -type PatchSetAttributes = dict[Literal["default"] | int, PatchSetAttributeEntry] -type AttributeHash = tuple[str | None, str | None, str, float, float, float] -type ResolvedSymbol = PatchSetAttributes | PatchSetScaleRules | int | None + +AttributeHash: TypeAlias = tuple[str | None, str | None, str, float, float, float] class PatchSetScaleRules(TypedDict): @@ -33,6 +32,9 @@ class PatchSetAttributeEntry(TypedDict): params: dict[str, float | bool] +PatchSetAttributes: TypeAlias = dict[Literal["default"] | int, PatchSetAttributeEntry] +ResolvedSymbol: TypeAlias = PatchSetAttributes | PatchSetScaleRules | int | None + class PatchSet(TypedDict): SymStart: int SymEnd: int