Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

Commit

Permalink
New environment db (#295)
Browse files Browse the repository at this point in the history
* Filling out UserDB

* Abstract enforce get first

* Clearer argument - num_turns

* Using enums in DB

* Initial episode data model

* Update content loggers to use episode formatting

* Updating tables to work with testing

* Fixing some test changes

* Fixing small warnings that were noise during tests

* Moving default log path

* Test fix

* Correcting math thanks to Kurt

* Updating env DB classes to SQLAlchemy

* Name keys and Elems coded

* Adding arbitrary node attributes

* First complete pass of EnvDB

* Mypy fixings

* Fixing agents

* Writing some tests

* Finishing tests for object and room creates and queries

* Edge testing

* Arbitrary attributes testing

* Quests and testing

* And finally, DBGraph tests

* fixing episode change

* TODO function

* final mypy fixes

* DBID testing

* a -> either a or an depending on aeiou
  • Loading branch information
JackUrb authored Aug 22, 2022
1 parent 84843af commit 0c4b397
Show file tree
Hide file tree
Showing 7 changed files with 3,496 additions and 203 deletions.
10 changes: 10 additions & 0 deletions light/data_model/db/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,16 @@ def _enforce_get_first(self, session, stmt, error_text) -> Any:
raise KeyError(error_text)
return result

def file_path_exists(self, file_path: str) -> bool:
"""
Determine if the given file path exists on this storage
"""
if self.backend in ["test", "local"]:
full_path = os.path.join(self.file_root, file_path)
return os.path.exists(full_path)
else:
raise NotImplementedError

def write_data_to_file(
self, data: Union[str, Dict[str, Any]], filename: str, json_encode: bool = False
) -> None:
Expand Down
Loading

0 comments on commit 0c4b397

Please sign in to comment.