llama.classes module

Primitive base classes used throughout the pipeline.

class llama.classes.FileHandlerTuple(eventid, rundir, clsname)

Bases: tuple

clsname

Alias for field number 2

eventid

Alias for field number 0

rundir

Alias for field number 1

class llama.classes.Hdf5Storage(filename)

Bases: object

A class for reading and writing to an HDF5 cache. Has a dictionary interface and abstracts away file opening and closing.

class llama.classes.ImmutableDict

Bases: frozenset

A hashable, immutable namespace inspired by namedtuple. Initialize by passing a dict or an iterable of (key, value) tuples. Attributes are accessible using dot notation or the map interface.

get(k[, d]) → D[k] if k in D, else d. d defaults to None.
items()

D.iteritems() -> an iterator over the (key, value) items of D

keys()

D.iterkeys() -> an iterator over the keys of D

values()

D.itervalues() -> an iterator over the values of D

class llama.classes.JsonRiderMixin

Bases: object

Class for reading and writing JSON to multiple rider files in a manifest.

read_json(err=False)

Returns None if none of the fullpaths exists, unless err is True, in which case a FileNotFoundError will be raised.

write_json(outdict)

Write outdict to all the files in self.fullpaths.

class llama.classes.ManifestTuple(eventdir, manifest_filehandlers)

Bases: tuple

eventdir

Alias for field number 0

manifest_filehandlers

Alias for field number 1

class llama.classes.NamespaceMappable

Bases: abc.ABC

A mappable class implementing a dot-notation for accessing members.

exception llama.classes.OptionalFeatureWarning

Bases: UserWarning

A warning indicating that an optional feature will not be available. You will usually want to suppress this (except when running tests, evaluating the status of a fresh install/upgrade, or debugging).

class llama.classes.RequiredAttributeMixin

Bases: object

Class with a required_attributes classmethod that finds all _REQUIRED attributes for itself and all superclasses. Use this feature to check whether subclasses have implemented all required attributes from their abstract superclasses.

To add new required attributes, specify a _REQUIRED tuple listing the names of those attributes as str instances. If your superclasses already define other required attributes thus, there is no need to reinclude them in the new class’s _REQUIRED tuple.

classmethod required_attributes()

Recursively fetch a set of required attributes for this class based on its _REQUIRED attribute as well as the required_attributes class method of all of superclasses implementing it.

class llama.classes.RiderFile(eventdir, manifest_filehandlers)

Bases: llama.classes.ManifestTuple, abc.ABC

A rider class that specifies filenames and fullpaths for a given manifest and a given rider_fmt.

delete()

Delete all rider files associated with this manifest.

exists()

Check whether any of the rider files in this manifest exist.

filenames

Get the name of the file indicating the cooldown status of this file.

fullpaths

Get the full path of the file indicating the cooldown status of this file.

rider_fmt

The format string for this rider file. Must be implemented by subclasses as a property or attribute.

llama.classes.rider_mixin_factory(classname, **kwargs)

Get a Mixin with name classname for FileHandler classes that provides properties with the whose names are the kwargs keys and whose return values are RiderFile instances initialized to that specific FileHandler. This implies that the values of kwargs are RiderFile subclasses.