From 0482e96406d17bfc340b2445fa9bdd2b8e5e084f Mon Sep 17 00:00:00 2001 From: CaseyBatten Date: Fri, 18 Oct 2024 18:58:03 -0400 Subject: [PATCH] generic csv build with rules --- .../resources/file_provider.py | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/api/src/opentrons/protocol_engine/resources/file_provider.py b/api/src/opentrons/protocol_engine/resources/file_provider.py index e2cd7900541..e25ae533530 100644 --- a/api/src/opentrons/protocol_engine/resources/file_provider.py +++ b/api/src/opentrons/protocol_engine/resources/file_provider.py @@ -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"): @@ -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):