Skip to content

Commit e8451cf

Browse files
committed
fix 3.8 and 3.9 compatibility
1 parent 2ab58f8 commit e8451cf

2 files changed

Lines changed: 15 additions & 8 deletions

File tree

dictdatabase/configuration.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
from __future__ import annotations
2-
from dataclasses import dataclass
32

43

54

6-
@dataclass(slots=True)
75
class Confuguration:
8-
storage_directory: str = "ddb_storage"
9-
indent: int | str | None = "\t" # eg. "\t" or 4 or None
10-
use_compression: bool = False
11-
use_orjson: bool = True
6+
7+
__slots__ = ("storage_directory", "indent", "use_compression", "use_orjson")
8+
9+
storage_directory: str
10+
indent: int | str | None # eg. "\t" or 4 or None
11+
use_compression: bool
12+
use_orjson: bool
13+
14+
def __init__(self, storage_directory="ddb_storage", indent="\t", use_compression=False, use_orjson=True):
15+
self.storage_directory = storage_directory
16+
self.indent = indent
17+
self.use_compression = use_compression
18+
self.use_orjson = use_orjson
1219

1320

1421

dictdatabase/io_unsafe.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from . import config, utils, byte_codes, indexing, io_bytes
88

99

10-
@dataclass(frozen=True, slots=True)
10+
@dataclass(frozen=True) # slots=True not supported by python 3.8 and 3.9
1111
class PartialDict:
1212
prefix: bytes
1313
key: str
@@ -17,7 +17,7 @@ class PartialDict:
1717
suffix: bytes
1818

1919

20-
@dataclass(frozen=True, slots=True)
20+
@dataclass(frozen=True) # slots=True not supported by python 3.8 and 3.9
2121
class PartialFileHandle:
2222
db_name: str
2323
partial_dict: PartialDict

0 commit comments

Comments
 (0)