added mig_meow rule creation

This commit is contained in:
PatchOfScotland
2022-12-02 14:05:49 +01:00
parent 00b5449089
commit ccaca5e60e
9 changed files with 100 additions and 2 deletions

View File

@ -0,0 +1,20 @@
from core.correctness.validation import check_input
from core.meow import BaseRule
from patterns.file_event_pattern import FileEventPattern
from recipes.jupyter_notebook_recipe import JupyterNotebookRecipe
class FileEventJupyterNotebookRule(BaseRule):
def __init__(self, name: str, pattern:FileEventPattern,
recipe:JupyterNotebookRecipe):
super().__init__(name, pattern, recipe)
if pattern.recipe != recipe.name:
raise ValueError(f"Cannot create Rule {name}. Pattern "
f"{pattern.name} does not identify Recipe {recipe.name}. It "
f"uses {pattern.recipe}")
def _is_valid_pattern(self, pattern:FileEventPattern) -> None:
check_input(pattern, FileEventPattern)
def _is_valid_recipe(self, recipe:JupyterNotebookRecipe) -> None:
check_input(recipe, JupyterNotebookRecipe)