Skip to content

Commit 01b38a2

Browse files
Matrix read
1 parent a488fa7 commit 01b38a2

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

libs/testdata_ops.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ class testdata_operations:
1010
fo = file_ops.file_operations()
1111
ce = CurrentExecution()
1212

13+
def __init__(self):
14+
self.mapping_df: pd.DataFrame = self.fo.read_csv_to_df(file_path="test_data/file_mapping.csv")
15+
1316
def create_file_from_template(self, template_path: str, file_name_prefix: str) -> str:
1417
_template_text = self.fo.get_file_text(file_path=template_path)
1518
_file_text = []
@@ -53,10 +56,9 @@ def clean_df(self, df: pd.DataFrame) -> pd.DataFrame:
5356
return _df
5457

5558
def get_file_paths(self, file_paths: str) -> tuple[str, str]:
56-
_mapping_df: pd.DataFrame = self.fo.read_csv_to_df(file_path="test_data/file_mapping.csv")
57-
_input_template_path: str = _mapping_df.query("ID==@file_paths")["INPUT_TEMPLATE"].to_string(index=False)
58-
_output_template_path: str = _mapping_df.query("ID==@file_paths")["OUTPUT_TEMPLATE"].to_string(index=False)
59-
_file_prefix: str = _mapping_df.query("ID==@file_paths")["FILE_PREFIX"].to_string(index=False)
59+
_input_template_path: str = self.mapping_df.query("ID==@file_paths")["INPUT_TEMPLATE"].to_string(index=False)
60+
_output_template_path: str = self.mapping_df.query("ID==@file_paths")["OUTPUT_TEMPLATE"].to_string(index=False)
61+
_file_prefix: str = self.mapping_df.query("ID==@file_paths")["FILE_PREFIX"].to_string(index=False)
6062
_input_file_path: str = self.create_file_from_template(
6163
template_path=_input_template_path, file_name_prefix=_file_prefix
6264
)

0 commit comments

Comments
 (0)