@@ -111,7 +111,8 @@ def __init__(self, final_prompt="", iterable=None, desc=None, total=-1, leave=Tr
111
111
self .desc = desc
112
112
self .total = total
113
113
self .leave = leave
114
- self .file = file
114
+ self .file = global_val .get_value (KEEP_PROCESS_BAR_STYLE_FILE ) \
115
+ if global_val .get_value (KEEP_PROCESS_BAR_STYLE ) else file
115
116
self .ncols = ncols
116
117
self .mininterval = mininterval
117
118
self .maxinterval = maxinterval
@@ -148,7 +149,7 @@ def process(self, *args):
148
149
, delay = self .delay , gui = self .gui )
149
150
else :
150
151
self .batch = args [1 ]
151
- if self .current + self .batch > self .total :
152
+ if self .current + self .batch >= self .total :
152
153
self .bar .update (self .total - self .current )
153
154
self .current = self .total
154
155
self .bar .set_postfix_str (self .final_prompt )
@@ -716,15 +717,12 @@ def __str__(self) -> str:
716
717
def __repr__ (self ) -> str :
717
718
return super ().__repr__ ()
718
719
719
- if __name__ == "__main__" :
720
- basic_config (logs_style = LOG_STYLE_PRINT )
721
- bar = process_bar ()
722
- bar .process (0 , 1 , 100 )
723
- for i in range (100 ):
724
- bar .process (0 , 1 , 100 )
725
- log ("ahfu" )
726
- time .sleep (0.1 )
727
- # for batch in tqdm(range(100), total=100, position=0, file=sys.stdout, desc="desc"):
728
- # if batch % 5 == 0:
729
- # tqdm.write(str(batch))
730
- # time.sleep(1)
720
+ # if __name__ == "__main__":
721
+ # basic_config(logs_style=LOG_STYLE_PRINT, keep_process_bar_style_file=sys.stdout)
722
+ # bar = process_bar(final_prompt="wancheng")
723
+ # bar.process(0, 1, 100)
724
+ # for i in range(100):
725
+ # bar.process(0, 1, 100)
726
+ # log("ahfu")
727
+ # time.sleep(0.1)
728
+
0 commit comments