Skip to content

Commit

Permalink
refactor: float matches integers too
Browse files Browse the repository at this point in the history
  • Loading branch information
Dorukyum authored Jan 6, 2024
1 parent 1b57349 commit 7da74a6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions discord/rate_limiting.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class GlobalRateLimit:
----------
concurrency: :class:`int`
The concurrency to reset every `per` seconds.
per: :class:`int` | :class:`float`
per: :class:`float`
Number of seconds to wait until resetting `concurrency`.
remaining: :class:`int`
Number of available requests remaining. If the value of remaining
Expand All @@ -57,21 +57,21 @@ class GlobalRateLimit:
The current concurrency.
pending_reset: :class:`bool`
The class is pending a reset of `concurrency`.
reset_at :class:`int` | :class:`float` | `None`
reset_at Optional[:class:`float`]
Unix timestamp of when this class will next reset.
"""

def __init__(
self, concurrency: int, per: float | int, remaining: int = MISSING
self, concurrency: int, per: float, remaining: int = MISSING
) -> None:
self.concurrency: int = concurrency
self.per: float | int = per
self.per: float = per

self.current: int = self.concurrency
self._processing: list[asyncio.Future] = []
self.loop: asyncio.AbstractEventLoop | None = None
self.pending_reset: bool = False
self.reset_at: int | float | None = None
self.reset_at: float | None = None

if remaining is not MISSING:
raise ValueError(
Expand Down

0 comments on commit 7da74a6

Please sign in to comment.