parsedb: more verbose on duplicate bits

Signed-off-by: John McMaster <johndmcmaster@gmail.com>
This commit is contained in:
John McMaster 2018-12-11 11:55:51 -08:00
parent a2c22c5379
commit 962dcc78d0
1 changed files with 4 additions and 4 deletions

View File

@ -7,7 +7,7 @@ from prjxray import util
def run(fnin, fnout=None, strict=False, verbose=False): def run(fnin, fnout=None, strict=False, verbose=False):
lines = open(fnin, 'r').read().split('\n') lines = open(fnin, 'r').read().split('\n')
tags = dict() tags = dict()
bitss = set() bitss = dict()
for line in lines: for line in lines:
line = line.strip() line = line.strip()
if line == '': if line == '':
@ -23,11 +23,11 @@ def run(fnin, fnout=None, strict=False, verbose=False):
print("Original line: %s" % tags[tag]) print("Original line: %s" % tags[tag])
print("New line: %s" % line) print("New line: %s" % line)
assert 0, "strict: got duplicate tag %s" % (tag, ) assert 0, "strict: got duplicate tag %s" % (tag, )
assert bits not in bitss, "strict: got duplicate bits %s (ex: %s)" % ( assert bits not in bitss, "strict: got duplicate bits %s: %s %s" % (
bits, line) bits, tag, bitss[bits])
tags[tag] = line tags[tag] = line
if bits != None: if bits != None:
bitss.add(bits) bitss[bits] = tag
if fnout: if fnout:
with open(fnout, "w") as fout: with open(fnout, "w") as fout: