Skip to content

Commit 2b2c10b

Browse files
committed
truncate: Improve code style to pass pylint checks
1 parent bcfa512 commit 2b2c10b

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/truncate.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,12 @@ def truncate(opts, files: list[Path], size_prefix: str | None, size_num: int | N
8585
if opts.reference:
8686
opts.reference = Path(opts.reference)
8787

88+
size_prefix: int | None = None
89+
size_num: int | None = None
90+
8891
if opts.size:
89-
size_prefix = opts.size[0]
90-
if size_prefix not in frozenset("+-<>/%"):
91-
size_prefix = None
92+
if opts.size[0] in frozenset("+-<>/%"):
93+
size_prefix = opts.size[0]
9294

9395
try:
9496
size_num = int(opts.size[1:] if size_prefix else opts.size)
@@ -99,9 +101,6 @@ def truncate(opts, files: list[Path], size_prefix: str | None, size_num: int | N
99101
parser.error("you must specify a relative '--size' with '--reference'")
100102
elif not opts.reference:
101103
parser.error("you must specify either '--size' or '--reference'")
102-
else:
103-
size_prefix = None
104-
size_num = None
105104

106105
if not args:
107106
parser.error("missing file operand")

0 commit comments

Comments
 (0)