vutran1710 / PyrateLimiter

⚔️Python Rate-Limiter using Leaky-Bucket Algorithm Family
https://pyratelimiter.readthedocs.io
MIT License
338 stars 36 forks source link

Incorrect type hint for "bucket_class" in "Limiter" #30

Closed ryanzlu closed 3 years ago

ryanzlu commented 3 years ago

The bucket_class in Limiter requires a type as input instead of an object instance of type AbstractBucket.

Current:

class Limiter:
    def __init__(
        self,
        *rates: RequestRate,
        bucket_class: AbstractBucket = MemoryQueueBucket,
        bucket_kwargs=None,
    ):

Should change to:

from typing import Dict, Union, Type

class Limiter:
    def __init__(
        self,
        *rates: RequestRate,
        bucket_class: Type[AbstractBucket] = MemoryQueueBucket,
        bucket_kwargs=None,
    ):
vutran1710 commented 3 years ago

Interesting! Thanks for pointing it out! Will be fixed soon.

vutran1710 commented 3 years ago

solved in 2.3.2