in src/dfcx_scrapi/tools/maker_util.py [0:0]
def set_entity_type_attr(cls, entity_type, kwargs):
for key, value in kwargs.items():
if key == "kind":
kind = types.entity_type.EntityType.Kind
obj = cls.make_generic(value, kind, kind(0))
setattr(entity_type, key, obj)
# For the auto expansion mode case create helper object to set at
# entity_type attribute
elif key == "auto_expansion_mode":
aem = types.entity_type.EntityType.AutoExpansionMode
obj = cls.make_generic(value, aem, aem(1))
setattr(entity_type, key, obj)
# For the entities case iterate over dictionary and assign key value
# pairs to entity type elements of entities list
elif key == "entities":
entity = types.entity_type.EntityType.Entity
obj = cls.make_seq(value, entity, entity())
setattr(entity_type, key, obj)
# For the excluded phrases case assign value to the excluded phrase
# object then set as the entity_type attribute
elif key == "excluded_phrases":
ep = types.entity_type.EntityType.ExcludedPhrase
obj = cls.make_seq(value, ep, ep())
setattr(entity_type, key, obj)
else:
setattr(entity_type, key, value)