Skip to content

Commit

Permalink
Removed silly type hint
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethlove committed Jan 19, 2024
1 parent a5c92b1 commit e820e5e
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/brackets/mixins/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from typing import TYPE_CHECKING, Any, Optional, TypeAlias

from django.http import HttpRequest, HttpResponse
from django.views.generic import View
from django.views.decorators.cache import cache_control, never_cache

from brackets.exceptions import BracketsConfigurationError
Expand All @@ -17,8 +18,6 @@

A: TypeAlias = tuple[Any]
K: TypeAlias = dict[str, Any]
_View: TypeAlias = tuple[HttpRequest, tuple[Any], dict[str, Any]]


class AllVerbsMixin:
"""Handle all HTTP verbs with a single method."""
Expand Down Expand Up @@ -109,17 +108,17 @@ def get_cache_control_options(
return options

@classmethod
def as_view(cls: type["CacheControlMixin"], **initkwargs: dict[str, Any]) -> _View:
def as_view(cls: type["CacheControlMixin"], **initkwargs: dict[str, Any]) -> View:
"""Add cache control to the view."""
view: Callable[[_View], HttpResponse] = super().as_view(**initkwargs)
view: Callable[[View], HttpResponse] = super().as_view(**initkwargs)
return cache_control(**cls.get_cache_control_options())(view)


class NeverCacheMixin:
"""Prevents a view from being cached."""

@classmethod
def as_view(cls: type["NeverCacheMixin"], **initkwargs: dict[str, Any]) -> _View:
def as_view(cls: type["NeverCacheMixin"], **initkwargs: dict[str, Any]) -> View:
"""Wrap the view with never_cache."""
view: Callable[[_View], HttpResponse] = super().as_view(**initkwargs)
view: Callable[[View], HttpResponse] = super().as_view(**initkwargs)
return never_cache(view)

0 comments on commit e820e5e

Please sign in to comment.