<commit_before>#!/usr/bin/env python

import datetime
from google.appengine.ext import db

class PollEvent(db.Model):
  host       = db.StringProperty(required=True)
  port       = db.IntegerProperty(required=True)
  poll_type  = db.StringProperty(default='http', choices=set(['raw', 'http']))

class EmailAction(db.Model):
  address    = db.EmailProperty(required=True)
  enabled    = db.BooleanProperty(required=True, default=False)
  message    = db.StringProperty()

class WebrequestAction(db.Model):
  url        = db.LinkProperty(required=True)
  enabled    = db.BooleanProperty(required=True, default=False)
  message    = db.StringProperty()

class IMAction(db.Model):
  im         = db.IMProperty(required=True)
  enabled    = db.BooleanProperty(required=True, default=False)
  message    = db.StringProperty()


class WatchJob(db.Model):
  name       = db.StringProperty(required=True)
  watch_type = db.StringProperty(required=True, default='push', choices=set(['push', 'poll']))
  enabled    = db.BooleanProperty(required=True, default=False)
  interval   = db.IntegerProperty(required=True)
  created    = db.DateTimeProperty(required=True, auto_now_add=True)
  secret     = db.StringProperty()
  last_fail  = db.DateTimeProperty()
  lastseen   = db.DateTimeProperty()
  actions    = db.ListProperty(db.Key)
  poll       = db.ReferenceProperty(PollEvent)<commit_msg>Datamodel<commit_after>#!/usr/bin/env python

import datetime
import os, hashlib
from google.appengine.ext import db

class PollEvent(db.Model):
  host       = db.StringProperty(required=True)
  port       = db.IntegerProperty(required=True)
  poll_type  = db.StringProperty(default='http', choices=set(['raw', 'http']))

class EmailAction(db.Model):
  enabled    = db.BooleanProperty(required=True, default=False)
  address    = db.EmailProperty(required=True)
  message    = db.StringProperty()

class WebrequestAction(db.Model):
  enabled    = db.BooleanProperty(required=True, default=False)
  url        = db.LinkProperty(required=True)
  message    = db.StringProperty()

class IMAction(db.Model):
  enabled    = db.BooleanProperty(required=True, default=False)
  im         = db.IMProperty(required=True)
  message    = db.StringProperty()


class WatchJob(db.Model):
  name       = db.StringProperty(required=True)
  watch_type = db.StringProperty(required=True, default='push', choices=set(['push', 'poll']))
  enabled    = db.BooleanProperty(required=True, default=False)
  interval   = db.IntegerProperty(required=True)
  created    = db.DateTimeProperty(required=True, auto_now_add=True)
  secret     = db.StringProperty()
  last_fail  = db.DateTimeProperty()
  lastseen   = db.DateTimeProperty()
  actions    = db.ListProperty(db.Key)
  poll       = db.ReferenceProperty(PollEvent)

  def generateSecret(self):
    self.secret = hashlib.sha1(os.urandom(1024)).hexdigest()
{'fraction_non_alphanumeric': 0.12469437652811736, 'fraction_numerical': 0.0017464198393293748, 'mean_word_length': 4.383458646616542, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6468548', 'n_tokens_mistral': 885, 'n_tokens_neox': 873, 'n_words': 150}