Refactoring while review

This commit is contained in:
Rishat Fayzullin 2024-03-12 17:27:52 +03:00
parent 90949596a0
commit 5a2cb9704b
2 changed files with 6 additions and 4 deletions

View file

@ -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)

View file

@ -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)