This commit is contained in:
AF 2022-11-01 02:35:38 +00:00
parent c201370f48
commit 4a67e2421a

View File

@ -8,7 +8,7 @@ from io import StringIO
from typing import Any, Optional, IO, Type, Hashable from typing import Any, Optional, IO, Type, Hashable
__all__ = ('KVRequest', 'KVJson', 'DbConnection', 'DbFactory', 'Db', ) __all__ = ('KVRequest', 'KVJson', 'DbConnection', 'DbFactory', 'Db',)
class Request: class Request:
@ -99,8 +99,8 @@ class DbConnection:
__initial_size: int __initial_size: int
def __init__( def __init__(
self, self,
factory: 'DbFactory', factory: 'DbFactory',
) -> None: ) -> None:
self.factory = factory self.factory = factory
path = self.factory.path path = self.factory.path
@ -282,6 +282,7 @@ class DbConnection:
del self.__task del self.__task
del self.__initial_size del self.__initial_size
class DbFactory: class DbFactory:
def __init__(self, path: str | pathlib.Path, *, kvrequest_type: Type[KVRequest], buffersize=1048576): def __init__(self, path: str | pathlib.Path, *, kvrequest_type: Type[KVRequest], buffersize=1048576):
self.path = path = str(path) self.path = path = str(path)