From 73220c5abdad0c5e18cc67f7e3fab6d1d1061943 Mon Sep 17 00:00:00 2001 From: Henri Menke Date: Thu, 9 Nov 2023 09:33:52 +0100 Subject: [PATCH] Restore Python 3.8 compatibility for dictionary merge --- python/solid_dmft/dmft_tools/matheval.py | 7 +++++-- python/solid_dmft/dmft_tools/solver.py | 8 ++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/python/solid_dmft/dmft_tools/matheval.py b/python/solid_dmft/dmft_tools/matheval.py index 47ea6267..c8798927 100644 --- a/python/solid_dmft/dmft_tools/matheval.py +++ b/python/solid_dmft/dmft_tools/matheval.py @@ -39,7 +39,10 @@ class MathExpr(object): "max": max, "pow": pow, "round": round, - } | {key: value for (key, value) in vars(math).items() if not key.startswith("_")} + } + functions.update( + {key: value for (key, value) in vars(math).items() if not key.startswith("_")} + ) def __init__(self, expr): if any(elem in expr for elem in "\n#"): @@ -53,4 +56,4 @@ def __init__(self, expr): self.code = compile(node, "", "eval") def __call__(self, **kwargs): - return eval(self.code, {"__builtins__": None}, self.functions | kwargs) + return eval(self.code, {"__builtins__": None}, {**self.functions, **kwargs}) diff --git a/python/solid_dmft/dmft_tools/solver.py b/python/solid_dmft/dmft_tools/solver.py index eee44c48..fdfd362b 100755 --- a/python/solid_dmft/dmft_tools/solver.py +++ b/python/solid_dmft/dmft_tools/solver.py @@ -397,7 +397,7 @@ def solve(self, **kwargs): # Solve the impurity problem for icrsh shell # ************************************* - self.triqs_solver.solve(h_int=self.h_int, **(self.solver_params | random_seed )) + self.triqs_solver.solve(h_int=self.h_int, **{ **self.solver_params, **random_seed }) # ************************************* # call postprocessing @@ -413,7 +413,7 @@ def solve(self, **kwargs): # Solve the impurity problem for icrsh shell # ************************************* - self.triqs_solver.solve(h_int=self.h_int, **(self.solver_params | random_seed )) + self.triqs_solver.solve(h_int=self.h_int, **{ **self.solver_params, **random_seed }) # ************************************* # call postprocessing @@ -587,7 +587,7 @@ def make_positive_definite(G): # Solve the impurity problem for icrsh shell # ************************************* - self.triqs_solver.solve(h_int=self.h_int, **(self.solver_params | random_seed )) + self.triqs_solver.solve(h_int=self.h_int, **{ **self.solver_params, **random_seed }) # ************************************* # call postprocessing @@ -604,7 +604,7 @@ def make_positive_definite(G): # Solve the impurity problem for icrsh shell # ************************************* - self.triqs_solver.solve(h_int=self.h_int, **(self.solver_params | random_seed )) + self.triqs_solver.solve(h_int=self.h_int, **{ **self.solver_params, **random_seed }) # ************************************* # call postprocessing