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,16 +19,19 @@ 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)
has_yesterday_actions = (RepositoryActionCount
.select(RepositoryActionCount.repository)
.where(RepositoryActionCount.date == yesterday))
to_count = (Repository.select()
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()
actions = (LogEntry
.select()
.where(LogEntry.repository == to_count,
LogEntry.datetime >= yesterday,
LogEntry.datetime < today)

View file

@ -8,12 +8,15 @@ from app import secscan_notification_queue, secscan_api
from workers.queueworker import QueueWorker, JobException
from util.secscan.notifier import process_notification_data
logger = logging.getLogger(__name__)
_READING_SECONDS = 120 # 2 minutes
_PROCESSING_SECONDS = 60 * 60 # 1 hour
_LAYER_LIMIT = 100 # The number of layers to request on each page.
class SecurityNotificationWorker(QueueWorker):
def process_queue_item(self, data):
self.perform_notification_work(data)

View file

@ -1,8 +1,8 @@
import logging
import logging.config
import time
import features
import time
from peewee import fn