Mixins¶
- checklet mixin class mtrchk.org.momotor.check.files.mixin.CheckFilesMixin¶
A mixin for checklets to match a list of files with a set of
rules.Most of the implementation is in the
BaseCheckFilesMixinclass. This split was made to allow reuse with different types of files.- check_file_rules(input_files)¶
Check correctness of files in input_files according to the
matchoptions, or thematch-defaultif the former are not provided.- Parameters:
input_files (
FilterableTuple[File]) – list of files to check- Return type:
- Returns:
a checklet result object with the outcome and report of the check
- checklet mixin class mtrchk.org.momotor.check.files.mixin.BaseCheckFilesMixin¶
An abstract base class for checklets that check files.
- match option¶
Match rules for the files to check.
Can contain reference placeholders and task id placeholders, and these will be expanded before the match rules are parsed.
- Type:
Any
- Required:
False
- Multiple:
True
- All:
False
- Location:
config, step, recipe
- Default:
No default
- match-default option¶
Default match rules when no
matchoptions are provided.Can contain reference placeholders and task id placeholders, and these will be expanded before the match rules are parsed.
Can only be provided in the recipe or steps, not in the config.
- Type:
Any
- Required:
False
- Multiple:
True
- All:
False
- Location:
recipe, step
- Default:
No default
- accepted-file-class option¶
Default file class for files matching pass rules if no class is given in the
matchoption.If empty and the match option also do not supply a class, no file will be added to the result.
- Type:
Any
- Required:
False
- Multiple:
False
- Location:
config, step, recipe
- Default:
accepted
- rejected-file-class option¶
Default file class for files matching fail rules if no class is given in the
matchoption.If empty and the match option also do not supply a class, no file will be added to the result.
- Type:
Any
- Required:
False
- Multiple:
False
- Location:
config, step, recipe
- Default:
rejected
- remaining-file-class option¶
File class for files not matching any rules. Empty to not export these files.
- Type:
Any
- Required:
False
- Multiple:
False
- Location:
config, step, recipe
- Default:
Empty string
- report-title option¶
Title for the generated report.
- Type:
Any
- Required:
False
- Multiple:
False
- Location:
config, step, recipe
- Default:
Checking expected files:
- report-files option¶
Add a list of all files in the input ref to the report.
- Type:
boolean
- Required:
False
- Multiple:
False
- Location:
config, step, recipe
- Default:
True
- fail-reason option¶
Default reason message for the failure if no message is given in the
matchoption.- Type:
Any
- Required:
False
- Multiple:
False
- Location:
config, step, recipe
- Default:
File check failed
- _check_file_rules(input_files, *, matcher)¶
Process files in input_files according to the match rules in the
matchoptions, or thematch-defaultif the former are not provided.- Parameters:
input_files (
FilterableTuple[TypeVar(TO)]) – list of files to checkmatcher (
BaseMatcher[TypeVar(TO)]) – a matcher object to use for the check
- Return type:
- Returns:
a checklet result object with the outcome and report of the check
- abstract check_file_rules(input_files)¶
Process files in input_files according to the match rules in the
matchoptions, or thematch-defaultif the former are not provided.Abstract method that must be implemented in subclasses,
_check_file_rules()can be used to implement this method.- Parameters:
input_files (
FilterableTuple[TypeVar(TO)]) – list of files to check- Return type:
- Returns:
a checklet result object with the outcome and report of the check
- generate_file_report(input_files)¶
Generate a html view of the files in input_files.
Can be overridden in subclasses to customize the report.
- generate_report(input_files, messages, errors)¶
Generate a html report for the file check.
Can be overridden in subclasses to customize the report.