diff --git a/proxylist/metrics.py b/proxylist/metrics.py index b0c29a4..6d1a045 100644 --- a/proxylist/metrics.py +++ b/proxylist/metrics.py @@ -18,5 +18,5 @@ def collect(self): ) -def register_metrics(): +def register_metrics() -> None: REGISTRY.register(CustomCollector()) diff --git a/proxylist/models.py b/proxylist/models.py index ad4b2f3..706573b 100644 --- a/proxylist/models.py +++ b/proxylist/models.py @@ -13,7 +13,7 @@ from proxylist.proxy import update_proxy_status, get_proxy_location -def validate_sip002(value): +def validate_sip002(value) -> None: if get_sip002(value) == "": raise ValidationError( "The value entered is not SIP002 compatible", @@ -21,7 +21,7 @@ def validate_sip002(value): ) -def validate_not_existing(value): +def validate_not_existing(value) -> None: if Proxy.objects.filter(url=get_sip002(value)): raise ValidationError( "This proxy was already imported", @@ -29,7 +29,7 @@ def validate_not_existing(value): ) -def validate_proxy_can_connect(value): +def validate_proxy_can_connect(value) -> None: location = get_proxy_location(get_sip002(value)) if location is None or location == "unknown": raise ValidationError( @@ -38,7 +38,7 @@ def validate_proxy_can_connect(value): ) -def proxy_validator(value): +def proxy_validator(value) -> None: validate_sip002(value) validate_not_existing(value) validate_proxy_can_connect(value) @@ -118,7 +118,7 @@ def update_url_and_location_after_save(sender, instance, created, **kwargs): @receiver(post_save, sender=Proxy) -def clear_cache(sender, instance, **kwargs): +def clear_cache(sender, instance, **kwargs) -> None: cache.clear() diff --git a/proxylist/proxy.py b/proxylist/proxy.py index ec5f70d..9e4b370 100644 --- a/proxylist/proxy.py +++ b/proxylist/proxy.py @@ -20,7 +20,7 @@ def get_proxy_location(proxy_url): return output -def update_proxy_status(proxy): +def update_proxy_status(proxy) -> None: ip_information = get_proxy_location(proxy_url=proxy.url) if ip_information: diff --git a/proxylist/tasks.py b/proxylist/tasks.py index 2265395..f733ee1 100644 --- a/proxylist/tasks.py +++ b/proxylist/tasks.py @@ -23,21 +23,21 @@ @db_periodic_task(crontab(minute="15", hour="10")) -def remove_low_quality_proxies_scheduled(): +def remove_low_quality_proxies_scheduled() -> None: remove_low_quality_proxies() @db_periodic_task(crontab(minute="*/20")) -def update_status_scheduled(): +def update_status_scheduled() -> None: update_status() @db_periodic_task(crontab(minute="0")) -def poll_subscriptions_scheduled(): +def poll_subscriptions_scheduled() -> None: poll_subscriptions() -def remove_low_quality_proxies(): +def remove_low_quality_proxies() -> None: log.info( "Removing low quality proxies", extra={"task": inspect.currentframe().f_back.f_code.co_name}, @@ -129,7 +129,7 @@ def decode_line(line): ) -def poll_subscriptions(): +def poll_subscriptions() -> None: log.info( "Started polling subscriptions", extra={"task": inspect.currentframe().f_code.co_name}, @@ -282,7 +282,7 @@ def process_line(line, all_urls): return proxy -def flatten(something): +def flatten(something) -> None: if isinstance(something, (list, tuple, set, range)): for sub in something: yield from flatten(sub)