squirrel.catalog.catalog

Module Contents

Classes

Catalog

Init a Catalog object

CatalogKey

Typed version of namedtuple.

class squirrel.catalog.catalog.Catalog

Bases: MutableMapping

Init a Catalog object

__contains__(self, identifier: str)bool
__delitem__(self, identifier: Union[str, CatalogKey])None
__eq__(self, other: Any)bool

Return self==value.

__getitem__(self, identifier: str)CatalogSource
__iter__(self)Iterator[Tuple[str, squirrel.catalog.source.Source]]
__len__(self)int
__repr__(self)str

Return repr(self).

__setitem__(self, identifier: str, value: squirrel.catalog.source.Source)None
copy(self)Catalog

Return a deep copy of catalog

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.

static from_plugins()Catalog

Returns a Catalog containing sources specified by plugins.

static from_str(cat: str)Catalog

Create a Catalog based on a yaml string.

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

join(self, other: Catalog)Catalog

Return a joined Catalog out of two disjoint Catalogs.

keys(self)KeysView[str]

D.keys() -> a set-like object providing a view on D’s keys

slice(self, keys: List[str])Catalog

Return a deep copy of catalog were only by key specified sources get copied.

property sources(self)Dict[str, CatalogSource]

Read only property

to_file(self, path: str)None

Save a Catalog to a yaml file at the specified path.

union(self, other: Catalog)Catalog

Return a Catalog which consists of the union of the input Catalogs.

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.