From e761f1017f79dcb36abf97e37b180b9a9bba50ad Mon Sep 17 00:00:00 2001 From: Marco Mangano <36549388+marcomangano@users.noreply.github.com> Date: Thu, 10 Feb 2022 12:19:39 -0500 Subject: [PATCH] added optional flush option to custom pp function (#71) --- baseclasses/solvers/BaseSolver.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/baseclasses/solvers/BaseSolver.py b/baseclasses/solvers/BaseSolver.py index f913fd7..3f410c2 100644 --- a/baseclasses/solvers/BaseSolver.py +++ b/baseclasses/solvers/BaseSolver.py @@ -224,7 +224,7 @@ def printModifiedOptions(self): modifiedOptions = self.getModifiedOptions() self.pp(modifiedOptions) - def pp(self, obj): + def pp(self, obj, flush=False): """ This method prints ``obj`` (via pprint) on the root proc of ``self.comm`` if it exists. Otherwise it will just print ``obj``. @@ -236,6 +236,6 @@ def pp(self, obj): """ if (self.comm is not None and self.comm.rank == 0) or self.comm is None: if isinstance(obj, str): - print(obj) + print(obj, flush=flush) else: pprint(obj)