pi-lens
Version:
Real-time code feedback for pi — LSP, linters, formatters, type-checking, structural analysis & booboo
19 lines (18 loc) • 442 B
YAML
id: unchecked-numeric-parse-python
valid:
- |
# #3211: already-converted-by-construction — Decimal raises
# decimal.InvalidOperation, not ValueError, and is excluded here.
x = float(Decimal("1.5"))
- |
# #3211: a numeric literal argument can never raise ValueError.
x = int(3.7)
- |
try:
g = int(s)
except ValueError:
pass
invalid:
- 'int("42")'
- 'float("3.14")'
- 'int(user_input)'