class radgroupreply(db.Model): __table__ = 'radgroupreply' id = db.IntegerField(primary_key=True) groupname = db.StringField() attribute = db.StringField() op = db.StringField()
class Rule(db.Document): action = db.StringField() data = db.ListField() freq = db.FloatField() conf = db.FloatField() q = db.FloatField() index = db.FloatField() direction = db.StringField()
class Users(db.Document): '''Mongodb Model for Users''' username = db.StringField(required=True, unique=True) email = db.EmailField(unique=True) passwd_digest = db.StringField() meta = { 'indexes': ['username', 'email'] } def __init__(self, **kwargs): super(Users, self).__init__(**kwargs) def __repr__(self): return '(User : %s)' % self.username
class RuleSample(db.Document): name = db.StringField(required=True) inPointers = db.ListField() outPointers = db.ListField() inData = db.ListField() outData = db.ListField() requires = db.ListField() index = db.IntField() def __str__(self): return "%(name)s %(inPointers)s/%(inData)s -> %(outPointers)s/%(outData)s" % self @property def html(self): from lxml.html import builder as E return E.TABLE( E.CLASS("instruct"), E.TR(E.TH("Instruction", colspan="2")), E.TR( E.TD(str(tuple(self.outPointers)) + " ← " + self.name + str(tuple(self.inPointers)), colspan="2")), E.TR( E.TD(*[E.DIV(str(k)) for k in self.outData]), E.TD(*[E.DIV(str(k)) for k in self.inData]), ), ) __repr__ = __str__
class Leaf(Node): __name = db.StringField(required=True) __tag = db.StringField() def _init(self, children, name, tag): Node._init(self, children) assert(children == []) self.__name = name self.__tag = tag @property def tag(self): return self.__tag def __repr__(self): return "<%s, %s>" % (self.__class__.__name__, repr((self.__name, self.__tag))) def __str__(self): return "%s[%s]" % (self.__tag, self.__name) @property def leaves(self): return [self] @property def words(self): return [self.__name] @property def text(self): return self.__name @property def html(self): from lxml.html import builder as E return E.DIV( E.CLASS("treeObject tree"+self.__class__.__name__), self.__tag, E.DIV( E.CLASS("treeObject treeLeaf"+self.__class__.__name__), self.__name ) )
class User(UserMixin, db.Document): username = db.StringField(max_length=80, unique=True, required=True) email = db.StringField(max_length=80, unique=True, required=True) #: The hashed password password = db.StringField(max_length=128, required=True) created_at = db.DateTimeField(required=True) first_name = db.StringField(max_length=30) last_name = db.StringField(max_length=30) active = db.BooleanField(default=False) is_admin = db.BooleanField(default=False) @classmethod def create(cls, username, email, password, **kwargs): now = dt.datetime.now() user = cls(username=username, email=email, created_at=now, **kwargs) user.set_password(password) user.save() return user @classmethod def get_by_id(cls, id): user = cls.objects.with_id(id) if user: return user else: return None def set_password(self, password): self.password = bcrypt.generate_password_hash(password) def check_password(self, value): return bcrypt.check_password_hash(self.password, value) @property def full_name(self): return "{0} {1}".format(self.first_name, self.last_name) def __repr__(self): return '<User({username!r})>'.format(username=self.username)
class RasmInstruction(db.Document): name = db.StringField(primary_key=True) words = db.ListField(required=True) meta = { "allow_inheritance": True, "indexes": ['words'], } def foreach(self, re, entities): for ent in entities: if ent in IGNORE_LIST: continue #FIXME: handle this intelligently! try: for ing in re.pointers[ent]: yield ent, ing except KeyError: if not GREEDY: raise
class RecipeMeta(db.Document): spr = db.ReferenceField('SyntaxParsedRecipe', reverse_delete_rule=db.CASCADE, required=True) sblob = db.StringField()
class WiktionaryWordType(db.Document): word = db.StringField(required=True, primary_key=True) type = db.StringField()