Validationο
Exceptionsο
- class sloth.mmcif.validator.ValidationError[source]ο
Bases:
ExceptionException raised for validation errors.
- __init__(message, path='', severity=ValidationSeverity.ERROR)[source]ο
Initialize validation error.
- Parameters:
message (
str) β Error messagepath (
str) β Path where the error occurred (e.g., JSON path, category name)severity (
ValidationSeverity) β Validation error severity
Validator Pluginο
- class sloth.mmcif.validator.ValidatorPlugin[source]ο
Bases:
PluginPlugin for per-category validation with cross-checker support.
Multiple validators can be registered for the same category β they will all run in registration order.
- register_validator(category_name, validator_function)[source]ο
Register a validator callable for a category name.
Multiple validators for the same category are allowed.
- register_cross_checker(category_pair, cross_checker_function)[source]ο
Register a cross-checker callable for a pair of category names.
Plugin Systemο
- class sloth.mmcif.plugins.PluginFactory[source]ο
Bases:
objectInstance-level plugin registry for extending dot-notation access.
Plugins are registered with a name (the attribute that will appear on the data object) and a scope that determines which hierarchy level exposes the plugin:
"category"β available onCategoryobjects"block"β available onDataBlockobjects"container"β available onMMCIFDataContainerobjects
- VALID_SCOPES = {'block', 'category', 'container'}ο
- register(name, plugin, scope='category')[source]ο
Register a plugin.
- Parameters:
name (
str) β The dot-notation attribute name (e.g."validate").plugin β A
Plugininstance or a plain callable (auto-wrapped asFunctionPlugin).scope (
str) β"category","block", or"container".
- Return type:
- get_wrapper(name, target, scope)[source]ο
Return a bound
PluginWrapperfor name, orNone.- Return type:
- Parameters:
- class sloth.mmcif.plugins.Plugin[source]ο
Bases:
ABCAbstract base class for plugins that extend dot-notation functionality.
- abstract create_wrapper(target)[source]ο
Return a
PluginWrapper(or subclass) bound to target.- Return type:
- class sloth.mmcif.plugins.PluginWrapper[source]ο
Bases:
objectChainable wrapper returned when a plugin is accessed via dot-notation.
Calling the wrapper executes the plugin and returns
selfso that additional methods (defined by subclasses) can be chained:block._atom_site.validate().against(block._entity) value = block._atom_site.statistics().result