Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor code for parsing ascii-style tables #2291

Open
rw251 opened this issue Dec 6, 2024 · 0 comments
Open

Refactor code for parsing ascii-style tables #2291

rw251 opened this issue Dec 6, 2024 · 0 comments

Comments

@rw251
Copy link
Contributor

rw251 commented Dec 6, 2024

There are 4 places in the code where ascii-style tables e.g.

 x |  y
---+-----
 1 | 101
 2 | 201

are parsed into python objects. This should be refactored so the parsing is common to all uses.

Current locations of ascii table parsing are (roughly):

ehrql/ehrql/docs/specs.py

Lines 210 to 211 in 42b273b

def parse_table(s):
"""Return data in table as list of lists."""

def parse(cls, s):
"""Create instance by parsing string.

def parse(cls, s):
"""Create instance by parsing string.

def parse_row(column_types, col_names, line):
"""Parse string containing row data, returning list of values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant