Skip to content
This repository has been archived by the owner on Oct 27, 2024. It is now read-only.

Commit

Permalink
Fix flake8 errors
Browse files Browse the repository at this point in the history
  • Loading branch information
tygoee committed Nov 22, 2023
1 parent 59b2b9f commit 56f8089
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/install/loadingbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def __next__(self) -> _T:
self.item = next(self.iterable)
self.idx += 1
else:
if TYPE_CHECKING and type(self.total) != int:
if TYPE_CHECKING and not isinstance(self.total, int):
raise TypeError

if self.idx < self.total: # total
Expand Down Expand Up @@ -202,7 +202,7 @@ def refresh(self) -> None:

# Calculate progress
if hasattr(self, 'total'): # both, total
if TYPE_CHECKING and type(self.total) != int:
if TYPE_CHECKING and not isinstance(self.total, int):
raise TypeError

percent = round(self.idx / self.total * 100, 0)
Expand All @@ -221,7 +221,7 @@ def refresh(self) -> None:
current = size(self.idx, traditional)
arg = self.total if hasattr(self, 'total') else self.iterator_len

if TYPE_CHECKING and type(arg) != int:
if TYPE_CHECKING and not isinstance(arg, int):
raise TypeError

total = size(arg, traditional)
Expand All @@ -235,12 +235,10 @@ def refresh(self) -> None:
# Print the loading bar
start = '\033[F\r' if self.show_desc else '\r'

if self.show_desc and self._new_desc:
end = '\n\033[K' + self.desc
elif self.show_desc:
end = '\n' + self.desc
else:
end = ''
end = (
'\n\033[K' + self.desc if self.show_desc and self._new_desc
else '\n' + self.desc if self.show_desc else ''
)

print(start + self.bar_format.format(
title=self.title,
Expand Down

0 comments on commit 56f8089

Please sign in to comment.