Skip to content

Commit

Permalink
Fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
alisaifee committed Feb 3, 2024
1 parent 6f1f563 commit 54e11c2
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 19 deletions.
1 change: 1 addition & 0 deletions flask_limiter/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Flask-Limiter extension for rate limiting."""

from . import _version
from .constants import ExemptionScope, HeaderNames
from .errors import RateLimitExceeded
Expand Down
12 changes: 7 additions & 5 deletions flask_limiter/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,14 @@ def render_limits(
"blueprint"
if blueprint
and limit in limiter.limit_manager.blueprint_limits(app, blueprint)
else "route"
if limit
in limiter.limit_manager.decorated_limits(
get_qualified_name(view_func) if view_func else ""
else (
"route"
if limit
in limiter.limit_manager.decorated_limits(
get_qualified_name(view_func) if view_func else ""
)
else "default"
)
else "default"
)
else:
source = "default"
Expand Down
19 changes: 7 additions & 12 deletions flask_limiter/extension.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Flask-Limiter Extension
"""

from __future__ import annotations

import dataclasses
Expand Down Expand Up @@ -651,17 +652,15 @@ def exempt(
obj: flask.Blueprint,
*,
flags: ExemptionScope = ExemptionScope.APPLICATION | ExemptionScope.DEFAULT,
) -> flask.Blueprint:
...
) -> flask.Blueprint: ...

@overload
def exempt(
self,
obj: Callable[..., R],
*,
flags: ExemptionScope = ExemptionScope.APPLICATION | ExemptionScope.DEFAULT,
) -> Callable[..., R]:
...
) -> Callable[..., R]: ...

@overload
def exempt(
Expand All @@ -671,8 +670,7 @@ def exempt(
) -> Union[
Callable[[Callable[P, R]], Callable[P, R]],
Callable[[flask.Blueprint], flask.Blueprint],
]:
...
]: ...

def exempt(
self,
Expand Down Expand Up @@ -1252,16 +1250,13 @@ def __exit__(
exc_type: Optional[Type[BaseException]],
exc_value: Optional[BaseException],
traceback: Optional[TracebackType],
) -> None:
...
) -> None: ...

@overload
def __call__(self, obj: Callable[P, R]) -> Callable[P, R]:
...
def __call__(self, obj: Callable[P, R]) -> Callable[P, R]: ...

@overload
def __call__(self, obj: flask.Blueprint) -> None:
...
def __call__(self, obj: flask.Blueprint) -> None: ...

def __call__(
self, obj: Union[Callable[P, R], flask.Blueprint]
Expand Down
3 changes: 1 addition & 2 deletions tests/test_decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -705,8 +705,7 @@ def default_on_breach_with_response(request_limit):
f"default custom response {request_limit.limit} @ {request.path}", 429
)

def on_breach_invalid():
...
def on_breach_invalid(): ...

def on_breach_fail(request_limit):
1 / 0
Expand Down
1 change: 1 addition & 0 deletions tests/test_flask_ext.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
"""

import logging
import time
from collections import Counter
Expand Down
1 change: 1 addition & 0 deletions tests/test_regressions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
"""

import time

import hiro
Expand Down

0 comments on commit 54e11c2

Please sign in to comment.