analytics: Remove inheritance from object.

This commit is contained in:
rht 2017-11-05 11:30:44 +01:00 committed by showell
parent 7a6e0dda41
commit 5cfffb0e51
2 changed files with 7 additions and 7 deletions

View File

@ -26,7 +26,7 @@ TIMEDELTA_MAX = timedelta(days=365*1000)
## Class definitions ##
class CountStat(object):
class CountStat:
HOUR = 'hour'
DAY = 'day'
FREQUENCIES = frozenset([HOUR, DAY])
@ -61,7 +61,7 @@ class DependentCountStat(CountStat):
CountStat.__init__(self, property, data_collector, frequency, interval=interval)
self.dependencies = dependencies
class DataCollector(object):
class DataCollector:
def __init__(self, output_table, pull_function):
# type: (Type[BaseCount], Optional[Callable[[str, datetime, datetime], int]]) -> None
self.output_table = output_table

View File

@ -56,12 +56,12 @@ class BaseCount(models.Model):
value = models.BigIntegerField() # type: int
anomaly = models.ForeignKey(Anomaly, null=True) # type: Optional[Anomaly]
class Meta(object):
class Meta:
abstract = True
class InstallationCount(BaseCount):
class Meta(object):
class Meta:
unique_together = ("property", "subgroup", "end_time")
def __str__(self):
@ -71,7 +71,7 @@ class InstallationCount(BaseCount):
class RealmCount(BaseCount):
realm = models.ForeignKey(Realm)
class Meta(object):
class Meta:
unique_together = ("realm", "property", "subgroup", "end_time")
index_together = ["property", "end_time"]
@ -83,7 +83,7 @@ class UserCount(BaseCount):
user = models.ForeignKey(UserProfile)
realm = models.ForeignKey(Realm)
class Meta(object):
class Meta:
unique_together = ("user", "property", "subgroup", "end_time")
# This index dramatically improves the performance of
# aggregating from users to realms
@ -97,7 +97,7 @@ class StreamCount(BaseCount):
stream = models.ForeignKey(Stream)
realm = models.ForeignKey(Realm)
class Meta(object):
class Meta:
unique_together = ("stream", "property", "subgroup", "end_time")
# This index dramatically improves the performance of
# aggregating from streams to realms