From c4f3aaef44a84674277e12ed851576ae572c43ab Mon Sep 17 00:00:00 2001 From: Nikita Tretyakov Date: Sat, 10 Feb 2024 22:25:06 +0100 Subject: [PATCH] Use constant name different from module name for fhirpath fn registry --- fhirpathpy/engine/__init__.py | 10 +++++----- fhirpathpy/engine/invocations/__init__.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fhirpathpy/engine/__init__.py b/fhirpathpy/engine/__init__.py index c6ba34f..7767685 100644 --- a/fhirpathpy/engine/__init__.py +++ b/fhirpathpy/engine/__init__.py @@ -3,7 +3,7 @@ import fhirpathpy.engine.util as util from fhirpathpy.engine.nodes import TypeInfo from fhirpathpy.engine.evaluators import evaluators -from fhirpathpy.engine.invocations import invocations +from fhirpathpy.engine.invocations import invocation_registry def check_integer_param(val): @@ -48,10 +48,10 @@ def doInvoke(ctx, fn_name, data, raw_params): if isinstance(fn_name, list) and len(fn_name) == 1: fn_name = fn_name[0] - if type(fn_name) != str or not fn_name in invocations: + if type(fn_name) != str or not fn_name in invocation_registry: raise Exception("Not implemented: " + str(fn_name)) - invocation = invocations[fn_name] + invocation = invocation_registry[fn_name] if "nullable_input" in invocation and util.is_nullable(data): return [] @@ -167,10 +167,10 @@ def func(data): def infix_invoke(ctx, fn_name, data, raw_params): - if not fn_name in invocations or not "fn" in invocations[fn_name]: + if not fn_name in invocation_registry or not "fn" in invocation_registry[fn_name]: raise Exception("Not implemented " + fn_name) - invocation = invocations[fn_name] + invocation = invocation_registry[fn_name] paramsNumber = len(raw_params) if paramsNumber != 2: diff --git a/fhirpathpy/engine/invocations/__init__.py b/fhirpathpy/engine/invocations/__init__.py index 97cf326..7e5bb2f 100644 --- a/fhirpathpy/engine/invocations/__init__.py +++ b/fhirpathpy/engine/invocations/__init__.py @@ -16,7 +16,7 @@ import fhirpathpy.engine.invocations.aggregate as aggregate from fhirpathpy.engine.nodes import FP_DateTime, FP_Quantity, FP_Time -invocations = { +invocation_registry = { "empty": {"fn": existence.empty_fn}, "not": {"fn": existence.not_fn}, "exists": {"fn": existence.exists_macro, "arity": {0: [], 1: ["Expr"]}},