hdmf.validate.validator module¶
- hdmf.validate.validator.check_type(expected, received)¶
expected should come from the spec received should come from the data
- hdmf.validate.validator.get_iso8601_regex()¶
- hdmf.validate.validator.get_type(data)¶
- hdmf.validate.validator.check_shape(expected, received)¶
- class hdmf.validate.validator.ValidatorMap(namespace)¶
Bases:
objectA class for keeping track of Validator objects for all data types in a namespace
- Parameters
namespace (
SpecNamespace) – the namespace to builder map for
- property namespace¶
- valid_types(spec)¶
Get all valid types for a given data type
- get_validator(data_type)¶
Return the validator for a given data type
- Parameters
data_type (
BaseStorageSpecorstr) – the data type to get the validator for
- validate(builder)¶
Validate a builder against a Spec
buildermust have the attribute used to specifying data type by the namespace used to construct this ValidatorMap.- Parameters
builder (
BaseBuilder) – the builder to validate- Returns
a list of errors found
- Return type
- class hdmf.validate.validator.Validator(spec, validator_map)¶
Bases:
objectA base class for classes that will be used to validate against Spec subclasses
- Parameters
spec (
Spec) – the specification to use to validatevalidator_map (
ValidatorMap) – the ValidatorMap to use during validation
- property spec¶
- property vmap¶
- abstract validate(value)¶
- Parameters
value (None) – either in the form of a value or a Builder
- Returns
a list of Errors
- Return type
- classmethod get_spec_loc(spec)¶
- classmethod get_builder_loc(builder)¶
- class hdmf.validate.validator.AttributeValidator(spec, validator_map)¶
Bases:
ValidatorA class for validating values against AttributeSpecs
- Parameters
spec (
AttributeSpec) – the specification to use to validatevalidator_map (
ValidatorMap) – the ValidatorMap to use during validation
- class hdmf.validate.validator.BaseStorageValidator(spec, validator_map)¶
Bases:
ValidatorA base class for validating against Spec objects that have attributes i.e. BaseStorageSpec
- Parameters
spec (
BaseStorageSpec) – the specification to use to validatevalidator_map (
ValidatorMap) – the ValidatorMap to use during validation
- validate(builder)¶
- Parameters
builder (
BaseBuilder) – the builder to validate- Returns
a list of Errors
- Return type
- class hdmf.validate.validator.DatasetValidator(spec, validator_map)¶
Bases:
BaseStorageValidatorA class for validating DatasetBuilders against DatasetSpecs
- Parameters
spec (
DatasetSpec) – the specification to use to validatevalidator_map (
ValidatorMap) – the ValidatorMap to use during validation
- validate(builder)¶
- Parameters
builder (
DatasetBuilder) – the builder to validate- Returns
a list of Errors
- Return type
- class hdmf.validate.validator.GroupValidator(spec, validator_map)¶
Bases:
BaseStorageValidatorA class for validating GroupBuilders against GroupSpecs
- Parameters
spec (
GroupSpec) – the specification to use to validatevalidator_map (
ValidatorMap) – the ValidatorMap to use during validation
- validate(builder)¶
- Parameters
builder (
GroupBuilder) – the builder to validate- Returns
a list of Errors
- Return type
- class hdmf.validate.validator.SpecMatches(spec)¶
Bases:
objectA utility class to hold a spec and the builders matched to it
- add(builder)¶
- class hdmf.validate.validator.SpecMatcher(vmap, specs)¶
Bases:
objectMatches a set of builders against a set of specs
This class is intended to isolate the task of choosing which spec a builder should be validated against from the task of performing that validation.
- property unmatched_builders¶
Returns the builders for which no matching spec was found
These builders can be considered superfluous, and will generate a warning in the future.
- property spec_matches¶
(spec, assigned builders)
- Type
Returns a list of tuples of
- assign_to_specs(builders)¶
Assigns a set of builders against a set of specs (many-to-one)
In the case that no matching spec is found, a builder will be added to a list of unmatched builders.