Use click.IntRange
type to catch integer values < 1 instead of manually checking max_cpu_slices
#459
Labels
minor
Nice to do but not vital
The
--max-cpu-slices
flag has typeclick.INT
which allows for integers < 1:httomo/httomo/cli.py
Lines 86 to 91 in 6af2e2e
However, for the maximum number of CPU slices, a value < 1 doesn't make sense, and thus there is a bit of code manually checking if the given value is < 1:
httomo/httomo/cli.py
Lines 200 to 201 in 6af2e2e
Click provides the type
click.IntRange
which allows for specifying a certain range. In particular, it can be used to provide a boundary on one side of the range, and have the other side of the range be unbounded. This would allow clipping the range of the max CPU slices to not be below 1, but still be anything above 1.A similar case this has been used for already is in the
--frames-per-chunk
flag value, which can't be less than 0, but can be any integer from 0 and above:httomo/httomo/cli.py
Lines 137 to 142 in 6af2e2e
The text was updated successfully, but these errors were encountered: