diff options
author | Dan McGee <dan@archlinux.org> | 2015-02-26 19:36:49 -0600 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2015-02-26 19:36:49 -0600 |
commit | cd69fd8aee59e09e2b6f01ad63ad7ac0c5c3cd16 (patch) | |
tree | 3e178849016c5d2c44b9747e71591b28268cf2f8 | |
parent | 17b6ce186c6e793417c73e955bfc01b4f4b96864 (diff) |
Pylint suggested cleanups
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r-- | mirrors/management/commands/mirrorcheck.py | 2 | ||||
-rw-r--r-- | mirrors/utils.py | 9 |
2 files changed, 5 insertions, 6 deletions
diff --git a/mirrors/management/commands/mirrorcheck.py b/mirrors/management/commands/mirrorcheck.py index 8c17c78f..1f16a375 100644 --- a/mirrors/management/commands/mirrorcheck.py +++ b/mirrors/management/commands/mirrorcheck.py @@ -238,7 +238,7 @@ class MirrorCheckPool(object): for url in list(urls): self.tasks.put(url) self.threads = [] - for i in range(num_threads): + for _ in range(num_threads): thread = Thread(target=mirror_url_worker, args=(self.tasks, self.logs, location, timeout)) thread.daemon = True diff --git a/mirrors/utils.py b/mirrors/utils.py index 533cd452..7c2f5d17 100644 --- a/mirrors/utils.py +++ b/mirrors/utils.py @@ -4,7 +4,6 @@ from django.db import connection from django.db.models import Count, Max, Min from django.utils.dateparse import parse_datetime from django.utils.timezone import now -from django_countries.fields import Country from main.utils import cache_function, database_vendor from .models import MirrorLog, MirrorUrl @@ -184,12 +183,12 @@ def get_mirror_url_for_download(cutoff=DEFAULT_CUTOFF): status data available, it is used to determine a good choice by looking at the last batch of status rows.''' cutoff_time = now() - cutoff - status_data = MirrorLog.objects.filter( + log_data = MirrorLog.objects.filter( check_time__gte=cutoff_time).aggregate( Max('check_time'), Max('last_sync')) - if status_data['check_time__max'] is not None: - min_check_time = status_data['check_time__max'] - timedelta(minutes=5) - min_sync_time = status_data['last_sync__max'] - timedelta(minutes=20) + if log_data['check_time__max'] is not None: + min_check_time = log_data['check_time__max'] - timedelta(minutes=5) + min_sync_time = log_data['last_sync__max'] - timedelta(minutes=20) best_logs = MirrorLog.objects.select_related('url').filter( is_success=True, check_time__gte=min_check_time, last_sync__gte=min_sync_time, |