Skip to content

Commit

Permalink
Fix: strip->remove_suffix.
Browse files Browse the repository at this point in the history
  • Loading branch information
lbeyers committed Aug 22, 2024
1 parent b4baa45 commit 1b461b8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions og_marl/vault_utils/combine_vaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@ def combine_vaults(rel_dir: str, vault_name: str, vault_uids: Optional[list[str]
# name of subsampled vault (at task level)
print(vault_uids)
uids_str = "_".join(vault_uids)
new_vault_name = vault_name.strip(".vlt") + "_combined.vlt"
new_vault_name = vault_name.removesuffix(".vlt") + "_combined.vlt"

# check that a subsampled vault by the same name does not already exist
if check_directory_exists_and_not_empty(f"./{rel_dir}/{new_vault_name}"):
print(
f"Vault '{rel_dir}/{new_vault_name.strip('.vlt')}' already exists. To combine from scratch, please remove the current combined vault from its directory."
f"Vault '{rel_dir}/{new_vault_name.removesuffix('.vlt')}' already exists. To combine from scratch, please remove the current combined vault from its directory."
)
return new_vault_name

Expand Down
4 changes: 2 additions & 2 deletions og_marl/vault_utils/subsample_smaller.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,12 @@ def subsample_smaller_vault(
vault_uids = get_available_uids(f"./{vaults_dir}/{vault_name}")

# name of subsampled vault (at task level)
new_vault_name = vault_name.strip(".vlt") + "_" + str(target_number_of_transitions) + ".vlt"
new_vault_name = vault_name.removesuffix(".vlt") + "_" + str(target_number_of_transitions) + ".vlt"

# check that a subsampled vault by the same name does not already exist
if check_directory_exists_and_not_empty(f"./{vaults_dir}/{new_vault_name}"):
print(
f"Vault '{vaults_dir}/{new_vault_name.strip('.vlt')}' already exists. To subsample from scratch, please remove the current subsampled vault from its directory."
f"Vault '{vaults_dir}/{new_vault_name.removesuffix('.vlt')}' already exists. To subsample from scratch, please remove the current subsampled vault from its directory."
)
return f"./{vaults_dir}/{vault_name}"

Expand Down

0 comments on commit 1b461b8

Please sign in to comment.