From 8589dc2b819301086d7bdee7528508fc6bce0981 Mon Sep 17 00:00:00 2001 From: Antony Lewis Date: Wed, 21 Aug 2024 21:04:18 +0100 Subject: [PATCH] fix --- getdist/chains.py | 3 +-- getdist/types.py | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/getdist/chains.py b/getdist/chains.py index 39b1352..77e2dbf 100644 --- a/getdist/chains.py +++ b/getdist/chains.py @@ -93,8 +93,7 @@ def chainFiles(root, chain_indices=None, ext='.txt', separator="_", reg_exp = re.compile(re.escape(basename) + '(' + re.escape(separator) + '(?P[0-9]+))?' + re.escape(ext)) files = [] for f in os.listdir(folder): - match = reg_exp.fullmatch(f) - if match: + if match := reg_exp.fullmatch(f): index = int(match.group("num") or 0) if (chain_indices is None or index in chain_indices) \ and (chain_exclude is None or index not in chain_exclude) \ diff --git a/getdist/types.py b/getdist/types.py index 163ce9f..fefd884 100644 --- a/getdist/types.py +++ b/getdist/types.py @@ -109,8 +109,7 @@ def namesigFigs(self, value, limplus, limminus, wantSign=True, sci=False): err_sf = 1 if sci: # First, call without knowing sig figs, to get the exponent - exponent = self.formatNumber(max(abs(value - limminus), abs(value + limplus)), sci=True)[1] - if exponent = self.formatNumber(max(abs(value - limminus), abs(value + limplus)), sci=True)[1]: + if exponent := self.formatNumber(max(abs(value - limminus), abs(value + limplus)), sci=True)[1]: value, limplus, limminus = [ (lambda x: decimal.getcontext().multiply( float_to_decimal(x), float_to_decimal(10. ** -exponent)))(lim) @@ -287,8 +286,7 @@ def __init__(self, ncol, results, limit=2, tableParamNames=None, titles=None, fo """ results = list(makeList(results)) for i, res in enumerate(results): - getMargeStats = getattr(res, "getMargeStats", None) - if getMargeStats is not None: + if (getMargeStats := getattr(res, "getMargeStats", None)) is not None: results[i] = getMargeStats() self.lines = [] if formatter is None: