From c51e58768732b6ba37f27979d6d8f8dcee25a339 Mon Sep 17 00:00:00 2001 From: Alexander Schlemmer <alexander@mail-schlemmer.de> Date: Tue, 9 Jan 2024 10:27:03 +0100 Subject: [PATCH] DOC/API: name of ifelse was changed to submatch --- src/caoscrawler/transformer_functions.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/caoscrawler/transformer_functions.py b/src/caoscrawler/transformer_functions.py index 35da68f5..6b2fa57d 100644 --- a/src/caoscrawler/transformer_functions.py +++ b/src/caoscrawler/transformer_functions.py @@ -27,9 +27,12 @@ import re from typing import Any -def ifelse(in_value: Any, in_parameters: dict): - """returns the first argument if it does NOT match the reg exp of 'match' stored in the second - argument, other wise the value of 'then' stored in the second argument is returned. +def submatch(in_value: Any, in_parameters: dict): + """ + Substitute the variable if it matches the regexp stored in "match". + + Returns the "in" value if it does NOT match the reg exp of 'match'. + Otherwise (if it matches) the value of 'then' stored in the second argument is returned. """ if "match" not in in_parameters or "then" not in in_parameters: raise RuntimeError("Mandatory parameters missing.") -- GitLab