arelle.utils.validate.ValidationPlugin#

See COPYRIGHT.md for copyright information.

Module Contents#

Classes#

API#

class arelle.utils.validate.ValidationPlugin.ValidationPlugin(name: str, disclosureSystemConfigUrl: pathlib.Path, validationTypes: list[str], validationRuleModules: list[types.ModuleType])#

Initialization

Base validation plugin class. Can be initialized directly, or extended if you require additional plugin hooks. This class is intended to be used in conjunction with the @validation decorator.

If you need to cache or store data between rules, you should implement a dataclass that extends PluginData and override the newPluginData method to return your dataclass.

Parameters:
  • disclosureSystemConfigUrl – A path to the plugin disclosure system xml config file.

  • validationTypes – A list of validation types for the plugin. These should correspond to the validation types in your disclosure system xml file.

  • validationRulesModule – The rules module which will be searched recursively for rule functions decorated with @validation.

newPluginData(validateXbrl: arelle.ValidateXbrl.ValidateXbrl) arelle.utils.PluginData.PluginData#

Returns a dataclass intended to be overriden by plugins to facilitate caching and passing data between rule functions. The default implementation doesn’t provide any fields other than the plugin name.

Returns:

An instance of PluginData.

property validationTypes: tuple[str, ...]#
property disclosureSystemConfigURL: str#
property disclosureSystemTypes: tuple[tuple[str, str], ...]#
abstract modelDocumentPullLoader(modelXbrl: arelle.ModelXbrl.ModelXbrl, normalizedUri: str, filepath: str, isEntry: bool, namespace: str | None, *args: Any, **kwargs: Any) arelle.ModelDocument.ModelDocument | arelle.ModelDocument.LoadingException | None#
abstract modelXbrlLoadComplete(modelXbrl: arelle.ModelXbrl.ModelXbrl, *args: Any, **kwargs: Any) arelle.ModelDocument.ModelDocument | arelle.ModelDocument.LoadingException | None#
validateXbrlStart(val: arelle.ValidateXbrl.ValidateXbrl, parameters: dict[Any, Any], *args: Any, **kwargs: Any) None#

Executes validation functions in the rules module that was provided to the constructor of this class. Each function decorated with @validation will be run if:

  1. the decorator was used with the xbrl start hook: @validation(hook=ValidationHook.XBRL_START)

  2. the user selected disclosure system is in line with the combination of disclosure systems provided to the decorator.

Parameters:
  • val – The ValidateXBRL instance.

  • parameters – dictionary of validation parameters.

  • args – Argument capture to ensure new parameters don’t break plugin hook.

  • kwargs – Argument capture to ensure new named parameters don’t break plugin hook.

Returns:

None

validateXbrlFinally(val: arelle.ValidateXbrl.ValidateXbrl, *args: Any, **kwargs: Any) None#

Executes validation functions in the rules module that was provided to the constructor of this class. Each function decorated with @validation will be run if:

  1. the decorator was used with the xbrl finally hook: @validation(hook=ValidationHook.XBRL_FINALLY)

  2. the user selected disclosure system is in line with the combination of disclosure systems provided to the decorator.

Parameters:
  • val – The ValidateXBRL instance.

  • args – Argument capture to ensure new parameters don’t break plugin hook.

  • kwargs – Argument capture to ensure new named parameters don’t break plugin hook.

Returns:

None

validateXbrlDtsDocument(val: arelle.ValidateXbrl.ValidateXbrl, modelDocument: arelle.ModelDocument.ModelDocument, isFilingDocument: bool, *args: Any, **kwargs: Any) None#

Executes validation functions in the rules module that was provided to the constructor of this class. Each function decorated with @validation will be run if:

  1. the decorator was used with the xbrl dts document hook: @validation(hook=ValidationHook.XBRL_DTS_DOCUMENT)

  2. the user selected disclosure system is in line with the combination of disclosure systems provided to the decorator.

Parameters:
  • val – The ValidateXBRL instance.

  • args – Argument capture to ensure new parameters don’t break plugin hook.

  • kwargs – Argument capture to ensure new named parameters don’t break plugin hook.

Returns:

None

validateFinally(val: arelle.ValidateXbrl.ValidateXbrl, *args: Any, **kwargs: Any) None#

Executes validation functions in the rules module that was provided to the constructor of this class. Each function decorated with @validation will be run if:

  1. the decorator was used with the validate finally hook: @validation(hook=ValidationHook.FINALLY)

  2. the user selected disclosure system is in line with the combination of disclosure systems provided to the decorator.

Parameters:
  • val – The ValidateXBRL instance.

  • args – Argument capture to ensure new parameters don’t break plugin hook.

  • kwargs – Argument capture to ensure new named parameters don’t break plugin hook.

Returns:

None

_executeValidations(pluginHook: arelle.utils.PluginHooks.ValidationHook, validateXbrl: arelle.ValidateXbrl.ValidateXbrl, *args: Any, **kwargs: Any) None#
disclosureSystemFromPluginSelected(model: arelle.ValidateXbrl.ValidateXbrl | arelle.ModelXbrl.ModelXbrl) bool#
_getValidations(disclosureSystem: arelle.DisclosureSystem.DisclosureSystem, pluginHook: arelle.utils.PluginHooks.ValidationHook) list[arelle.utils.validate.Decorator.ValidationFunction]#
_discoverValidations() None#
_storeValidationFunction(func: arelle.utils.validate.Decorator.ValidationFunction, attributes: arelle.utils.validate.Decorator.ValidationAttributes) None#