Skip to content

Commit 387c791

Browse files
authored
Enable E722 (#2642)
1 parent 7f01d76 commit 387c791

File tree

7 files changed

+10
-11
lines changed

7 files changed

+10
-11
lines changed

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ ignore = [
160160
"F405", # https://docs.astral.sh/ruff/rules/undefined-local-with-import-star-usage/
161161
"E712", # https://docs.astral.sh/ruff/rules/true-false-comparison/
162162
"E721", # https://docs.astral.sh/ruff/rules/type-comparison/
163-
"E722", # https://docs.astral.sh/ruff/rules/bare-except/
164163
]
165164

166165
[tool.ruff.lint.per-file-ignores]

thunder/benchmarks/benchmark_litgpt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ def train(self):
763763
self.calculate_model_flops()
764764
# Setup throughput Collection
765765
self.throughput = Throughput(window_size=self.max_iters - self.warmup_iters, world_size=world_size)
766-
except:
766+
except Exception:
767767
self.throughput = None
768768
print(
769769
f"Model Flops/Throughput calculation failed for model {self.model_name}. Skipping throughput metric collection."

thunder/core/baseutils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ def fnprint(fn: FunctionType | MethodType | CodeType, first=True) -> Callable:
288288
if first:
289289
try:
290290
source = inspect.getsource(x)
291-
except:
291+
except Exception:
292292
source = "Source could not be found."
293293
else:
294294
source = f"SUBFUNCTION {x.co_name}:"
@@ -389,7 +389,7 @@ def indent(level):
389389
def is_base_printable_type(typ: type, /) -> bool:
390390
try:
391391
return typ in _type_to_str_map
392-
except:
392+
except Exception:
393393
return False
394394

395395

@@ -443,7 +443,7 @@ def print_type(typ: type, /, *, with_quotes: bool = True) -> str:
443443
def is_base_printable_literal(x: Any, /) -> bool:
444444
try:
445445
return x in _printable_literals
446-
except:
446+
except Exception:
447447
return False
448448

449449

thunder/core/compile_data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,13 @@ def get_cache_option() -> CACHE_OPTIONS:
7777
def using_symbolic_values() -> bool:
7878
try:
7979
return get_cache_option() is CACHE_OPTIONS.SYMBOLIC_VALUES
80-
except:
80+
except Exception:
8181
return False
8282

8383

8484
def using_jit() -> bool:
8585
try:
8686
cd, cs = _compile_data.get()
8787
return cd.using_jit
88-
except:
88+
except Exception:
8989
return False

thunder/core/symbol.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ def _kwarg_printables(self):
585585
def _hash(self) -> int:
586586
try:
587587
return hash((self.sym, self._var_args, self._var_output, len(self.kwargs)))
588-
except:
588+
except Exception:
589589
# Since args / output may contain unhashable types
590590
return id(self)
591591

thunder/tests/test_fa3_executor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from flash_attn_interface import flash_attn_func
1212

1313
HAS_FA3 = True
14-
except:
14+
except Exception:
1515
HAS_FA3 = False
1616

1717
import math

thunder/tests/test_interpreter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ def bare_except():
626626
try:
627627
assert is_jitting_with_raise() == jitting
628628
raise ValueError(msg)
629-
except:
629+
except Exception:
630630
assert is_jitting_with_raise() == jitting
631631
return True
632632

@@ -845,7 +845,7 @@ def main():
845845

846846
try:
847847
model(x)
848-
except:
848+
except Exception:
849849
pass
850850
return weakref.ref(x)
851851

0 commit comments

Comments
 (0)