Skip to content

Commit 11ff878

Browse files
committed
Ignore TRY400
1 parent 1e954aa commit 11ff878

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

.ruff.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ ignore = [
123123
"UP008", # use super() instead of super(class, self). no harm being explicit
124124
"UP015", # unnecessary open(file, "r"). no harm being explicit
125125
"TRY003", # prevents custom exception messages not defined in exception itself.
126+
"TRY400", # enforces log.exception instead of log.error in except clause.
126127
"ISC001", # single line implicit string concatenation. formatter recommends ignoring this.
127128
]
128129

jwst/clean_flicker_noise/clean_flicker_noise.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ def clip_to_background(
365365
data_for_stats, bins=2000, range=(center - 4.0 * sigma, center + 4.0 * sigma)
366366
)
367367
except ValueError:
368-
log.error("Histogram failed; using clip center and sigma.") # noqa: TRY400
368+
log.error("Histogram failed; using clip center and sigma.")
369369
hist, edges = None, None
370370

371371
param_opt = None
@@ -383,7 +383,7 @@ def gaussian(x, g_amp, g_mean, g_sigma):
383383
try:
384384
param_opt, _ = curve_fit(gaussian, values, hist, p0=param_start, bounds=bounds)
385385
except RuntimeError:
386-
log.error("Gaussian fit failed; using clip center and sigma.") # noqa: TRY400
386+
log.error("Gaussian fit failed; using clip center and sigma.")
387387
param_opt = None
388388

389389
if verbose:
@@ -619,7 +619,7 @@ def background_level(image, mask, background_method="median", background_box_siz
619619
)
620620
background = bkg.background
621621
except ValueError:
622-
log.error("Background fit failed, using median value.") # noqa: TRY400
622+
log.error("Background fit failed, using median value.")
623623
background = np.nanmedian(image[mask])
624624
else:
625625
background = np.nanmedian(image[mask])

0 commit comments

Comments
 (0)