Skip to content

Commit 4afc2a1

Browse files
committed
Removed system from exception list.
1 parent ede3c31 commit 4afc2a1

File tree

1 file changed

+8
-40
lines changed

1 file changed

+8
-40
lines changed

sfsimodels/files.py

Lines changed: 8 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def ecp_dict_to_objects(ecp_dict, custom_map=None, verbose=0):
113113

114114
data_models = ecp_dict["models"]
115115

116-
exception_list = ["system"] # TODO: make system not an exception
116+
exception_list = []
117117
objs = OrderedDict()
118118
collected = set([])
119119
# Set base type properly
@@ -186,45 +186,13 @@ def ecp_dict_to_objects(ecp_dict, custom_map=None, verbose=0):
186186
objs[base_type][int(data_models[mtype][m_id]["id"])] = new_instance
187187

188188
# Deal with all the exceptions
189-
for mtype in data_models:
190-
base_type = mtype
191-
192-
if base_type in collected:
193-
continue
194-
if base_type not in objs:
195-
objs[base_type] = OrderedDict()
196-
197-
if base_type == "system": # must be run after other objects are loaded
198-
for m_id in data_models[mtype]:
199-
obj = data_models[mtype][m_id]
200-
if "type" not in obj:
201-
obj["type"] = base_type
202-
try:
203-
obj_class = obj_map["%s-%s" % (base_type, obj["type"])]
204-
except KeyError:
205-
raise KeyError("Map for Model: '%s' index: '%s' and type: '%s' not available, "
206-
"add '%s-%s' to custom dict" % (mtype, m_id, base_type, base_type, obj["type"]))
207-
new_system = obj_class()
208-
209-
# Attach the soil profile
210-
soil_profile_id = data_models[mtype][m_id]['soil_profile_id']
211-
soil_profile = objs["soil_profile"][int(soil_profile_id)]
212-
new_system.sp = soil_profile
213-
214-
# Attach the foundation
215-
foundation_id = data_models[mtype][m_id]['foundation_id']
216-
foundation = objs["foundation"][int(foundation_id)]
217-
new_system.fd = foundation
218-
219-
# Attach the building
220-
building_id = data_models[mtype][m_id]['building_id']
221-
building = objs["building"][int(building_id)]
222-
new_system.bd = building
223-
224-
# Add remaining parameters
225-
ignore_list = ["foundation_id", "building_id", "soil_profile_id"]
226-
add_to_obj(new_system, data_models[mtype][m_id], exceptions=ignore_list, verbose=verbose)
227-
objs[base_type][int(data_models[mtype][m_id]["id"])] = new_system
189+
# for mtype in data_models:
190+
# base_type = mtype
191+
#
192+
# if base_type in collected:
193+
# continue
194+
# if base_type not in objs:
195+
# objs[base_type] = OrderedDict()
228196

229197
all_bts = list(objs)
230198
for base_type in all_bts: # Support for old style ecp file

0 commit comments

Comments
 (0)