[pp:python] add '"mode": "eval"'
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2023 Mike Fährmann
|
||||
# Copyright 2023-2025 Mike Fährmann
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License version 2 as
|
||||
@@ -17,10 +17,14 @@ class PythonPP(PostProcessor):
|
||||
def __init__(self, job, options):
|
||||
PostProcessor.__init__(self, job)
|
||||
|
||||
spec = options["function"]
|
||||
module_name, _, function_name = spec.rpartition(":")
|
||||
module = util.import_file(module_name)
|
||||
self.function = getattr(module, function_name)
|
||||
mode = options.get("mode")
|
||||
if mode == "eval" or not mode and options.get("expression"):
|
||||
self.function = util.compile_expression(options["expression"])
|
||||
else:
|
||||
spec = options["function"]
|
||||
module_name, _, function_name = spec.rpartition(":")
|
||||
module = util.import_file(module_name)
|
||||
self.function = getattr(module, function_name)
|
||||
|
||||
events = options.get("event")
|
||||
if events is None:
|
||||
|
||||
Reference in New Issue
Block a user