mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Refactoring while review
This commit is contained in:
parent
90949596a0
commit
5a2cb9704b
2 changed files with 6 additions and 4 deletions
|
|
@ -72,11 +72,11 @@ class DefaultKeyBuilder(KeyBuilder):
|
|||
if self.with_destiny:
|
||||
parts.append(key.destiny)
|
||||
elif key.destiny != DEFAULT_DESTINY:
|
||||
raise ValueError(
|
||||
error_message = (
|
||||
"Default key builder is not configured to use key destiny other than the default."
|
||||
"\n\n"
|
||||
"Probably, you should set `with_destiny=True` in for DefaultKeyBuilder."
|
||||
"\n\nProbably, you should set `with_destiny=True` in for DefaultKeyBuilder."
|
||||
)
|
||||
raise ValueError(error_message)
|
||||
parts.append(part)
|
||||
return self.separator.join(parts)
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class MongoStorage(BaseStorage):
|
|||
|
||||
@classmethod
|
||||
def from_url(
|
||||
cls, url: str, connection_kwargs: Dict[str, Any] = {}, **kwargs: Any
|
||||
cls, url: str, connection_kwargs: Optional[Dict[str, Any]] = None, **kwargs: Any
|
||||
) -> "MongoStorage":
|
||||
"""
|
||||
Create an instance of :class:`MongoStorage` with specifying the connection string
|
||||
|
|
@ -54,6 +54,8 @@ class MongoStorage(BaseStorage):
|
|||
:param kwargs: arguments to be passed to :class:`MongoStorage`
|
||||
:return: an instance of :class:`MongoStorage`
|
||||
"""
|
||||
if connection_kwargs is None:
|
||||
connection_kwargs = {}
|
||||
client = AsyncIOMotorClient(url, **connection_kwargs)
|
||||
return cls(client=client, **kwargs)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue