mirror of
https://github.com/vale981/jobmanager
synced 2025-03-05 18:01:38 -05:00
python2.7 hack to make math.ceil return an integer
This commit is contained in:
parent
e17992d0c2
commit
c6a142af08
2 changed files with 26 additions and 19 deletions
|
@ -18,6 +18,13 @@ try:
|
|||
from shutil import get_terminal_size as shutil_get_terminal_size
|
||||
except ImportError:
|
||||
shutil_get_terminal_size = None
|
||||
|
||||
if sys.version_info[0] == 2:
|
||||
old_math_ceil = math.ceil
|
||||
def my_int_ceil(f):
|
||||
return int(old_math_ceil(f))
|
||||
|
||||
math.ceil = my_int_ceil
|
||||
|
||||
|
||||
class Loop(object):
|
||||
|
@ -1001,7 +1008,7 @@ class ProgressBarFancy(Progress):
|
|||
if res is not None:
|
||||
s1, s2, d1, d2 = res
|
||||
s = s1 + ' '*d1 + ps + ' '*d2 + s2
|
||||
|
||||
|
||||
s_before = s[:math.ceil(width*p)].replace(' ', repl_ch)
|
||||
if (len(s_before) > 0) and (s_before[-1] == repl_ch):
|
||||
s_before = s_before[:-1] + '>'
|
||||
|
|
|
@ -661,24 +661,24 @@ def test_progress_bar_fancy_small():
|
|||
|
||||
if __name__ == "__main__":
|
||||
func = [
|
||||
test_loop_basic,
|
||||
test_loop_signals,
|
||||
test_loop_normal_stop,
|
||||
test_loop_need_sigterm_to_stop,
|
||||
test_loop_need_sigkill_to_stop,
|
||||
test_why_with_statement,
|
||||
test_progress_bar,
|
||||
test_progress_bar_with_statement,
|
||||
test_progress_bar_multi,
|
||||
test_status_counter,
|
||||
test_status_counter_multi,
|
||||
test_intermediate_prints_while_running_progess_bar,
|
||||
test_intermediate_prints_while_running_progess_bar_multi,
|
||||
test_progress_bar_counter,
|
||||
test_progress_bar_counter_non_max,
|
||||
test_progress_bar_counter_hide_bar,
|
||||
test_progress_bar_slow_change,
|
||||
test_progress_bar_start_stop,
|
||||
# test_loop_basic,
|
||||
# test_loop_signals,
|
||||
# test_loop_normal_stop,
|
||||
# test_loop_need_sigterm_to_stop,
|
||||
# test_loop_need_sigkill_to_stop,
|
||||
# test_why_with_statement,
|
||||
# test_progress_bar,
|
||||
# test_progress_bar_with_statement,
|
||||
# test_progress_bar_multi,
|
||||
# test_status_counter,
|
||||
# test_status_counter_multi,
|
||||
# test_intermediate_prints_while_running_progess_bar,
|
||||
# test_intermediate_prints_while_running_progess_bar_multi,
|
||||
# test_progress_bar_counter,
|
||||
# test_progress_bar_counter_non_max,
|
||||
# test_progress_bar_counter_hide_bar,
|
||||
# test_progress_bar_slow_change,
|
||||
# test_progress_bar_start_stop,
|
||||
test_progress_bar_fancy,
|
||||
test_progress_bar_multi_fancy,
|
||||
test_progress_bar_fancy_small,
|
||||
|
|
Loading…
Add table
Reference in a new issue