test: add progress bar to read operation
This commit is contained in:
parent
06bc11fb17
commit
76f0677296
20
test.py
20
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))
|
||||
|
Loading…
Reference in New Issue
Block a user