Skip to content

Commit

Permalink
replace table setter with set_table method
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzocerrone committed Oct 14, 2024
1 parent f416062 commit a3cdf89
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/ngio/tables/v1/_generic_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ def table(self) -> pd.DataFrame:

@table.setter
def table(self, table: pd.DataFrame) -> None:
raise NotImplementedError(
"Setting the table directly is not supported. "
"Please use the 'set_table' method."
)

def set_table(self, table: pd.DataFrame) -> None:
table = validate_table(
table_df=table,
index_key=self.index_key,
Expand Down
8 changes: 7 additions & 1 deletion src/ngio/tables/v1/feature_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,13 @@ def table(self) -> pd.DataFrame:
@table.setter
def table(self, table: pd.DataFrame):
"""Set the feature table."""
self._table_handler.table = table
raise NotImplementedError(
"Setting the table is not implemented. Please use the 'set_table' method."
)

def set_table(self, table: pd.DataFrame):
"""Set the feature table."""
self._table_handler.set_table(table)

def label_image_name(self, get_full_path: bool = False) -> str:
"""Return the name of the label image.
Expand Down
9 changes: 8 additions & 1 deletion src/ngio/tables/v1/masking_roi_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,14 @@ def table(self) -> pd.DataFrame:

@table.setter
def table(self, table: pd.DataFrame):
self._table_handler.table = table
"""Set the feature table."""
raise NotImplementedError(
"Setting the table is not implemented. Please use the 'set_table' method."
)

def set_table(self, table: pd.DataFrame):
"""Set the feature table."""
self._table_handler.set_table(table)

@property
def list_labels(self) -> list[str]:
Expand Down
9 changes: 8 additions & 1 deletion src/ngio/tables/v1/roi_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,14 @@ def table(self) -> pd.DataFrame:

@table.setter
def table(self, table: pd.DataFrame):
self._table_handler.table = table
"""Set the feature table."""
raise NotImplementedError(
"Setting the table is not implemented. Please use the 'set_table' method."
)

def set_table(self, table: pd.DataFrame):
"""Set the feature table."""
self._table_handler.set_table(table)

@property
def field_indexes(self) -> list[str]:
Expand Down

0 comments on commit a3cdf89

Please sign in to comment.