GWDCObjectMeta class

This metaclass is using to dynamically create three methods, based on the class attribute FILE_LIST_FILTERS. FILE_LIST_FILTERS should be a dict with values being a function that can filter a FileReferenceList, and keys describing which files the filter finds. More info is available in the register_file_list_filter() method.

class gwdc_python.objects.meta.GWDCObjectMeta(classname, bases, attrs)

Bases: type

Metaclass for GWDC objects, which is used to dynamically add methods based on file list filters

register_file_list_filter(name, file_list_filter_fn)

Register a function used to filter the file list. This will create three methods on the class using this filter function:

  • get_{name}_file_list

  • get_{name}_files

  • save_{name}_files

where {name} is the input name string.

Parameters
  • name (str) – String used to name the added methods

  • file_list_filter_fn (function) – A function that takes in the full file list and returns only the desired entries from the list

GWDCObjectBase class

The GWDCObjectBase class contains the GWDCObjectMeta metaclass, and adds a generic initilisation method, along with some other helpful methods.

class gwdc_python.objects.base.GWDCObjectBase(client, _id, _type=None)

Bases: object

Base class from which GWDC objects will inherit. Provides a basic initialisation method, an equality check, a neat string representation and a method with which to get the full file list.

FILE_LIST_FILTERS = {}
get_full_file_list()
is_external()
is_normal()
is_uploaded()