squirrel.catalog.catalog
¶
Module Contents¶
Classes¶
Init a Catalog object |
|
Typed version of namedtuple. |
-
class
squirrel.catalog.catalog.
Catalog
¶ Bases:
MutableMapping
Init a Catalog object
-
__delitem__
(self, identifier: Union[str, CatalogKey]) → None¶
-
__iter__
(self) → Iterator[Tuple[str, squirrel.catalog.source.Source]]¶
-
__setitem__
(self, identifier: str, value: squirrel.catalog.source.Source) → None¶
-
difference
(self, other: Catalog) → Catalog¶ Return a Catalog which consists of the difference of the input Catalogs.
-
filter
(self: Catalog, 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
(self, other: Catalog) → Catalog¶ Return a Catalog which consists of the intersection of the input Catalogs.
-
items
(self) → Tuple[str, squirrel.catalog.source.Source]¶ D.items() -> a set-like object providing a view on D’s items
-
-
class
squirrel.catalog.catalog.
CatalogKey
¶ Bases:
NamedTuple
Typed version of namedtuple.
Usage in Python versions >= 3.6:
class Employee(NamedTuple): name: str id: int
This is equivalent to:
Employee = collections.namedtuple('Employee', ['name', 'id'])
The resulting class has an extra __annotations__ attribute, giving a dict that maps field names to types. (The field names are also in the _fields attribute, which is part of the namedtuple API.) Alternative equivalent keyword syntax is also accepted:
Employee = NamedTuple('Employee', name=str, id=int)
In Python versions <= 3.5 use:
Employee = NamedTuple('Employee', [('name', str), ('id', int)])
-
identifier
:str¶
-
version
:int¶
-
classmethod
from_yaml
(cls, constructor: ruamel.yaml.Constructor, node: ruamel.yaml.SequenceNode) → CatalogKey¶ Deserializes object from SequenceNode.
-
classmethod
to_yaml
(cls, representer: ruamel.yaml.Representer, obj: CatalogKey) → ruamel.yaml.SequenceNode¶ Serializes object to SequenceNode.
-