Change _collection_class to ClassVar

This commit is contained in:
Unrud 2021-12-12 20:05:11 +01:00
parent e0f7fe6526
commit f25d7eebb8
3 changed files with 7 additions and 6 deletions

View File

@ -25,7 +25,7 @@ Uses one folder per collection and one file per collection entry.
import os
import time
from typing import Iterator, Optional
from typing import ClassVar, Iterator, Optional, Type
from radicale import config
from radicale.storage.multifilesystem.base import CollectionBase, StorageBase
@ -84,7 +84,7 @@ class Storage(
StoragePartCreateCollection, StoragePartLock, StoragePartMove,
StoragePartVerify, StoragePartDiscover, StorageBase):
_collection_class = Collection
_collection_class: ClassVar[Type[Collection]] = Collection
def __init__(self, configuration: config.Configuration) -> None:
super().__init__(configuration)

View File

@ -18,7 +18,7 @@
import os
from tempfile import TemporaryDirectory
from typing import IO, AnyStr, Iterator, Optional, Type
from typing import IO, AnyStr, ClassVar, Iterator, Optional, Type
from radicale import config, pathutils, storage, types
from radicale.storage import multifilesystem # noqa:F401
@ -62,7 +62,8 @@ class CollectionBase(storage.BaseCollection):
class StorageBase(storage.BaseStorage):
_collection_class: Type["multifilesystem.Collection"]
_collection_class: ClassVar[Type["multifilesystem.Collection"]]
_filesystem_folder: str
_filesystem_fsync: bool

View File

@ -20,7 +20,7 @@ The multifilesystem backend without file-based locking.
import threading
from collections import deque
from typing import Deque, Dict, Hashable, Iterator
from typing import ClassVar, Deque, Dict, Hashable, Iterator, Type
from radicale import config, pathutils, types
from radicale.storage import multifilesystem
@ -103,7 +103,7 @@ class Collection(multifilesystem.Collection):
class Storage(multifilesystem.Storage):
_collection_class = Collection
_collection_class: ClassVar[Type[Collection]] = Collection
_cache_lock: LockDict