Пример #1
0
 def parse_entity_type(self, entity):
     type = entity.attrib["name"]
     params = {}
     for sub in entity:
         if sub.tag == "parameter":
             key, val = self.parse_parameter_type(sub)
             params[key] = val
     polymorphic_name = calculate_polymorphic_name(type, params)
     if polymorphic_name in self.known_objects:
         return type, params, polymorphic_name
     else:
         raise UnregisteredTypesError("Object not found", (type, params))
Пример #2
0
 def is_registered(self, name, declared_params):
     polymorphic_name = calculate_polymorphic_name(name, declared_params)
     return polymorphic_name in (t.__name__ for t in self.registered_entities)