Skip to content

Commit

Permalink
[Codegen] 🔧 Add None Return Type Annotations (Excluding Main)
Browse files Browse the repository at this point in the history
  • Loading branch information
codegen-bot committed Aug 5, 2024
1 parent 9b66faf commit 6553acc
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion proxylist/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ def collect(self):
)


def register_metrics():
def register_metrics() -> None:
REGISTRY.register(CustomCollector())
10 changes: 5 additions & 5 deletions proxylist/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@
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",
params={"value": 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",
params={"value": 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(
Expand All @@ -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)
Expand Down Expand Up @@ -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()


Expand Down
2 changes: 1 addition & 1 deletion proxylist/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 6 additions & 6 deletions proxylist/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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},
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 6553acc

Please sign in to comment.