Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def set_link(self, **kwargs):
"""
Add a link to this group
"""
name, builder = getargs('name', 'builder', kwargs)
self.__set_builder(name, builder, GroupBuilder.__link)
def get_attribute(self, **kwargs):
name = getargs('name', kwargs)
return self.__attributes.get(name)
def __init__(self, **kwargs):
name, source, data = getargs('name', 'source', 'data', kwargs)
super(AbstractFeatureSeries, self).__init__(name, source, data, "see 'feature_units'", **kwargs)
self.features = getargs('features', kwargs)
self.feature_units = getargs('feature_units', kwargs)
def set_attribute(self, **kwargs):
"""
Set an attribute for this group.
"""
name, value = getargs('name', 'value', kwargs)
super().__getitem__(GroupBuilder.__attribute)[name] = value
self.obj_type[name] = GroupBuilder.__attribute
def add_link(self, **kwargs):
"""
Create a soft link and add it to this group.
"""
name, path = getargs('name', 'path', kwargs)
builder = LinkBuilder(path)
self.set_link(name, builder)
return builder
def set_dataset(self, **kwargs):
"""
Add a dataset to this group
"""
name, builder, = getargs('name', 'builder', kwargs)
self.__set_builder(name, builder, GroupBuilder.__dataset)
def set_group(self, **kwargs):
"""
Add a subgroup to this group
"""
name, builder, = getargs('name', 'builder', kwargs)
self.__set_builder(name, builder, GroupBuilder.__group)
def register_spec(cls, **kwargs):
'''
Associate a specified object type with an HDF5 specification
'''
obj_type, spec = getargs('obj_type', 'spec', kwargs)
type_name = obj_type.__name__ if isinstance(obj_type, type) else obj_type
if type_name in cls.__specs:
raise ValueError("'%s' - cannot overwrite existing specification" % type_name)
cls.__specs[type_name] = spec
def __init__(self, **kwargs):
name, doc, parent, required, attributes, linkable, neurodata_type_def, neurodata_type = getargs('name', 'doc', 'parent', 'required', 'attributes', 'linkable', 'neurodata_type_def', 'neurodata_type', kwargs)
if name == NAME_WILDCARD and neurodata_type_def is None and neurodata_type is None:
raise ValueError("Cannot create Group or Dataset spec with wildcard name without specifying 'neurodata_type_def' and/or 'neurodata_type'")
super().__init__(doc, name=name, required=required, parent=parent)
self.__attributes = dict()
if not linkable:
self['linkable'] = linkable
if neurodata_type is not None:
self['neurodata_type'] = neurodata_type
if neurodata_type_def is not None:
self.pop('required', None)
self['neurodata_type_def'] = neurodata_type_def
for attribute in attributes:
self.set_attribute(attribute)