pylint formatting

This commit is contained in:
Jimmy Zelinskie 2016-10-28 17:11:54 -04:00
parent a30b358709
commit 8b9f9478a4
3 changed files with 20 additions and 13 deletions

View file

@ -1,8 +1,9 @@
import logging
from app import app
from data.database import Repository, LogEntry, RepositoryActionCount, db_random_func
from datetime import date, timedelta
from app import app # This is required to initialize the database.
from data.database import Repository, LogEntry, RepositoryActionCount, db_random_func
from workers.worker import Worker
POLL_PERIOD_SECONDS = 10
@ -18,20 +19,23 @@ def count_repository_actions():
# Get a random repository to count.
today = date.today()
yesterday = today - timedelta(days=1)
has_yesterday_actions = (RepositoryActionCount.select(RepositoryActionCount.repository)
.where(RepositoryActionCount.date == yesterday))
has_yesterday_actions = (RepositoryActionCount
.select(RepositoryActionCount.repository)
.where(RepositoryActionCount.date == yesterday))
to_count = (Repository.select()
.where(~(Repository.id << (has_yesterday_actions)))
.order_by(db_random_func()).get())
to_count = (Repository
.select()
.where(~(Repository.id << (has_yesterday_actions)))
.order_by(db_random_func()).get())
logger.debug('Counting: %s', to_count.id)
actions = (LogEntry.select()
.where(LogEntry.repository == to_count,
LogEntry.datetime >= yesterday,
LogEntry.datetime < today)
.count())
actions = (LogEntry
.select()
.where(LogEntry.repository == to_count,
LogEntry.datetime >= yesterday,
LogEntry.datetime < today)
.count())
# Create the row.
try: