Skip to content

Commit

Permalink
Use Annotated & pydantic.fields.Field insted of conint
Browse files Browse the repository at this point in the history
  • Loading branch information
tkrtmy committed Dec 24, 2023
1 parent 2d65fd1 commit e385ba4
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions fastapi_limiter/depends.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Callable, Optional
from typing import Annotated, Callable, Optional

from pydantic import conint
from pydantic import Field
from starlette.requests import Request
from starlette.responses import Response
from starlette.websockets import WebSocket
Expand All @@ -12,11 +12,11 @@
class RateLimiter:
def __init__(
self,
times: conint(ge=0) = 1,
milliseconds: conint(ge=-1) = 0,
seconds: conint(ge=-1) = 0,
minutes: conint(ge=-1) = 0,
hours: conint(ge=-1) = 0,
times: Annotated[int, Field(ge=0)] = 1,
milliseconds: Annotated[int, Field(ge=-1)] = 0,
seconds: Annotated[int, Field(ge=-1)] = 0,
minutes: Annotated[int, Field(ge=-1)] = 0,
hours: Annotated[int, Field(ge=-1)] = 0,
identifier: Optional[Callable] = None,
callback: Optional[Callable] = None,
):
Expand Down

0 comments on commit e385ba4

Please sign in to comment.