INNER CODE UNIT · Python
generate_code
BayesWitnesses/m2cgen · m2cgen/cli.py:114
def generate_code(args):
sys.setrecursionlimit(args.recursion_limit)
with args.infile as f:
pickle_lib = __import__(args.lib)
model = pickle_lib.load(f)
exporter, supported_args = LANGUAGE_TO_EXPORTER[args.language]
kwargs = {}
for arg_name in supported_args:
arg_value = getattr(args, arg_name)
if arg_value is not None:
kwargs[arg_name] = arg_value
# Special handling for the function_name parameter, which needs to be
# the same as the default value of the keyword argument of the exporter
# (this is due to languages like C# which prefer their method names to