Fix type hints for redis TTL params (#922)

* Allow to use `int` and `datetime.timedelta`

* Fix imports

* Added changelog

* Update CHANGES
This commit is contained in:
Andrew 2022-06-16 21:43:32 +03:00 committed by GitHub
parent b3b320c106
commit adfc89f125
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

1
CHANGES/922.feature.rst Normal file
View file

@ -0,0 +1 @@
Fixed type hints for redis TTL params.

View file

@ -5,6 +5,7 @@ from typing import Any, AsyncGenerator, Dict, Literal, Optional, cast
from redis.asyncio.client import Redis
from redis.asyncio.connection import ConnectionPool
from redis.asyncio.lock import Lock
from redis.typing import ExpiryT
from aiogram import Bot
from aiogram.dispatcher.fsm.state import State
@ -90,8 +91,8 @@ class RedisStorage(BaseStorage):
self,
redis: Redis,
key_builder: Optional[KeyBuilder] = None,
state_ttl: Optional[int] = None,
data_ttl: Optional[int] = None,
state_ttl: Optional[ExpiryT] = None,
data_ttl: Optional[ExpiryT] = None,
lock_kwargs: Optional[Dict[str, Any]] = None,
) -> None:
"""