Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cmbant committed Aug 21, 2024
1 parent 649f4e0 commit 8589dc2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions getdist/chains.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ def chainFiles(root, chain_indices=None, ext='.txt', separator="_",
reg_exp = re.compile(re.escape(basename) + '(' + re.escape(separator) + '(?P<num>[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) \
Expand Down
6 changes: 2 additions & 4 deletions getdist/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 8589dc2

Please sign in to comment.