From 62a433ad3ca80431895da9b47e9cf9d38438492f Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Wed, 29 Nov 2017 17:06:24 +0100 Subject: [PATCH] In CRL Core, added helpers.overload() to modificate Python tuples. --- crlcore/python/helpers/__init__.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/crlcore/python/helpers/__init__.py b/crlcore/python/helpers/__init__.py index 96f8d72d..b2a86efa 100644 --- a/crlcore/python/helpers/__init__.py +++ b/crlcore/python/helpers/__init__.py @@ -279,6 +279,23 @@ def setTraceLevel ( level ): return +def overload ( defaultParameters, parameters ): + overloads = {} + overloadParameters = [] + + for parameter in parameters: + overloads[ parameter[0] ] = parameter + + for parameter in defaultParameters: + if overloads.has_key(parameter[0]): + overloadParameters.append( overloads[parameter[0]] ) + else: + overloadParameters.append( parameter ) + + return tuple(overloadParameters) + + + def lambdaMode (): global unitsLambda unitsLambda = true