Less implicit behavior, add type hints as documentation..

parent ac56aa45
......@@ -11,6 +11,7 @@
- model: django_celery_beat.periodictask
pk: 2
fields: {name: scan-security-headers, task: failmap_admin.scanners.scanner_security_headers.scan,
interval: 1, crontab: null, args: '[]', kwargs: '{}', queue: null, exchange: null,
routing_key: null, expires: null, enabled: true, last_run_at: null, total_run_count: 0,
date_changed: !!timestamp '2017-10-30 21:36:15.027577+00:00', description: ''}
interval: 1, crontab: null, solar: null, args: '[[]]', kwargs: '{}', queue: null,
exchange: null, routing_key: null, expires: null, enabled: true, last_run_at: ! '2017-10-31
15:10:41+00:00', total_run_count: 38, date_changed: ! '2017-10-31 15:11:21+00:00',
description: ''}
......@@ -6,6 +6,7 @@ import logging
import random
import time
from datetime import datetime
from typing import List
import celery
import pytz
......@@ -24,7 +25,7 @@ from .models import Endpoint
logger = logging.getLogger(__name__)
def organizations_from_names(organization_names):
def organizations_from_names(organization_names: List[str]) -> List[Organization]:
"""Turn list of organization names into list of Organization objects.
Will return all organizations if none are specified.
......@@ -44,7 +45,7 @@ def organizations_from_names(organization_names):
@app.task
def scan(organization_names=None, execute=True):
def scan(organization_names: List[str], execute=True):
"""Compose and execute taskset to scan specified organizations."""
task = compose(organizations_from_names(organization_names))
if execute:
......@@ -53,7 +54,7 @@ def scan(organization_names=None, execute=True):
return task
def compose(organizations):
def compose(organizations: List[Organization]):
"""Compose taskset to scan specified organizations."""
# collect all scannable urls for provided organizations
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment