Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
slundqui committed Nov 16, 2024
1 parent 392efc4 commit 3dde0e4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
18 changes: 16 additions & 2 deletions src/agent0/core/hyperdrive/interactive/chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,13 +513,27 @@ def _add_hyperdrive_name_to_dataframe(self, df: pd.DataFrame, addr_column: str):
out.insert(df.columns.get_loc(addr_column), "hyperdrive_name", hyperdrive_name) # type: ignore
return out

def dump_db(self, save_dir: Path):
def dump_db(self, save_dir: Path) -> None:
"""Export the managed database to file.
Arguments
---------
save_dir: Path
The output directory to dump the data to.
"""
if self.db_session is not None:
# TODO parameterize the save path
os.makedirs(save_dir, exist_ok=True)
export_db_to_file(save_dir, self.db_session)

def load_db(self, load_dir: Path):
def load_db(self, load_dir: Path) -> None:
"""Import the managed database from file.
Arguments
---------
load_dir: Path
The directory that contains the exported database.
"""
if self.db_session is not None:
# TODO parameterize the load path
import_to_db(self.db_session, load_dir, drop=True)
4 changes: 1 addition & 3 deletions src/agent0/core/hyperdrive/interactive/local_hyperdrive.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,9 +408,7 @@ def sync_database(
backfill_progress_bar=progress_bar,
)

def _maybe_run_blocking_data_pipeline(
self, start_block: int | None = None, progress_bar: bool = False, force_init: bool = False
) -> None:
def _maybe_run_blocking_data_pipeline(self, start_block: int | None = None, progress_bar: bool = False) -> None:
# Checks the chain config to see if manual sync is on. Noop if it is.
if not self.chain.config.manual_database_sync:
self.sync_database(start_block, progress_bar)
Expand Down

0 comments on commit 3dde0e4

Please sign in to comment.