X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=example-apps%2FPDD%2Fpcb-defect-detection%2Fhelp_utils%2Ftools.py;fp=example-apps%2FPDD%2Fpcb-defect-detection%2Fhelp_utils%2Ftools.py;h=8b696c8d4d1c3b9fb1bbba6d24722f6b35de73d5;hb=a785567fb9acfc68536767d20f60ba917ae85aa1;hp=0000000000000000000000000000000000000000;hpb=94a133e696b9b2a7f73544462c2714986fa7ab4a;p=ealt-edge.git diff --git a/example-apps/PDD/pcb-defect-detection/help_utils/tools.py b/example-apps/PDD/pcb-defect-detection/help_utils/tools.py new file mode 100755 index 0000000..8b696c8 --- /dev/null +++ b/example-apps/PDD/pcb-defect-detection/help_utils/tools.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import division, print_function, absolute_import +import math +import sys +import os + + +def view_bar(message, num, total): + rate = num / total + rate_num = int(rate * 40) + rate_nums = math.ceil(rate * 100) + r = '\r%s:[%s%s]%d%%\t%d/%d' % (message, ">" * rate_num, " " * (40 - rate_num), rate_nums, num, total,) + sys.stdout.write(r) + sys.stdout.flush() + + +def mkdir(path): + if not os.path.exists(path): + os.makedirs(path) \ No newline at end of file