Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jquast committed Sep 30, 2023
1 parent fc58ea3 commit 2e4d9af
Showing 1 changed file with 1 addition and 27 deletions.
28 changes: 1 addition & 27 deletions bin/update-tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ class SequenceEntry:
description: str
comment: str


@dataclass
class TableDef:
filename: str
Expand Down Expand Up @@ -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."""
Expand Down Expand Up @@ -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]:
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 2e4d9af

Please sign in to comment.