@@ -152,7 +152,7 @@ def rename_table(self, old_name: str, new_name: str):
152152 # Update metadata with new name
153153 self ._save_table_metadata (table_id , new_name , columns )
154154
155- def insert (self , table_name : str , row : dict ):
155+ def _insert (self , table_name : str , row : dict ):
156156 table_id , columns = self ._get_table_metadata_by_name (table_name )
157157 if table_id is None :
158158 raise ValueError (f"Table { table_name } not found" )
@@ -165,9 +165,9 @@ def insert(self, table_name: str, row: dict):
165165 temp_table = Table (name = table_name , columns = columns , data = [], table_id = table_id )
166166
167167 rows = json .loads (table_path .read_text ())
168- assert isinstance (
169- rows , list
170- ), f"File { table_path } does not contain a list of rows"
168+ assert isinstance (rows , list ), (
169+ f"File { table_path } does not contain a list of rows"
170+ )
171171
172172 # Convert row to column ID format
173173 row_with_ids = temp_table .convert_row_to_column_ids (row )
@@ -184,9 +184,9 @@ def add_column(self, table_name: str, column: Column):
184184 raise FileNotFoundError (f"File { table_path } does not exist" )
185185
186186 rows = json .loads (table_path .read_text ())
187- assert isinstance (
188- rows , list
189- ), f"File { table_path } does not contain a list of rows"
187+ assert isinstance (rows , list ), (
188+ f"File { table_path } does not contain a list of rows"
189+ )
190190
191191 # Check if column already exists
192192 if any (col .name == column .name for col in existing_columns ):
@@ -213,9 +213,9 @@ def remove_column(self, table_name: str, column_name: str):
213213 raise FileNotFoundError (f"File { table_path } does not exist" )
214214
215215 rows = json .loads (table_path .read_text ())
216- assert isinstance (
217- rows , list
218- ), f"File { table_path } does not contain a list of rows"
216+ assert isinstance (rows , list ), (
217+ f"File { table_path } does not contain a list of rows"
218+ )
219219
220220 # Remove column from data using column ID
221221 column_to_remove = None
@@ -244,9 +244,9 @@ def rename_column(self, table_name: str, old_name: str, new_name: str):
244244 raise FileNotFoundError (f"File { table_path } does not exist" )
245245
246246 rows = json .loads (table_path .read_text ())
247- assert isinstance (
248- rows , list
249- ), f"File { table_path } does not contain a list of rows"
247+ assert isinstance (rows , list ), (
248+ f"File { table_path } does not contain a list of rows"
249+ )
250250
251251 # Data doesn't need to change for rename_column since we use column IDs
252252 # Only metadata needs to be updated
@@ -271,7 +271,7 @@ def change_column_type(
271271 raise ValueError (f"Column { column_name } not found in table { table_name } " )
272272 self ._save_table_metadata (table_id , table_name , columns )
273273
274- def update (self , table_name : str , idx : int , changes : dict ):
274+ def _update (self , table_name : str , idx : int , changes : dict ):
275275 table_id , columns = self ._get_table_metadata_by_name (table_name )
276276 if table_id is None :
277277 raise ValueError (f"Table { table_name } not found" )
@@ -284,9 +284,9 @@ def update(self, table_name: str, idx: int, changes: dict):
284284 temp_table = Table (name = table_name , columns = columns , data = [], table_id = table_id )
285285
286286 rows = json .loads (table_path .read_text ())
287- assert isinstance (
288- rows , list
289- ), f"File { table_path } does not contain a list of rows"
287+ assert isinstance (rows , list ), (
288+ f"File { table_path } does not contain a list of rows"
289+ )
290290 if idx < 0 or idx >= len (rows ):
291291 raise IndexError (f"Index { idx } out of range for table { table_name } " )
292292
@@ -295,7 +295,7 @@ def update(self, table_name: str, idx: int, changes: dict):
295295 rows [idx ].update (changes_with_ids )
296296 table_path .write_text (json .dumps (rows , indent = 2 ))
297297
298- def delete (self , table_name : str , idxs : List [int ]):
298+ def _delete (self , table_name : str , idxs : List [int ]):
299299 table_id , _ = self ._get_table_metadata_by_name (table_name )
300300 if table_id is None :
301301 raise ValueError (f"Table { table_name } not found" )
@@ -305,9 +305,9 @@ def delete(self, table_name: str, idxs: List[int]):
305305 raise FileNotFoundError (f"File { table_path } does not exist" )
306306
307307 rows = json .loads (table_path .read_text ())
308- assert isinstance (
309- rows , list
310- ), f"File { table_path } does not contain a list of rows"
308+ assert isinstance (rows , list ), (
309+ f"File { table_path } does not contain a list of rows"
310+ )
311311
312312 # Sort indices in descending order to avoid index shifting
313313 for idx in sorted (idxs , reverse = True ):
0 commit comments