for k in self . __dir__ (): c = getattr ( self , k ) if k . startswith ( '_' ) or k in [ 'extend_existing' , 'metadata' , 'query' ] or callable ( c ): continue m [ k ] = c return m
  • models
class Stat(db.Model, BaseModel):
    __abstract__ = True
    extend_existing = True
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    time = db.Column(db.DateTime, nullable=False)
    status = db.Column(db.Integer, nullable=False)
    health = db.Column(db.JSON, nullable=False)
  • dynamic
stat_class_dict = {}
def get_stat_cls(name):
    cls = stat_class_dict.get(name, None)
    if cls is None: