Skip to content

Commit 7644af5

Browse files
committed
cut, factor: Instantiate exceptions when raising them
1 parent 74c3d65 commit 7644af5

2 files changed

Lines changed: 2 additions & 4 deletions

File tree

‎userland/utilities/cut.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
from .. import core
66

7-
87
type Ranges = list[int | tuple[int, int | None]]
98
type RangeChecker = Callable[[int], bool]
109

@@ -127,7 +126,7 @@ def parse_range(range_specs: str) -> Ranges:
127126
case [n, m]:
128127
ranges.append((int(n), int(m)))
129128
case _:
130-
raise ValueError
129+
raise ValueError()
131130
except ValueError:
132131
parser.error(f"invalid range specification: {range_specs}")
133132

‎userland/utilities/factor.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
from .. import core
55

6-
76
# List of small primes greater than 2; used for lookup.
87
SMALL_PRIMES = [3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]
98

@@ -115,7 +114,7 @@ def python_userland_factor(opts, args: list[str]) -> int:
115114
try:
116115
num = int(arg)
117116
if num < 0:
118-
raise ValueError
117+
raise ValueError()
119118
except ValueError:
120119
failed = True
121120
core.perror(f"'{arg}' is not a valid positive integer")

0 commit comments

Comments
 (0)