Skip to content
This repository has been archived by the owner on Jan 2, 2024. It is now read-only.

Fix/delete scenario #272

Merged
merged 2 commits into from
Jul 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
test_suite="tests",
tests_require=test_requirements,
url="https://github.com/avaiga/taipy-core",
version="1.1.2",
version="1.1.3",
zip_safe=False,
extras_require=extras_require,
)
8 changes: 4 additions & 4 deletions taipy/core/_repository/_fs_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def dir_path(self):
def load(self, model_id: str) -> Entity:
try:
return self.__to_entity(
self.__get_model_filepath(model_id), retry=Config.global_config.read_entity_retry or 0
self._get_model_filepath(model_id), retry=Config.global_config.read_entity_retry or 0
) # type: ignore
except FileNotFoundError:
raise ModelNotFound(str(self.dir_path), model_id)
Expand All @@ -119,7 +119,7 @@ def _save(self, entity):
self.__create_directory_if_not_exists()

model = self._to_model(entity)
self.__get_model_filepath(model.id).write_text(
self._get_model_filepath(model.id).write_text(
json.dumps(model.to_dict(), ensure_ascii=False, indent=0, cls=_CustomEncoder, check_circular=False)
)

Expand All @@ -128,7 +128,7 @@ def _delete_all(self):

def _delete(self, model_id: str):
try:
self.__get_model_filepath(model_id).unlink()
self._get_model_filepath(model_id).unlink()
except FileNotFoundError:
raise ModelNotFound(str(self.dir_path), model_id)

Expand Down Expand Up @@ -181,7 +181,7 @@ def _get_by_configs_and_parent_ids(self, configs_and_parent_ids):
def __search(self, attribute: str, value: str) -> Iterator[Entity]:
return filter(lambda e: getattr(e, attribute, None) == value, self._load_all())

def __get_model_filepath(self, model_id) -> pathlib.Path:
def _get_model_filepath(self, model_id) -> pathlib.Path:
return self.dir_path / f"{model_id}.json"

def __to_entity(self, filepath, by: Optional[str] = None, retry: Optional[int] = 0) -> Entity:
Expand Down