Skip to content

Commit

Permalink
generic csv build with rules
Browse files Browse the repository at this point in the history
  • Loading branch information
CaseyBatten committed Oct 18, 2024
1 parent 68e1176 commit 0482e96
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions api/src/opentrons/protocol_engine/resources/file_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,10 @@ class GenericCsvTransform:
filename: str
rows: List[List[str]]
delimiter: str = ","

def __init__(self, filename: str, rows: List[List[str]], delimeter: str) -> None:
self.filename = filename
rows = rows
delimeter = delimeter

@classmethod

@staticmethod
def build(
cls, filename: str, rows: List[List[str]], delimiter: str = ","
filename: str, rows: List[List[str]], delimiter: str = ","
) -> "GenericCsvTransform":
"""Build a Generic CSV datatype class."""
if "." in filename and not filename.endswith(".csv"):
Expand All @@ -31,11 +26,11 @@ def build(
)
elif "." not in filename:
filename = f"{filename}.csv"
return cls(
filename,
rows,
delimiter,
)
csv = GenericCsvTransform()
csv.filename = filename
csv.rows = rows
csv.delimiter = delimiter
return csv


class ReadData(BaseModel):
Expand Down

0 comments on commit 0482e96

Please sign in to comment.