|
a/scripts/restore-labels.py |
|
b/scripts/restore-labels.py |
|
... |
|
... |
33 |
|
33 |
|
34 |
def restore_labels(obj, test=True):
|
34 |
def restore_labels(obj, test=True):
|
35 |
if not obj.labels: return
|
35 |
if not obj.labels: return
|
36 |
labels = obj.labels
|
36 |
labels = obj.labels
|
37 |
while True:
|
37 |
while True:
|
38 |
if labels[0] != '[': return
|
38 |
if not labels or labels[0] != '[': return
|
39 |
lbllen = map(len, labels)
|
39 |
lbllen = map(len, labels)
|
40 |
if max(lbllen) != 1: return
|
40 |
if max(lbllen) != 1: return
|
41 |
if min(lbllen) != 1: return
|
41 |
if min(lbllen) != 1: return
|
42 |
s = ''.join(labels)
|
42 |
s = ''.join(labels)
|
43 |
s = s.replace("u'", "'")
|
43 |
s = s.replace("u'", "'")
|