bryan-stearns commited on
Commit ·
83a928f
1
Parent(s): 2ca6dd2
Fixing crash when descriptions not given properly in file
Browse files- smem_obj.py +12 -5
smem_obj.py
CHANGED
|
@@ -44,13 +44,16 @@ class SMEM_Obj():
|
|
| 44 |
_, short_label, desc = child.to_string()
|
| 45 |
# Trim the label based on the object type
|
| 46 |
if child.obj_type == ObjType.COND_PRIM:
|
| 47 |
-
if desc:
|
| 48 |
str_to_use = desc
|
| 49 |
else:
|
| 50 |
str_to_use = short_label
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
| 54 |
# Merge this dict of sets with results from each branch of children
|
| 55 |
child_dict = child.get_referenced_features(dict_of_values)
|
| 56 |
for key, val in child_dict.items():
|
|
@@ -207,7 +210,11 @@ class SMEM_Obj():
|
|
| 207 |
retval_long += long
|
| 208 |
retval_short += short
|
| 209 |
if compile_component_descs:
|
| 210 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 211 |
return retval_long, retval_short, retval_desc
|
| 212 |
|
| 213 |
def get_op_string(self):
|
|
|
|
| 44 |
_, short_label, desc = child.to_string()
|
| 45 |
# Trim the label based on the object type
|
| 46 |
if child.obj_type == ObjType.COND_PRIM:
|
| 47 |
+
if desc and desc != "()":
|
| 48 |
str_to_use = desc
|
| 49 |
else:
|
| 50 |
str_to_use = short_label
|
| 51 |
+
try:
|
| 52 |
+
ind = str_to_use.index(" is ")
|
| 53 |
+
feature, value = str_to_use.replace("(","").replace(")","").split(" is ",maxsplit=1)
|
| 54 |
+
dict_of_values[feature].add(value)
|
| 55 |
+
except:
|
| 56 |
+
print("ERROR: str_to_use missing 'is'. Value was: '"+str(str_to_use)+"'")
|
| 57 |
# Merge this dict of sets with results from each branch of children
|
| 58 |
child_dict = child.get_referenced_features(dict_of_values)
|
| 59 |
for key, val in child_dict.items():
|
|
|
|
| 210 |
retval_long += long
|
| 211 |
retval_short += short
|
| 212 |
if compile_component_descs:
|
| 213 |
+
if desc:
|
| 214 |
+
retval_desc += "("+desc+")"
|
| 215 |
+
else:
|
| 216 |
+
retval_desc = None
|
| 217 |
+
compile_component_descs = False
|
| 218 |
return retval_long, retval_short, retval_desc
|
| 219 |
|
| 220 |
def get_op_string(self):
|