Skip to content

Commit

Permalink
use isinstance rather than try
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-B committed Oct 16, 2024
1 parent 9b84cdb commit 1312b34
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions spinn_utilities/progress_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,10 @@ class ProgressBar(object):
def __init__(self, total_number_of_things_to_do: Union[int, Sized],
string_describing_what_being_progressed,
step_character="=", end_character="|"):
try:
self._number_of_things = int(total_number_of_things_to_do)
except TypeError:

if isinstance(total_number_of_things_to_do, Sized)
self._number_of_things = len(total_number_of_things_to_do)

else:
self._number_of_things = int(total_number_of_things_to_do)
self._currently_completed = 0
self._chars_per_thing = None
self._chars_done = 0
Expand Down

0 comments on commit 1312b34

Please sign in to comment.