llama.filehandler.mixins module

Mixins for FileHandler classes that add extra functionality.

class llama.filehandler.mixins.FileExtensionMixin

Bases: abc.ABC

For FileHandler abstract subclasses that have multiple possible output formats (and programmatically-generated filenames calculated therefrom in their implementation subclasses).

The following class attributes must be defined in subclasses, either manually or programmatically (see: FileHandler.set_class_attributes and its implementations in subclasses).

The file extension for this file as a string.

FILEEXT = None
class llama.filehandler.mixins.ObservingVetoMixin

Bases: abc.ABC

These files will not be generated for mock data, test events, nor anything that doesn’t look like an online LVC trigger. Veto these files if ‘test’ or ‘injection’ appear anywhere in the event directory path, or if the eventid does not follow the real GraceID regex.

class_vetoes = ((<function role_flag_not_observation>, None), (<function eventid_is_not_real_event_graceid>, None), (<function eventdir_path_contains_string_scratch>, None), (<function eventdir_path_contains_string_test>, None), (<function eventdir_path_contains_string_injection>, None))
class llama.filehandler.mixins.OnlineVetoMixin

Bases: abc.ABC

Mixin for FileHandler classes.

Automatically veto on anything that doesn’t look like a GraceDB online event. Use this to prevent accidentally querying GraceDB or other services for events that are meant to run on a local computer.

class_vetoes = ((<function online_flag_false>, None), (<function eventdir_path_contains_string_manual>, None), (<function eventid_is_not_valid_graceid>, None))
llama.filehandler.mixins.eventid_is_not_real_event_graceid(eventdir)

Check whether the eventid BREAKS from the pattern used for the GraceIDs of real LVC events. Returns True if this eventid looks like a fake or injected GraceID (or just a manually-generated non-GraceDB ID).

llama.filehandler.mixins.eventid_is_not_valid_graceid(eventdir)

Check whether the eventid BREAKS from the pattern used for the GraceIDs of ANY (test OR observation) LVC events. Returns True if this eventid looks like a manually-generated non-GraceDB ID.

llama.filehandler.mixins.online_flag_false(eventdir)

Return whether a trigger directory has its “ONLINE” flag set to “false”.

llama.filehandler.mixins.role_flag_not_observation(eventdir)

Return whether a trigger directory has it’s “ROLE” flag set to something other than “observation”.