Skip to content

Commit aa17119

Browse files
chore: Specify exceptions to remove inline ignores of E722 (#1194)
* Specify exception for all exception cases * Remove all inline noqa: E722 - E722: Do not use bare except, specify exception instead
1 parent c25ef59 commit aa17119

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/pyhf/pdf.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -731,9 +731,10 @@ def logpdf(self, pars, data):
731731
): # force to be not scalar, should we changed with #522
732732
return tensorlib.reshape(result, (1,))
733733
return result
734-
except: # noqa: E722
734+
except Exception:
735735
log.error(
736-
f'eval failed for data {tensorlib.tolist(data)} pars: {tensorlib.tolist(pars)}'
736+
f"Eval failed for data {tensorlib.tolist(data)} pars: {tensorlib.tolist(pars)}",
737+
exc_info=True,
737738
)
738739
raise
739740

tests/test_init.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def test_missing_backends(isolate_modules, param):
4141

4242
try:
4343
delattr(pyhf.tensor, module_name)
44-
except: # noqa: E722
44+
except AttributeError:
4545
pass
4646

4747
with expectation:
@@ -80,7 +80,7 @@ def test_missing_optimizer(isolate_modules, param):
8080
)
8181
try:
8282
delattr(pyhf.optimize, module_name)
83-
except: # noqa: E722
83+
except AttributeError:
8484
pass
8585

8686
with expectation:

0 commit comments

Comments
 (0)