llama.classes module

Primitive base classes used throughout the pipeline.

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

Bases: tuple


Alias for field number 2


Alias for field number 0


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.

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


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


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.


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


Write outdict to all the files in self.fullpaths.

class llama.classes.ManifestTuple(eventdir, manifest_filehandlers)

Bases: tuple


Alias for field number 0


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 all rider files associated with this manifest.


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


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


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


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

llama.classes.placeholderclass(name, modulename, bases=<class 'object'>)

Define and return a placeholder class that raises a NotImplementedError on instantiation.

  • name (str) – The name of the new class.
  • modulename (str) – The name of the module you would like to import from.
  • bases (tuple) – The base classes of the new placeholder class.

newclass – A placeholder class that immediately raises a NotImplementedError when you try to instantiate it.

Return type:


llama.classes.registerstub(name, modulename, stub)

Register a stub object. Just a way to keep track of when partial implementations of objects have been defined as replacements for modules that cannot be imported for whatever reason (since these stub objects might not provide perfect/full functionality of the missing modules).

  • name (str) – The variable name of the stub object.
  • modulename (str) – The name of the module where it is defined; you should probably set this to __name__ to get the name of the defining scope for the stub.
  • stub (function or type) – The stub object itself.
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.