Skip to content
3 changes: 2 additions & 1 deletion dascore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
from dascore.core.attrs import PatchAttrs
from dascore.core.summary import PatchSummary
from dascore.core.spool import BaseSpool, Spool, spool
from dascore.core.inventory import Inventory, inventory
from dascore.core.inventory import Inventory
from dascore.core.inventory_loader import inventory
from dascore.core.coordmanager import get_coord_manager, CoordManager
from dascore.core.coords import get_coord
from dascore.config import (
Expand Down
26 changes: 0 additions & 26 deletions dascore/core/inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -2307,29 +2307,3 @@ def from_yaml(cls, source) -> Self:
msg = f"Could not parse an inventory mapping from {source!r}."
raise InvalidInventoryError(msg)
return cls(**data).check()


def inventory(source=None) -> Inventory:
"""
Load or create a DASDAE inventory.

Parameters
----------
source
An existing Inventory (returned as is), a YAML file path or YAML
text, or None for an empty inventory.

Examples
--------
>>> import dascore as dc
>>> empty = dc.inventory()
>>> assert dc.inventory(empty) is empty
"""
if source is None:
return Inventory()
if isinstance(source, Inventory):
return source
if isinstance(source, str | os.PathLike):
return Inventory.from_yaml(source)
msg = f"Could not get an inventory from {source!r}."
raise InvalidInventoryError(msg)
Loading
Loading