squirrel.catalog
¶
Package Contents¶
Classes¶
A dictionary-like data structure that versions and maintains |
|
Defines a key in a catalog consisting of the identifier and the version of a source. |
|
Defines a data source by describing its metadata and how it can be read. |
-
class
squirrel.catalog.
Catalog
¶ Bases:
MutableMapping
A dictionary-like data structure that versions and maintains
Source
s.Each source in a Catalog is stored with a
squirrel.catalog.CatalogKey
, which is unique.It is possible to combine multiple Catalogs together or find the difference between them. Refer to class methods for more information.
A Catalog can be [de-]serialized. You can check out the
from_xxx()
andto_xxx()
methods for additional information.-
__iter__
() → Iterator[tuple[str, squirrel.catalog.source.Source]]¶
-
__setitem__
(identifier: str | CatalogKey | tuple[str, int], value: squirrel.catalog.source.Source) → None¶
-
difference
(other: Catalog) → Catalog¶ Return a Catalog which consists of the difference of the input Catalogs.
-
filter
(predicate: Callable[[CatalogSource], bool]) → Catalog¶ Filter catalog sources based on a predicate.
-
static
from_dirs
(paths: list[str]) → Catalog¶ Create a Catalog based on a list of folders containing yaml files.
-
static
from_files
(paths: list[str]) → Catalog¶ Create a Catalog based on a list of paths to yaml files.
-
intersection
(other: Catalog) → Catalog¶ Return a Catalog which consists of the intersection of the input Catalogs.
-
items
() → Iterator[tuple[str, squirrel.catalog.source.Source]]¶ D.items() -> a set-like object providing a view on D’s items
-
-
class
squirrel.catalog.
CatalogKey
¶ Bases:
NamedTuple
Defines a key in a catalog consisting of the identifier and the version of a source.
A CatalogKey uniquely describes a
Source
in aCatalog
.-
identifier
:str¶
-
version
:int¶
-
classmethod
from_yaml
(constructor: ruamel.yaml.Constructor, node: ruamel.yaml.SequenceNode) → CatalogKey¶ Deserializes object from SequenceNode.
-
classmethod
to_yaml
(representer: ruamel.yaml.Representer, obj: CatalogKey) → ruamel.yaml.SequenceNode¶ Serializes object to SequenceNode.
-
-
class
squirrel.catalog.
Source
¶ Defines a data source by describing its metadata and how it can be read.
The driver specified within the Source is responsible for reading from the data source and should contain all the necessary logic for reading, Source itself does not contain this logic.
Sources can be set in a
Catalog
along with a key and a version that uniquely identify them.-
driver_kwargs
:Optional[Dict[str, str]]¶
-
driver_name
:str¶
-
metadata
:Optional[Dict[str, str]]¶
-