Exemple #1
0
class PhotometricCalibration(ZeropointEntry):

    zperr = sqlobject.FloatCol()
    colorterm = sqlobject.FloatCol()
    colorerr = sqlobject.FloatCol(default=0.)
    fixedcolor = sqlobject.BoolCol(default=True)

    table_name = 'photometric_calibration'
Exemple #2
0
class PythonScore(sqlobject.SQLObject):
    """
    OO mapping of the score for a Python file
    """
    username = sqlobject.StringCol()
    pathname = sqlobject.StringCol()
    revision = sqlobject.StringCol()
    score = sqlobject.FloatCol()
    old_score = sqlobject.FloatCol()
    credit = sqlobject.FloatCol()
    date = sqlobject.DateTimeCol(default=sqlobject.DateTimeCol.now)
Exemple #3
0
class Movie(sqlobject.SQLObject):
    """Class voor het databaseobject movie"""
    _connection = conn
    ft_link = sqlobject.StringCol()
    ft_title = sqlobject.StringCol()
    ft_year = sqlobject.StringCol()
    ft_director = sqlobject.StringCol()
    ft_cast = sqlobject.StringCol()
    ft_genre = sqlobject.StringCol()
    ft_country = sqlobject.StringCol()
    ft_cover_img = sqlobject.StringCol()
    ft_tagline = sqlobject.StringCol()
    ft_length = sqlobject.StringCol()
    ft_synopsis = sqlobject.StringCol()
    ft_rating = sqlobject.FloatCol()
    ft_votes = sqlobject.IntCol()
    imdb_id = sqlobject.StringCol(unique=True)
    imdb_rating = sqlobject.FloatCol()
    imdb_votes = sqlobject.IntCol()
    ft_movietip = sqlobject.StringCol()
class User(sqlobject.SQLObject):
    _connection = establish_connection()
    userName = sqlobject.StringCol(length=100, unique=False)
    age = sqlobject.IntCol(default=None)
    height = sqlobject.IntCol(default=None)
    weight = sqlobject.IntCol(default=None)
    gender = sqlobject.StringCol(length=6)
    activity = sqlobject.FloatCol(default=None)

    def __repr__(self):
        return "name: {}\nage: {}\nheight: {}\nweight: {}\ngender: {}\nactv: {}".format(self.userName,\
                  self.age, self.height, self.weight, self.gender, self.activity)
Exemple #5
0
class FileMeta(sqlobject.SQLObject, File):
    """
    store rating metadata about a file, create thumbnails, and more!
    """

    class sqlmeta:
        lazyUpdate = True  # must call #syncUpdate or #sync to save changes

    MOCK = False

    absolute =    sqlobject.StringCol(notNone=True, unique=True,
                                      alternateID=True)
    hits =        sqlobject.IntCol(notNone=True, default=0)
    rating =      sqlobject.FloatCol(notNone=True, default=0.0)
    rating_hits = sqlobject.IntCol(notNone=True, default=0)

    def rate(self, rating):
        """
        store an incoming rating value, out of 10
        would rate/10
        """
        # no crazy bznz
        if rating > 10 or rating < 0:
            raise ValueError('Rating value out of bounds [0 - 10]')
            return self.rating

        so_far = self.rating * self.ratingHits
        now = (so_far + rating) / (self.rating_hits + 1)
        self.rating = now
        self.ratingHits = self.rating_hits + 1
        self.syncUpdate()
        return now

    def hit(self):
        self.hits += 1
        self.syncUpdate()
        return self.hits

    @classmethod
    def for_path(cls, absolute, root=None):
        """get or create for this path"""

        if cls.MOCK:
            return MockFileMeta(absolute=absolute, hits=0, rating=5.5, rating_hits=100)

        try:
            instance = cls.byAbsolute(absolute)
        except sqlobject.SQLObjectNotFound:
            instance = cls(absolute=absolute)
            instance.syncUpdate()
        instance.root = root
        return instance
Exemple #6
0
class ZeropointEntry(sqlobject.inheritance.InheritableSQLObject):

    user = sqlobject.StringCol()
    time = sqlobject.DateTimeCol()
    cluster = sqlobject.StringCol()
    filter = sqlobject.StringCol()
    zp = sqlobject.FloatCol()
    mangledSpecification = sqlobject.StringCol()

    def _get_specification(self):
        return unmangleSpecification(self.mangledSpecification)

    def _set_specification(self, **specification):
        self.mangledSpecification = mangleSpecification(specification)
Exemple #7
0
class CswConfig(sqlobject.SQLObject):
  option_key = sqlobject.UnicodeCol(length=255, unique=True)
  float_value = sqlobject.FloatCol(default=None)
  int_value = sqlobject.IntCol(default=None)
  str_value = sqlobject.UnicodeCol(default=None, length=250)
Exemple #8
0
class SlrZP(ZeropointEntry):

    fitFilter = sqlobject.StringCol()
    zperr = sqlobject.FloatCol()
Exemple #9
0
class Table_Archive(sqlobject.SQLObject):
    date = sqlobject.DateTimeCol()
    In_Temp = sqlobject.FloatCol()
    Out_Temp = sqlobject.FloatCol()
    Attic_Temp = sqlobject.FloatCol()
    In_Humid = sqlobject.FloatCol()
    Out_Humid = sqlobject.FloatCol()
    Attic_Humid = sqlobject.FloatCol()
    Out_Wind_Avg = sqlobject.FloatCol()
    Out_Wind_Max = sqlobject.FloatCol()
    Out_Rain_Minute = sqlobject.FloatCol()
    System_CPU = sqlobject.FloatCol()
    System_RAM = sqlobject.FloatCol()
    Now_Feel = sqlobject.FloatCol()
Exemple #10
0
class Table_Rain(sqlobject.SQLObject):
    time = sqlobject.DateTimeCol()
    quantity = sqlobject.FloatCol()