HedSchemaGroup

class HedSchemaGroup(schema_list, name='')[source]

Container for multiple HedSchema objects.

Notes

  • The container class is useful when library schema are included.

  • You cannot save/load/etc. the combined schema object directly.

Methods

HedSchemaGroup.__init__(schema_list[, name])

Combine multiple HedSchema objects from a list.

HedSchemaGroup.check_compliance([...])

Check for HED3 compliance of this schema.

HedSchemaGroup.find_tag_entry(tag[, ...])

Find the schema entry for a given source tag.

HedSchemaGroup.get_formatted_version()

The HED version string including namespace and library name if any of this schema.

HedSchemaGroup.get_schema_versions()

A list of HED version strings including namespace and library name if any of this schema.

HedSchemaGroup.get_tag_entry(name[, ...])

Return the schema entry for this tag, if one exists.

HedSchemaGroup.get_tags_with_attribute(attribute)

Return tag entries with the given attribute.

HedSchemaGroup.schema_for_namespace(namespace)

Return the HedSchema for the library namespace.

Attributes

HedSchemaGroup.name

User provided name for this schema, defaults to filename or version if no name provided.

HedSchemaGroup.schema_83_props

Returns if this is an 8.3.0 or greater schema.

HedSchemaGroup.valid_prefixes

Return a list of all prefixes this group will accept.

HedSchemaGroup.__init__(schema_list, name='')[source]

Combine multiple HedSchema objects from a list.

Parameters:

schema_list (list) – A list of HedSchema for the container.

Returns:

the container created.

Return type:

HedSchemaGroup

Raises:

HedFileError

  • Multiple schemas have the same library prefixes.

  • Empty list passed

HedSchemaGroup.check_compliance(check_for_warnings=True, name=None, error_handler=None)[source]

Check for HED3 compliance of this schema.

Parameters:
  • check_for_warnings (bool) – If True, checks for formatting issues like invalid characters, capitalization.

  • name (str) – If present, use as the filename for context, rather than using the actual filename. Useful for temp filenames when supporting web services.

  • error_handler (ErrorHandler or None) – Used to report errors. Uses a default one if none passed in.

Returns:

A list of all warnings and errors found in the file. Each issue is a dictionary.

Return type:

list

HedSchemaGroup.find_tag_entry(tag, schema_namespace='')[source]

Find the schema entry for a given source tag.

Parameters:
  • tag (str, HedTag) – Any form of tag to look up. Can have an extension, value, etc.

  • schema_namespace (str) – The schema namespace of the tag, if any.

Returns:

The located tag entry for this tag. str: The remainder of the tag that isn’t part of the base tag. list: A list of errors while converting.

Return type:

HedTagEntry

Notes

Works left to right (which is mostly relevant for errors).

HedSchemaGroup.get_formatted_version()[source]

The HED version string including namespace and library name if any of this schema.

Returns:

The complete version of this schema including library name and namespace.

Return type:

str

HedSchemaGroup.get_schema_versions()[source]

A list of HED version strings including namespace and library name if any of this schema.

Returns:

The complete version of this schema including library name and namespace.

Return type:

list

HedSchemaGroup.get_tag_entry(name, key_class=HedSectionKey.Tags, schema_namespace='')[source]

Return the schema entry for this tag, if one exists.

Parameters:
  • name (str) – Any form of basic tag(or other section entry) to look up. This will not handle extensions or similar. If this is a tag, it can have a schema namespace, but it’s not required

  • key_class (HedSectionKey or str) – The type of entry to return.

  • schema_namespace (str) – Only used on Tags. If incorrect, will return None.

Returns:

The schema entry for the given tag.

Return type:

HedSchemaEntry

HedSchemaGroup.get_tags_with_attribute(attribute, key_class=HedSectionKey.Tags)[source]

Return tag entries with the given attribute.

Parameters:
  • attribute (str) – A tag attribute. Eg HedKey.ExtensionAllowed

  • key_class (HedSectionKey) – The HedSectionKey for the section to retrieve from.

Returns:

A list of all tags with this attribute.

Return type:

list

Notes

  • The result is cached so will be fast after first call.

HedSchemaGroup.schema_for_namespace(namespace)[source]

Return the HedSchema for the library namespace.

Parameters:

namespace (str) – A schema library name namespace.

Returns:

The specific schema for this library name namespace if exists.

Return type:

HedSchema or None

HedSchemaGroup.name

User provided name for this schema, defaults to filename or version if no name provided.

HedSchemaGroup.schema_83_props

Returns if this is an 8.3.0 or greater schema.

Returns:

True if standard or partnered schema is 8.3.0 or greater.

Return type:

is_83_schema(bool)

HedSchemaGroup.valid_prefixes

Return a list of all prefixes this group will accept.

Returns:

A list of strings representing valid prefixes for this group.

Return type:

list