Explorar o código

Change _collection_class to ClassVar

Unrud %!s(int64=4) %!d(string=hai) anos
pai
achega
f25d7eebb8

+ 2 - 2
radicale/storage/multifilesystem/__init__.py

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

+ 3 - 2
radicale/storage/multifilesystem/base.py

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

+ 2 - 2
radicale/storage/multifilesystem_nolock.py

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