diff --git a/test.py b/test.py index f702ba2..b83ecbd 100644 --- a/test.py +++ b/test.py @@ -1,10 +1,25 @@ import gds import sys +import math +import progress.bar + +global bar + +def callback(parser): + global bar + + bar.max = parser.total + bar.index = parser.current + bar.update() + for arg in sys.argv[1:]: f = open(arg, "rb") try: - lib = gds.parse_file(f) + bar = progress.bar.IncrementalBar("parsing file") + lib = gds.parse_file(f, progress_func=callback) + print() + print("file version: {}".format(lib.version)) print("last access: {}".format(lib.last_access.isoformat())) print("last modification: {}".format(lib.last_mod.isoformat())) @@ -13,6 +28,9 @@ for arg in sys.argv[1:]: print("library name : {}".format(lib.name)) print("contains a total of {} structure(s)".format(len(lib.structures))) + + bar = progress.bar.IncrementalBar("linking structure references") + lib.link_srefs(callback) except gds.ParserError as e: print("parser error: {}".format(e))