Skip to content

Commit

Permalink
Change getters to properties
Browse files Browse the repository at this point in the history
Per jmao

Co-authored-by: Jianfeng Mao <4297243+jmao-denver@users.noreply.github.com>
  • Loading branch information
arman-ddl and jmao-denver authored Mar 12, 2024
1 parent 0ff048d commit c58fbe9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
12 changes: 5 additions & 7 deletions py/server/deephaven/table_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,18 +272,16 @@ def delete(self, table: Table) -> None:
except Exception as e:
raise DHError(e, "delete data in the InputTable failed.") from e

@property
def get_key_names(self) -> List[str]:
"""Gets the names of the key columns.
Returns:
a list with the names of the key columns of this input table
"""The names of the key columns of the InputTable.
"""
return j_list_to_list(self.j_input_table.getKeyNames())

def get_value_names(self) -> List[str]:
"""Gets the names of the value columns. By default, any column not marked as a key column is a value column.
@property
def value_names(self) -> List[str]:
"""The names of the value columns. By default, any column not marked as a key column is a value column.
Returns: a list with the names of the value columns of this input table
"""
return j_list_to_list(self.j_input_table.getValueNames())

Expand Down
4 changes: 2 additions & 2 deletions py/server/tests/test_table_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,8 @@ def test_input_table(self):
col_defs = {c.name: c.data_type for c in t.columns}
with self.subTest("from table definition"):
append_only_input_table = input_table(col_defs=col_defs)
self.assertEqual(append_only_input_table.get_key_names(), [])
self.assertEqual(append_only_input_table.get_value_names(), [col.name for col in cols])
self.assertEqual(append_only_input_table.key_names, [])
self.assertEqual(append_only_input_table.value_names, [col.name for col in cols])
append_only_input_table.add(t)
self.assertEqual(append_only_input_table.size, 2)
append_only_input_table.add(t)
Expand Down

0 comments on commit c58fbe9

Please sign in to comment.