diff --git a/bin/update-tables.py b/bin/update-tables.py index 137e8ab..43a3923 100644 --- a/bin/update-tables.py +++ b/bin/update-tables.py @@ -124,7 +124,6 @@ class SequenceEntry: description: str comment: str - @dataclass class TableDef: filename: str @@ -162,12 +161,6 @@ class UnicodeTableRenderCtx(RenderContext): table: Mapping[UnicodeVersion, TableDef] -@dataclass(frozen=True) -class UnicodeRegexRenderCtx(RenderContext): - variable_name: str - patterns: Mapping[UnicodeVersion, str] - - @dataclass class RenderDefinition: """Base class, do not instantiate it directly.""" @@ -260,26 +253,6 @@ def new(cls, filename: str, context: UnicodeTableRenderCtx) -> Self: render_context=context, ) -@dataclass -class UnicodeRegexRenderDef(RenderDefinition): - render_context: UnicodeRegexRenderCtx - - @classmethod - def new(cls, filename: str, context: UnicodeTableRenderCtx) -> Self: - _, ext = os.path.splitext(filename) - if ext == '.py': - jinja_filename = 're_patterns.py.j2' - else: - raise ValueError('filename must be Python') - - return cls( - jinja_filename=jinja_filename, - output_filename=os.path.join(PATH_UP, 'wcwidth', filename), - render_context=context, - ) - - - @functools.cache def fetch_unicode_versions() -> list[UnicodeVersion]: @@ -390,6 +363,7 @@ def cite_source_description(filename: str) -> tuple[str, str]: return fname, date + def make_table(values: Collection[int]) -> list[tuple[int, int]]: """ Return a tuple of (start, end) lookup pairs for given sequence of sorted values.