Skip to content

Commit

Permalink
add empty property to connector/pastastore
Browse files Browse the repository at this point in the history
  • Loading branch information
dbrakenhoff committed Sep 26, 2024
1 parent 0bbf23c commit d5940e3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pastastore/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ def __repr__(self):
f"{self.n_models} models"
)

@property
def empty(self):
"""Check if the database is empty."""
return not any([self.n_oseries > 0, self.n_stresses > 0, self.n_models > 0])

@abstractmethod
def _get_library(self, libname: str):
"""Get library handle.
Expand Down
5 changes: 5 additions & 0 deletions pastastore/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ def __init__(
self.plots = Plots(self)
self.yaml = PastastoreYAML(self)

@property
def empty(self) -> bool:
"""Check if the PastaStore is empty."""
return self.conn.empty

def _register_connector_methods(self):
"""Register connector methods (internal method)."""
methods = [
Expand Down

0 comments on commit d5940e3

Please sign in to comment.