zlmdb 25.10.1__cp313-cp313-manylinux_2_34_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of zlmdb might be problematic. Click here for more details.
- flatbuffers/__init__.py +19 -0
- flatbuffers/_version.py +17 -0
- flatbuffers/builder.py +776 -0
- flatbuffers/compat.py +86 -0
- flatbuffers/encode.py +42 -0
- flatbuffers/flexbuffers.py +1527 -0
- flatbuffers/number_types.py +181 -0
- flatbuffers/packer.py +42 -0
- flatbuffers/reflection/AdvancedFeatures.py +10 -0
- flatbuffers/reflection/BaseType.py +24 -0
- flatbuffers/reflection/Enum.py +169 -0
- flatbuffers/reflection/EnumVal.py +96 -0
- flatbuffers/reflection/Field.py +208 -0
- flatbuffers/reflection/KeyValue.py +56 -0
- flatbuffers/reflection/Object.py +175 -0
- flatbuffers/reflection/RPCCall.py +131 -0
- flatbuffers/reflection/Schema.py +206 -0
- flatbuffers/reflection/SchemaFile.py +77 -0
- flatbuffers/reflection/Service.py +145 -0
- flatbuffers/reflection/Type.py +98 -0
- flatbuffers/reflection/__init__.py +0 -0
- flatbuffers/table.py +129 -0
- flatbuffers/util.py +43 -0
- zlmdb/__init__.py +312 -0
- zlmdb/_database.py +990 -0
- zlmdb/_errors.py +31 -0
- zlmdb/_meta.py +27 -0
- zlmdb/_pmap.py +1667 -0
- zlmdb/_schema.py +137 -0
- zlmdb/_transaction.py +181 -0
- zlmdb/_types.py +1596 -0
- zlmdb/_version.py +27 -0
- zlmdb/cli.py +41 -0
- zlmdb/flatbuffers/__init__.py +5 -0
- zlmdb/flatbuffers/reflection/AdvancedFeatures.py +10 -0
- zlmdb/flatbuffers/reflection/BaseType.py +25 -0
- zlmdb/flatbuffers/reflection/Enum.py +252 -0
- zlmdb/flatbuffers/reflection/EnumVal.py +144 -0
- zlmdb/flatbuffers/reflection/Field.py +325 -0
- zlmdb/flatbuffers/reflection/KeyValue.py +84 -0
- zlmdb/flatbuffers/reflection/Object.py +260 -0
- zlmdb/flatbuffers/reflection/RPCCall.py +195 -0
- zlmdb/flatbuffers/reflection/Schema.py +301 -0
- zlmdb/flatbuffers/reflection/SchemaFile.py +112 -0
- zlmdb/flatbuffers/reflection/Service.py +213 -0
- zlmdb/flatbuffers/reflection/Type.py +148 -0
- zlmdb/flatbuffers/reflection/__init__.py +0 -0
- zlmdb/flatbuffers/reflection.fbs +152 -0
- zlmdb/lmdb/__init__.py +37 -0
- zlmdb/lmdb/__main__.py +25 -0
- zlmdb/lmdb/_config.py +10 -0
- zlmdb/lmdb/_lmdb_cffi.cpython-313-x86_64-linux-gnu.so +0 -0
- zlmdb/lmdb/cffi.py +2606 -0
- zlmdb/lmdb/tool.py +670 -0
- zlmdb/tests/lmdb/__init__.py +0 -0
- zlmdb/tests/lmdb/address_book.py +287 -0
- zlmdb/tests/lmdb/crash_test.py +339 -0
- zlmdb/tests/lmdb/cursor_test.py +333 -0
- zlmdb/tests/lmdb/env_test.py +919 -0
- zlmdb/tests/lmdb/getmulti_test.py +92 -0
- zlmdb/tests/lmdb/iteration_test.py +258 -0
- zlmdb/tests/lmdb/package_test.py +70 -0
- zlmdb/tests/lmdb/test_lmdb.py +188 -0
- zlmdb/tests/lmdb/testlib.py +185 -0
- zlmdb/tests/lmdb/tool_test.py +60 -0
- zlmdb/tests/lmdb/txn_test.py +575 -0
- zlmdb/tests/orm/MNodeLog.py +853 -0
- zlmdb/tests/orm/__init__.py +0 -0
- zlmdb/tests/orm/_schema_fbs.py +215 -0
- zlmdb/tests/orm/_schema_mnode_log.py +1201 -0
- zlmdb/tests/orm/_schema_py2.py +250 -0
- zlmdb/tests/orm/_schema_py3.py +307 -0
- zlmdb/tests/orm/_test_flatbuffers.py +144 -0
- zlmdb/tests/orm/_test_serialization.py +144 -0
- zlmdb/tests/orm/test_basic.py +217 -0
- zlmdb/tests/orm/test_etcd.py +275 -0
- zlmdb/tests/orm/test_pmap_indexes.py +466 -0
- zlmdb/tests/orm/test_pmap_types.py +90 -0
- zlmdb/tests/orm/test_pmaps.py +295 -0
- zlmdb/tests/orm/test_select.py +619 -0
- zlmdb-25.10.1.dist-info/METADATA +264 -0
- zlmdb-25.10.1.dist-info/RECORD +87 -0
- zlmdb-25.10.1.dist-info/WHEEL +5 -0
- zlmdb-25.10.1.dist-info/entry_points.txt +2 -0
- zlmdb-25.10.1.dist-info/licenses/LICENSE +137 -0
- zlmdb-25.10.1.dist-info/licenses/NOTICE +41 -0
- zlmdb-25.10.1.dist-info/top_level.txt +2 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright 2013 The py-lmdb authors, all rights reserved.
|
|
3
|
+
#
|
|
4
|
+
# Redistribution and use in source and binary forms, with or without
|
|
5
|
+
# modification, are permitted only as authorized by the OpenLDAP
|
|
6
|
+
# Public License.
|
|
7
|
+
#
|
|
8
|
+
# A copy of this license is available in the file LICENSE in the
|
|
9
|
+
# top-level directory of the distribution or, alternatively, at
|
|
10
|
+
# <http://www.OpenLDAP.org/license.html>.
|
|
11
|
+
#
|
|
12
|
+
# OpenLDAP is a registered trademark of the OpenLDAP Foundation.
|
|
13
|
+
#
|
|
14
|
+
# Individual files and/or contributed packages may be copyright by
|
|
15
|
+
# other parties and/or subject to additional restrictions.
|
|
16
|
+
#
|
|
17
|
+
# This work also contains materials derived from public sources.
|
|
18
|
+
#
|
|
19
|
+
# Additional information about OpenLDAP can be obtained at
|
|
20
|
+
# <http://www.openldap.org/>.
|
|
21
|
+
#
|
|
22
|
+
|
|
23
|
+
from __future__ import absolute_import
|
|
24
|
+
import atexit
|
|
25
|
+
import gc
|
|
26
|
+
import os
|
|
27
|
+
import shutil
|
|
28
|
+
import stat
|
|
29
|
+
import sys
|
|
30
|
+
import tempfile
|
|
31
|
+
import traceback
|
|
32
|
+
import unittest
|
|
33
|
+
|
|
34
|
+
try:
|
|
35
|
+
import __builtin__
|
|
36
|
+
except ImportError:
|
|
37
|
+
import builtins as __builtin__
|
|
38
|
+
|
|
39
|
+
import zlmdb.lmdb as lmdb
|
|
40
|
+
|
|
41
|
+
_cleanups = []
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def cleanup():
|
|
45
|
+
while _cleanups:
|
|
46
|
+
func = _cleanups.pop()
|
|
47
|
+
try:
|
|
48
|
+
func()
|
|
49
|
+
except Exception:
|
|
50
|
+
traceback.print_exc()
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
atexit.register(cleanup)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class LmdbTest(unittest.TestCase):
|
|
57
|
+
def tearDown(self):
|
|
58
|
+
cleanup()
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def temp_dir(create=True):
|
|
62
|
+
path = tempfile.mkdtemp(prefix="lmdb_test")
|
|
63
|
+
assert path is not None, "tempfile.mkdtemp failed"
|
|
64
|
+
if not create:
|
|
65
|
+
os.rmdir(path)
|
|
66
|
+
_cleanups.append(lambda: shutil.rmtree(path, ignore_errors=True))
|
|
67
|
+
if hasattr(path, "decode"):
|
|
68
|
+
path = path.decode(sys.getfilesystemencoding())
|
|
69
|
+
return path
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def temp_file(create=True):
|
|
73
|
+
fd, path = tempfile.mkstemp(prefix="lmdb_test")
|
|
74
|
+
assert path is not None, "tempfile.mkstemp failed"
|
|
75
|
+
os.close(fd)
|
|
76
|
+
if not create:
|
|
77
|
+
os.unlink(path)
|
|
78
|
+
_cleanups.append(lambda: os.path.exists(path) and os.unlink(path))
|
|
79
|
+
pathlock = path + "-lock"
|
|
80
|
+
_cleanups.append(lambda: os.path.exists(pathlock) and os.unlink(pathlock))
|
|
81
|
+
if hasattr(path, "decode"):
|
|
82
|
+
path = path.decode(sys.getfilesystemencoding())
|
|
83
|
+
return path
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def temp_env(path=None, max_dbs=10, **kwargs):
|
|
87
|
+
if not path:
|
|
88
|
+
path = temp_dir()
|
|
89
|
+
env = lmdb.open(path, max_dbs=max_dbs, **kwargs)
|
|
90
|
+
_cleanups.append(env.close)
|
|
91
|
+
return path, env
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def path_mode(path):
|
|
95
|
+
return stat.S_IMODE(os.stat(path).st_mode)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def debug_collect():
|
|
99
|
+
if hasattr(gc, "set_debug") and hasattr(gc, "get_debug"):
|
|
100
|
+
old = gc.get_debug()
|
|
101
|
+
gc.set_debug(gc.DEBUG_LEAK)
|
|
102
|
+
gc.collect()
|
|
103
|
+
gc.set_debug(old)
|
|
104
|
+
else:
|
|
105
|
+
for x in range(10):
|
|
106
|
+
# PyPy doesn't collect objects with __del__ on first attempt.
|
|
107
|
+
gc.collect()
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
UnicodeType = getattr(__builtin__, "unicode", str)
|
|
111
|
+
BytesType = getattr(__builtin__, "bytes", str)
|
|
112
|
+
|
|
113
|
+
try:
|
|
114
|
+
INT_TYPES = (int, long)
|
|
115
|
+
except NameError:
|
|
116
|
+
INT_TYPES = (int,)
|
|
117
|
+
|
|
118
|
+
# B(ascii 'string') -> bytes
|
|
119
|
+
try:
|
|
120
|
+
bytes("") # Python>=2.6, alias for str().
|
|
121
|
+
|
|
122
|
+
def B(s):
|
|
123
|
+
return s
|
|
124
|
+
|
|
125
|
+
except TypeError: # Python3.x, requires encoding parameter.
|
|
126
|
+
|
|
127
|
+
def B(s):
|
|
128
|
+
return bytes(s, "ascii")
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
# BL('s1', 's2') -> ['bytes1', 'bytes2']
|
|
132
|
+
def BL(*args):
|
|
133
|
+
return list(map(B, args))
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
# BT('s1', 's2') -> ('bytes1', 'bytes2')
|
|
137
|
+
def BT(*args):
|
|
138
|
+
return tuple(B(s) for s in args)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
# byte_chr(int) -> single byte from int (via chr)
|
|
142
|
+
def byte_chr(arg):
|
|
143
|
+
return B(chr(arg))
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
# OCT(s) -> parse string as octal
|
|
147
|
+
def OCT(s):
|
|
148
|
+
return int(s, 8)
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
KEYS = BL("a", "b", "baa", "d")
|
|
152
|
+
ITEMS = [(k, B("")) for k in KEYS]
|
|
153
|
+
REV_ITEMS = ITEMS[::-1]
|
|
154
|
+
VALUES = [B("") for k in KEYS]
|
|
155
|
+
|
|
156
|
+
KEYS2 = BL("a", "b", "baa", "d", "e", "f", "g", "h")
|
|
157
|
+
ITEMS2 = [(k, B("")) for k in KEYS2]
|
|
158
|
+
REV_ITEMS2 = ITEMS2[::-1]
|
|
159
|
+
VALUES2 = [B("") for k in KEYS2]
|
|
160
|
+
|
|
161
|
+
KEYSFIXED = BL("a", "b", "c", "d", "e", "f", "g", "h")
|
|
162
|
+
VALUES_MULTI = [(B("r"), B("s")) for k in KEYSFIXED]
|
|
163
|
+
ITEMS_MULTI_FIXEDKEY = [
|
|
164
|
+
(kv[0], v) for kv in list(zip(KEYSFIXED, VALUES_MULTI)) for v in kv[1]
|
|
165
|
+
]
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def _put_items(items, t, db=None):
|
|
169
|
+
for k, v in items:
|
|
170
|
+
if db:
|
|
171
|
+
t.put(k, v, db=db)
|
|
172
|
+
else:
|
|
173
|
+
t.put(k, v)
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
def putData(t, db=None):
|
|
177
|
+
_put_items(ITEMS, t, db=db)
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
def putBigData(t, db=None):
|
|
181
|
+
_put_items(ITEMS2, t, db=db)
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
def putBigDataMultiFixed(t, db=None):
|
|
185
|
+
_put_items(ITEMS_MULTI_FIXEDKEY, t, db=db)
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright 2013 The py-lmdb authors, all rights reserved.
|
|
3
|
+
#
|
|
4
|
+
# Redistribution and use in source and binary forms, with or without
|
|
5
|
+
# modification, are permitted only as authorized by the OpenLDAP
|
|
6
|
+
# Public License.
|
|
7
|
+
#
|
|
8
|
+
# A copy of this license is available in the file LICENSE in the
|
|
9
|
+
# top-level directory of the distribution or, alternatively, at
|
|
10
|
+
# <http://www.OpenLDAP.org/license.html>.
|
|
11
|
+
#
|
|
12
|
+
# OpenLDAP is a registered trademark of the OpenLDAP Foundation.
|
|
13
|
+
#
|
|
14
|
+
# Individual files and/or contributed packages may be copyright by
|
|
15
|
+
# other parties and/or subject to additional restrictions.
|
|
16
|
+
#
|
|
17
|
+
# This work also contains materials derived from public sources.
|
|
18
|
+
#
|
|
19
|
+
# Additional information about OpenLDAP can be obtained at
|
|
20
|
+
# <http://www.openldap.org/>.
|
|
21
|
+
#
|
|
22
|
+
|
|
23
|
+
from __future__ import absolute_import
|
|
24
|
+
|
|
25
|
+
import sys
|
|
26
|
+
import shlex
|
|
27
|
+
import unittest
|
|
28
|
+
|
|
29
|
+
import zlmdb.lmdb as lmdb
|
|
30
|
+
import zlmdb.lmdb.tool
|
|
31
|
+
from . import testlib
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def call_tool(cmdline):
|
|
35
|
+
if sys.platform == "win32":
|
|
36
|
+
args = cmdline.split()
|
|
37
|
+
else:
|
|
38
|
+
args = shlex.split(cmdline)
|
|
39
|
+
return zlmdb.lmdb.tool.main(args)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class ToolTest(testlib.LmdbTest):
|
|
43
|
+
def test_cmd_get(self):
|
|
44
|
+
frompath, env = testlib.temp_env()
|
|
45
|
+
db = env.open_db(b"subdb")
|
|
46
|
+
with env.begin(write=True, db=db) as txn:
|
|
47
|
+
txn.put(b"foo", b"bar", db=db)
|
|
48
|
+
env.close()
|
|
49
|
+
call_tool("-d subdb get --env %s" % (frompath,))
|
|
50
|
+
|
|
51
|
+
def test_cmd_rewrite(self):
|
|
52
|
+
frompath, env = testlib.temp_env()
|
|
53
|
+
env.open_db(b"subdb")
|
|
54
|
+
env.close()
|
|
55
|
+
topath = testlib.temp_dir()
|
|
56
|
+
call_tool("rewrite -e %s -E %s subdb" % (frompath, topath))
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
if __name__ == "__main__":
|
|
60
|
+
unittest.main()
|