Module Import alias Import alias Import alias ImportFrom alias ClassDef bases NameLoad body Pass decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam defaults Num Num NameLoad body Expr Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str If AttributeLoad NameLoad attr body Return NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr BinOpAdd BinOpAdd AttributeLoad NameLoad attr Str NameLoad Assign NameStore Call NameLoad NameLoad Assign NameStore NameLoad If CompareLt NameLoad AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Call NameLoad Call AttributeLoad NameLoad attr orelse Assign NameStore Call NameLoad SubscriptLoad NameLoad Index Num If CompareLt BinOpSub Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr body Assign NameStore NameLoad orelse Expr Call AttributeLoad NameLoad attr Call NameLoad Call AttributeLoad NameLoad attr Delete SubscriptDel NameLoad Slice AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call NameLoad BinOpMult AttributeLoad NameLoad attr Num Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str If CompareIs NameLoad NameLoad body FunctionDef arguments args defaults vararg kwarg body Assign NameStore Call AttributeLoad NameLoad attr TupleLoad NameLoad Call NameLoad Call AttributeLoad NameLoad attr Return Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body FunctionDef arguments args defaults vararg kwarg body Assign NameStore Call NameLoad NameLoad NameLoad If Call AttributeLoad NameLoad attr NameLoad body Raise Call NameLoad BinOpMod Str TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Return Call NameLoad NameLoad NameLoad decorator_list Call NameLoad NameLoad Return NameLoad decorator_list Return NameLoad decorator_list decorator_list
N/A N/A hashlib N/A pickle N/A time functools wraps RateLimitException N/A Exception N/A N/A N/A RateLimit N/A object N/A N/A 
    Rate limit implementation. Allows up to `number` of events every `per`
    seconds.
     __init__ N/A N/A self database name limit per debug N/A 5 60 False N/A N/A 
        :param database: :py:class:`Database` instance.
        :param name: Namespace for this cache.
        :param int limit: Number of events allowed during a given time period.
        :param int per: Time period the ``limit` applies to, in seconds.
        :param debug: Disable rate-limit for debugging purposes. All events
                      will appear to be allowed and valid.
         N/A N/A self database database N/A N/A self name name N/A N/A self _limit limit N/A N/A self _per per N/A N/A self _debug debug N/A limit N/A N/A self key N/A N/A N/A 
        Function to log an event with the given key. If the ``key`` has not
        exceeded their alotted events, then the function returns ``False`` to
        indicate that no limit is being imposed.

        If the ``key`` has exceeded the number of events, then the function
        returns ``True`` indicating rate-limiting should occur.

        :param str key: A key identifying the source of the event.
        :returns: Boolean indicating whether the event should be rate-limited
            or not.
         N/A N/A self _debug N/A N/A False N/A counter N/A N/A N/A self database List N/A N/A N/A self name : key N/A n N/A len counter N/A is_limited False N/A N/A n N/A self _limit N/A N/A N/A N/A counter prepend N/A str N/A N/A time time N/A N/A oldest N/A float N/A counter N/A -1 N/A N/A N/A N/A N/A time time oldest N/A self _per N/A N/A is_limited True N/A N/A N/A N/A counter prepend N/A str N/A N/A time time N/A N/A counter N/A N/A self _limit N/A N/A N/A counter pexpire N/A int N/A N/A self _per 2000 N/A is_limited N/A rate_limited N/A N/A self key_function N/A None N/A N/A 
        Function or method decorator that will prevent calls to the decorated
        function when the number of events has been exceeded for the given
        time period.

        It is probably important that you take care to choose an appropiate
        key function. For instance, if rate-limiting a web-page you might use
        the requesting user's IP as the key.

        If the number of allowed events has been exceedd, a
        ``RateLimitException`` will be raised.

        :param key_function: Function that accepts the params of the decorated
            function and returns a string key. If not provided, a hash of the
            args and kwargs will be used.
        :returns: If the call is not rate-limited, then the return value will
            be that of the decorated function.
        :raises: ``RateLimitException``.
         N/A N/A key_function None N/A key_function N/A N/A N/A args kwargs N/A N/A data N/A N/A pickle dumps N/A args N/A sorted N/A N/A kwargs items N/A N/A N/A N/A N/A hashlib md5 data hexdigest N/A decorator N/A N/A fn N/A N/A inner N/A N/A N/A args kwargs N/A N/A key N/A key_function args kwargs N/A N/A N/A self limit key N/A N/A N/A RateLimitException N/A Call to %s exceeded %s events in %s seconds. N/A N/A fn __name__ N/A self _limit N/A self _per N/A N/A fn args kwargs N/A N/A wraps fn N/A inner N/A N/A decorator N/A N/A