1- # This contains the main code
1+ """
2+ The module for creating a loading bar in the terminal using emojis.
3+ """
4+
5+ import warnings
26
37# These are just for the nice terminal colour
48GREEN = "\033 [32m"
59RED = "\033 [31m"
610
711RESET = "\033 [0m" # Resets to default terminal color
812
9- import warnings
10- import time
11-
1213
1314class LoadingBar :
1415 """A basic loading bar for the terminal.
@@ -18,20 +19,20 @@ class LoadingBar:
1819 on_emoji(str) : The emoji sr string to show a completed part of the bar
1920 off_emoji(str) : The emoji to show a non-completed part of the bar
2021 capacity(int) : The total length of the bar
21- isPercentage(bool) : True if the status shoudl be represented in percentage format, else in fraction format
22+ isPercentage(bool) : True if the status should be represented in percentage format, else in fraction format
2223 """
2324
2425 def __init__ (
2526 self ,
2627 capacity : int ,
2728 on_emoji : str = "█" ,
2829 off_emoji : str = "▒" ,
29- isPercentage : bool = False ,
30+ is_percentage : bool = False ,
3031 ):
3132 self .on_emoji = on_emoji
3233 self .off_emoji = off_emoji
3334 self .capacity = capacity
34- self .isPercentage = isPercentage
35+ self .is_percentage = is_percentage
3536 self .value = 0
3637
3738 def incrememt_bar (self , prefix : str = "" , suffix : str = "" , display_status = True ):
@@ -58,7 +59,7 @@ def incrememt_bar(self, prefix: str = "", suffix: str = "", display_status=True)
5859 else :
5960 output = output + self .off_emoji
6061
61- if self .isPercentage :
62+ if self .is_percentage :
6263 status = round (self .value / self .capacity * 100 )
6364 if not self .value >= self .capacity :
6465 print (
0 commit comments