backport nerd font attribute generator to Python 3.11

This commit is contained in:
Jeffrey C. Ollie
2025-07-06 02:45:03 -05:00
parent c34bd44143
commit f7869b52fc

View File

@ -14,11 +14,10 @@ import sys
from collections import defaultdict from collections import defaultdict
from contextlib import suppress from contextlib import suppress
from types import SimpleNamespace 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] AttributeHash: TypeAlias = tuple[str | None, str | None, str, float, float, float]
type ResolvedSymbol = PatchSetAttributes | PatchSetScaleRules | int | None
class PatchSetScaleRules(TypedDict): class PatchSetScaleRules(TypedDict):
@ -33,6 +32,9 @@ class PatchSetAttributeEntry(TypedDict):
params: dict[str, float | bool] params: dict[str, float | bool]
PatchSetAttributes: TypeAlias = dict[Literal["default"] | int, PatchSetAttributeEntry]
ResolvedSymbol: TypeAlias = PatchSetAttributes | PatchSetScaleRules | int | None
class PatchSet(TypedDict): class PatchSet(TypedDict):
SymStart: int SymStart: int
SymEnd: int SymEnd: int