mypy: Enable new error explicit-override.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2023-10-12 10:43:45 -07:00
committed by Anders Kaseorg
parent d257002ad8
commit a50eb2e809
223 changed files with 936 additions and 18 deletions

View File

@@ -5,6 +5,7 @@ from typing import Any, Callable, Optional
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError, CommandParser
from returns.curry import partial
from typing_extensions import override
from zerver.lib.rate_limiter import RateLimitedUser, client
from zerver.models import get_user_profile_by_id
@@ -16,6 +17,7 @@ class Command(BaseCommand):
Usage: ./manage.py [--trim] check_redis"""
@override
def add_arguments(self, parser: CommandParser) -> None:
parser.add_argument("-t", "--trim", action="store_true", help="Actually trim excess")
@@ -46,6 +48,7 @@ than max_api_calls! (trying to trim) %s %s",
client.expire(key, entity.max_api_window())
trim_func(key, max_calls)
@override
def handle(self, *args: Any, **options: Any) -> None:
if not settings.RATE_LIMITING:
raise CommandError("This machine is not using Redis or rate limiting, aborting")