Esempio n. 1
0
def add_classes(*models):
    for model in models:
        classes.update({
            model.__tablename__: model,
            model.__tablename__.lower(): model
        })
Esempio n. 2
0
            if "init" in str(file):
                continue
            if dont_create_examples and "examples" in str(file):
                continue
            spec = spec_from_file_location(str(file), str(file))
            assert isinstance(spec.loader, Loader)
            spec.loader.exec_module(module_from_spec(spec))  # type: ignore
    for cls_name, cls in service_classes.items():
        cls_to_properties[cls_name] = list(cls_to_properties["Service"])
        for col in cls.__table__.columns:
            cls_to_properties[cls_name].append(col.key)
            service_import_properties.append(col.key)
            if type(col.type) == Boolean:
                boolean_properties.append(col.key)
            if type(col.type) == PickleType and hasattr(
                    cls, f"{col.key}_values"):
                property_types[col.key] = "list"
            else:
                property_types[col.key] = {
                    Boolean: "bool",
                    Integer: "int",
                    Float: "float",
                    PickleType: "dict",
                }.get(type(col.type), "str")


create_service_classes()
classes.update(service_classes)

import eNMS.automation.routes  # noqa: F401