moat-kv 0.70.24__py3-none-any.whl → 0.71.6__py3-none-any.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.
Files changed (127) hide show
  1. moat/kv/__init__.py +6 -7
  2. moat/kv/_cfg.yaml +5 -8
  3. moat/kv/actor/__init__.py +2 -1
  4. moat/kv/actor/deletor.py +4 -1
  5. moat/kv/auth/__init__.py +12 -13
  6. moat/kv/auth/_test.py +4 -1
  7. moat/kv/auth/password.py +11 -7
  8. moat/kv/backend/mqtt.py +4 -8
  9. moat/kv/client.py +20 -39
  10. moat/kv/code.py +3 -3
  11. moat/kv/command/data.py +4 -3
  12. moat/kv/command/dump/__init__.py +29 -29
  13. moat/kv/command/internal.py +2 -3
  14. moat/kv/command/job.py +1 -2
  15. moat/kv/command/type.py +3 -6
  16. moat/kv/data.py +9 -8
  17. moat/kv/errors.py +16 -8
  18. moat/kv/mock/__init__.py +2 -12
  19. moat/kv/model.py +28 -32
  20. moat/kv/obj/__init__.py +3 -3
  21. moat/kv/obj/command.py +3 -3
  22. moat/kv/runner.py +4 -5
  23. moat/kv/server.py +106 -126
  24. moat/kv/types.py +8 -6
  25. {moat_kv-0.70.24.dist-info → moat_kv-0.71.6.dist-info}/METADATA +7 -6
  26. moat_kv-0.71.6.dist-info/RECORD +47 -0
  27. {moat_kv-0.70.24.dist-info → moat_kv-0.71.6.dist-info}/WHEEL +1 -1
  28. moat_kv-0.71.6.dist-info/licenses/LICENSE +3 -0
  29. moat_kv-0.71.6.dist-info/licenses/LICENSE.APACHE2 +202 -0
  30. moat_kv-0.71.6.dist-info/licenses/LICENSE.MIT +20 -0
  31. moat_kv-0.71.6.dist-info/top_level.txt +1 -0
  32. build/lib/docs/source/conf.py +0 -201
  33. build/lib/examples/pathify.py +0 -45
  34. build/lib/moat/kv/__init__.py +0 -19
  35. build/lib/moat/kv/_cfg.yaml +0 -97
  36. build/lib/moat/kv/_main.py +0 -91
  37. build/lib/moat/kv/actor/__init__.py +0 -98
  38. build/lib/moat/kv/actor/deletor.py +0 -139
  39. build/lib/moat/kv/auth/__init__.py +0 -444
  40. build/lib/moat/kv/auth/_test.py +0 -166
  41. build/lib/moat/kv/auth/password.py +0 -234
  42. build/lib/moat/kv/auth/root.py +0 -58
  43. build/lib/moat/kv/backend/__init__.py +0 -67
  44. build/lib/moat/kv/backend/mqtt.py +0 -74
  45. build/lib/moat/kv/backend/serf.py +0 -45
  46. build/lib/moat/kv/client.py +0 -1025
  47. build/lib/moat/kv/code.py +0 -236
  48. build/lib/moat/kv/codec.py +0 -11
  49. build/lib/moat/kv/command/__init__.py +0 -1
  50. build/lib/moat/kv/command/acl.py +0 -180
  51. build/lib/moat/kv/command/auth.py +0 -261
  52. build/lib/moat/kv/command/code.py +0 -293
  53. build/lib/moat/kv/command/codec.py +0 -186
  54. build/lib/moat/kv/command/data.py +0 -265
  55. build/lib/moat/kv/command/dump/__init__.py +0 -143
  56. build/lib/moat/kv/command/error.py +0 -149
  57. build/lib/moat/kv/command/internal.py +0 -248
  58. build/lib/moat/kv/command/job.py +0 -433
  59. build/lib/moat/kv/command/log.py +0 -53
  60. build/lib/moat/kv/command/server.py +0 -114
  61. build/lib/moat/kv/command/type.py +0 -201
  62. build/lib/moat/kv/config.py +0 -46
  63. build/lib/moat/kv/data.py +0 -216
  64. build/lib/moat/kv/errors.py +0 -561
  65. build/lib/moat/kv/exceptions.py +0 -126
  66. build/lib/moat/kv/mock/__init__.py +0 -101
  67. build/lib/moat/kv/mock/mqtt.py +0 -159
  68. build/lib/moat/kv/mock/serf.py +0 -250
  69. build/lib/moat/kv/mock/tracer.py +0 -63
  70. build/lib/moat/kv/model.py +0 -1069
  71. build/lib/moat/kv/obj/__init__.py +0 -646
  72. build/lib/moat/kv/obj/command.py +0 -241
  73. build/lib/moat/kv/runner.py +0 -1347
  74. build/lib/moat/kv/server.py +0 -2809
  75. build/lib/moat/kv/types.py +0 -513
  76. debian/moat-kv/usr/lib/python3/dist-packages/docs/source/conf.py +0 -201
  77. debian/moat-kv/usr/lib/python3/dist-packages/examples/pathify.py +0 -45
  78. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/__init__.py +0 -19
  79. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/_cfg.yaml +0 -97
  80. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/_main.py +0 -91
  81. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/actor/__init__.py +0 -98
  82. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/actor/deletor.py +0 -139
  83. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/auth/__init__.py +0 -444
  84. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/auth/_test.py +0 -166
  85. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/auth/password.py +0 -234
  86. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/auth/root.py +0 -58
  87. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/backend/__init__.py +0 -67
  88. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/backend/mqtt.py +0 -74
  89. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/backend/serf.py +0 -45
  90. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/client.py +0 -1025
  91. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/code.py +0 -236
  92. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/codec.py +0 -11
  93. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/command/__init__.py +0 -1
  94. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/command/acl.py +0 -180
  95. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/command/auth.py +0 -261
  96. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/command/code.py +0 -293
  97. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/command/codec.py +0 -186
  98. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/command/data.py +0 -265
  99. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/command/dump/__init__.py +0 -143
  100. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/command/error.py +0 -149
  101. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/command/internal.py +0 -248
  102. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/command/job.py +0 -433
  103. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/command/log.py +0 -53
  104. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/command/server.py +0 -114
  105. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/command/type.py +0 -201
  106. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/config.py +0 -46
  107. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/data.py +0 -216
  108. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/errors.py +0 -561
  109. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/exceptions.py +0 -126
  110. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/mock/__init__.py +0 -101
  111. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/mock/mqtt.py +0 -159
  112. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/mock/serf.py +0 -250
  113. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/mock/tracer.py +0 -63
  114. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/model.py +0 -1069
  115. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/obj/__init__.py +0 -646
  116. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/obj/command.py +0 -241
  117. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/runner.py +0 -1347
  118. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/server.py +0 -2809
  119. debian/moat-kv/usr/lib/python3/dist-packages/moat/kv/types.py +0 -513
  120. docs/source/conf.py +0 -201
  121. examples/pathify.py +0 -45
  122. moat/kv/backend/serf.py +0 -45
  123. moat/kv/codec.py +0 -11
  124. moat/kv/mock/serf.py +0 -250
  125. moat_kv-0.70.24.dist-info/RECORD +0 -137
  126. moat_kv-0.70.24.dist-info/top_level.txt +0 -9
  127. {moat_kv-0.70.24.dist-info → moat_kv-0.71.6.dist-info}/licenses/LICENSE.txt +0 -0
@@ -1,513 +0,0 @@
1
- from __future__ import annotations
2
- import logging
3
- import weakref
4
-
5
- import jsonschema
6
- from moat.util import NotGiven, P, Path, make_proc, singleton
7
-
8
- from .exceptions import ACLError, ClientError
9
- from .model import Entry
10
-
11
- logger = logging.getLogger(__name__)
12
-
13
- # TYPES
14
-
15
-
16
- class MetaEntry(Entry):
17
- def __init__(self, *a, **k):
18
- super().__init__(*a, **k)
19
- self._metaroot = self.parent._metaroot
20
-
21
- @property
22
- def metaroot(self):
23
- "Stores a link to the meta root because some do need it."
24
- return self._metaroot()
25
-
26
-
27
- class TypeEntry(Entry):
28
- """I am a type-checking node."""
29
-
30
- _code = None
31
- _schema = None
32
-
33
- def check_value(self, value, entry=None, **kv):
34
- self.parent.check_value(value, entry=entry, **kv)
35
- if self._schema is not None:
36
- jsonschema.validate(instance=value, schema=self._schema)
37
- if self._code is not None:
38
- self._code(value, entry=entry, data=self._data, **kv)
39
-
40
- async def set(self, value):
41
- code = None
42
- schema = None
43
- if value is not NotGiven and (
44
- value.get("code", None) is not None or value.get("schema", None) is not None
45
- ):
46
- schema = value.get("schema", None)
47
- if value.get("code", None) is None:
48
- code = None
49
- else:
50
- code = make_proc(value.code, ("value",), self.path)
51
- if len(value.good) < 2:
52
- raise RuntimeError("Must have check-good values")
53
- if not value.bad:
54
- raise RuntimeError("Must have check-bad values")
55
- for v in value["good"]:
56
- self.parent.check_value(v)
57
- try:
58
- if schema is not None:
59
- jsonschema.validate(instance=v, schema=schema)
60
- if code is not None:
61
- code(v, entry=None)
62
- except Exception:
63
- raise ValueError(f"failed on good value {v!r}")
64
- for v in value["bad"]:
65
- self.parent.check_value(v)
66
- try:
67
- if schema is not None:
68
- jsonschema.validate(instance=v, schema=schema)
69
- if code is not None:
70
- code(v, entry=None)
71
- except Exception:
72
- pass
73
- else:
74
- raise ValueError(f"did not fail on {v!r}")
75
-
76
- await super().set(value)
77
- self._code = code
78
- self._schema = schema
79
-
80
-
81
- TypeEntry.SUBTYPE = TypeEntry
82
-
83
-
84
- class TypeRoot(Entry):
85
- """I am the root of MoaT-KV's type hierarchy."""
86
-
87
- SUBTYPE = TypeEntry
88
-
89
- async def set(self, value):
90
- if value is not NotGiven:
91
- raise ValueError("This node can't have data.")
92
-
93
- def check_value(self, value, entry=None, **kv):
94
- pass
95
-
96
-
97
- # MATCH (for types)
98
-
99
-
100
- class MatchEntry(MetaEntry):
101
- """I represent a match from a path to a type.
102
-
103
- My data requires a "type" attribute that's a path in the "type"
104
- hierarchy that's next to my MatchRoot.
105
- """
106
-
107
- async def set(self, value):
108
- if value is NotGiven:
109
- pass
110
- elif isinstance(value.type, str):
111
- value.type = P(value.type)
112
- elif not isinstance(value.type, (Path, list, tuple)):
113
- raise ValueError("Type of %r is not a list" % (value.type,))
114
- try:
115
- self.metaroot["type"].follow(value.type, create=False)
116
- except KeyError:
117
- logger.exception("Type %r doesn't exist", value.type)
118
- raise ClientError("This type does not exist")
119
- # crashes if nonexistent
120
- await super().set(value)
121
-
122
-
123
- MatchEntry.SUBTYPE = MatchEntry
124
-
125
-
126
- class NodeFinder:
127
- """A generic object that can walk down a possibly-wildcard-equipped path.
128
-
129
- Example: given a path `one.two.three` and a root `bar` with subtree `bar.#.three`,
130
- `NodeFinder(bar).step(one).step(two).step(three)` will return the node
131
- at `bar.#.three` (assuming that nothing more specific hangs off `bar`).
132
- """
133
-
134
- def __init__(self, meta):
135
- if isinstance(meta, list):
136
- self.steps = meta
137
- else:
138
- self.steps = ((meta, False),)
139
-
140
- def step(self, name, new=False):
141
- steps = []
142
- for node, keep in self.steps:
143
- if name in node:
144
- steps.append((node[name], False))
145
- if name is None:
146
- continue
147
- if "+" in node:
148
- steps.append((node["+"], False))
149
- if "#" in node:
150
- steps.append((node["#"], True))
151
- if keep:
152
- steps.append((node, True))
153
- # Nodes found with '#' stay on the list
154
- # so that they can match multiple entries.
155
- # if not steps:
156
- # raise KeyError(name)
157
- if new:
158
- return type(self)(steps, **self.copy_args)
159
- else:
160
- self.steps = steps
161
- return self
162
-
163
- @property
164
- def copy_args(self):
165
- return {}
166
-
167
- @property
168
- def result(self):
169
- for node, _keep in self.steps:
170
- if node._data is not NotGiven:
171
- return node
172
- return None
173
-
174
-
175
- class ACLFinder(NodeFinder):
176
- """A NodeFinder which expects ACL strings as elements"""
177
-
178
- _block = ""
179
-
180
- @property
181
- def copy_args(self):
182
- return {"blocked": self._block}
183
-
184
- def __init__(self, acl, blocked=None):
185
- if isinstance(acl, ACLFinder):
186
- if blocked is None:
187
- blocked = acl._block
188
- acl = acl.steps
189
- super().__init__(acl)
190
- if blocked is not None:
191
- self._block = blocked
192
-
193
- def allows(self, x):
194
- if x in self._block:
195
- return False
196
-
197
- r = self.result
198
- if r is None:
199
- return True
200
- return x in r.data
201
-
202
- def block(self, c):
203
- if c not in self._block:
204
- self._block += c
205
-
206
- def check(self, x):
207
- if not self.allows(x):
208
- raise ACLError(self.result, x)
209
-
210
-
211
- class ACLStepper(ACLFinder):
212
- """An ACLFinder which returns a copy of itself at every `step`."""
213
-
214
- def step(self, name, new=True):
215
- return super().step(name, new=new)
216
-
217
-
218
- @singleton
219
- class NullACL(ACLStepper):
220
- """This singleton represents an ACL that never checks anything."""
221
-
222
- result = "-"
223
-
224
- def __init__(self): # pylint: disable=super-init-not-called
225
- pass
226
-
227
- def allows(self, x):
228
- return x != "a"
229
-
230
- def check(self, x):
231
- return
232
-
233
- def block(self, c):
234
- pass
235
-
236
- def step(self, name, new=None):
237
- return self
238
-
239
-
240
- class MetaPathEntry(MetaEntry):
241
- def _find_node(self, entry):
242
- """Search for the most-specific match.
243
-
244
- Match entries whose values are missing are not considered.
245
- """
246
- f = NodeFinder(self)
247
- for n in entry.path:
248
- f.step(n)
249
- return f.result
250
-
251
-
252
- class MatchRoot(MetaPathEntry):
253
- """I am the root of MoaT-KV's type hierarchy."""
254
-
255
- SUBTYPE = MatchEntry
256
-
257
- async def set(self, value):
258
- if value is not None:
259
- raise ValueError("This node can't have data.")
260
-
261
- def check_value(self, value, entry, **kv):
262
- """Check this value for this entry against my match hierarchy"""
263
- match = self._find_node(entry)
264
- if match is None:
265
- return
266
- typ = self.parent["type"].follow(match._data["type"])
267
- return typ.check_value(value, entry=entry, match=match, **kv)
268
-
269
-
270
- class CodecEntry(Entry):
271
- """I am a codec."""
272
-
273
- _enc = None
274
- _dec = None
275
-
276
- def enc_value(self, value, entry=None, **kv):
277
- if self._enc is not None:
278
- try:
279
- value = self._enc(value, entry=entry, data=self._data, **kv)
280
- except TypeError:
281
- if value is not None:
282
- raise
283
- return value
284
-
285
- def dec_value(self, value, entry=None, **kv):
286
- if self._dec is not None:
287
- try:
288
- value = self._dec(value, entry=entry, data=self._data, **kv)
289
- except TypeError:
290
- if value is not None:
291
- raise
292
- return value
293
-
294
- async def set(self, value):
295
- enc = None
296
- dec = None
297
- if value is not None and value.decode is not None:
298
- if not value["in"]:
299
- raise RuntimeError("Must have tests for decoding")
300
- dec = make_proc(value.decode, ("value",), self.path)
301
- for v, w in value["in"]:
302
- try:
303
- r = dec(v)
304
- except Exception as exc:
305
- raise ValueError(
306
- f"failed decoder at {self.path} on {v!r} with {exc!r}",
307
- ) from exc
308
- else:
309
- if r != w:
310
- raise ValueError(f"Decoding at {self.path}: {v!r} got {r!r}, not {w!r}")
311
-
312
- if value is not None and value.encode is not None:
313
- if not value["out"]:
314
- raise RuntimeError("Must have tests for encoding")
315
- enc = make_proc(value.encode, ("value",), self.path)
316
- for v, w in value["out"]:
317
- try:
318
- r = enc(v)
319
- except Exception as exc:
320
- raise ValueError(
321
- f"failed encoder at {self.path} on {v!r} with {exc!r}",
322
- ) from exc
323
- else:
324
- if r != w:
325
- raise ValueError(f"Encoding at {self.path}: {v!r} got {r!r}, not {w!r}")
326
-
327
- await super().set(value)
328
- self._enc = enc
329
- self._dec = dec
330
-
331
-
332
- CodecEntry.SUBTYPE = CodecEntry
333
-
334
-
335
- class CodecRoot(Entry):
336
- """I am the root of MoaT-KV's codec hierarchy."""
337
-
338
- SUBTYPE = CodecEntry
339
-
340
- async def set(self, value):
341
- if value is not None:
342
- raise ValueError("This node can't have data.")
343
-
344
- def check_value(self, value, entry=None, **kv):
345
- pass
346
-
347
-
348
- # CONV (for codecs)
349
-
350
-
351
- class ConvEntry(MetaEntry):
352
- """I represent a converter from a path to a type.
353
-
354
- My data requires a "codec" attribute that's a path in the "codecs"
355
- hierarchy that's next to my Root.
356
- """
357
-
358
- async def set(self, value):
359
- if value is not NotGiven:
360
- # can't run a nonexistent value through a codec
361
-
362
- if not hasattr(value, "codec"):
363
- raise ValueError("Duh? " + repr(value))
364
- if isinstance(value.codec, str):
365
- value.codec = P(value.codec)
366
- elif not isinstance(value.codec, (Path, list, tuple)):
367
- raise ValueError("Codec %r is not a list" % (value.codec,))
368
- try:
369
- self.metaroot["codec"].follow(value.codec, create=False)
370
- except KeyError:
371
- logger.warning("Codec %r does not exist (yet?)", value.codec)
372
- # raise ClientError("This codec does not exist")
373
- # don't raise here
374
- await super().set(value)
375
-
376
-
377
- ConvEntry.SUBTYPE = ConvEntry
378
-
379
-
380
- class ConvNull:
381
- """I am a dummy translator"""
382
-
383
- @staticmethod
384
- def enc_value(value, **_kw):
385
- return value
386
-
387
- @staticmethod
388
- def dec_value(value, **_kw):
389
- return value
390
-
391
-
392
- ConvNull = ConvNull()
393
-
394
-
395
- class ConvName(MetaPathEntry):
396
- """I am a named tree for conversion entries."""
397
-
398
- SUBTYPE = ConvEntry
399
-
400
- async def set(self, value):
401
- if value is not None:
402
- raise ValueError("This node can't have data.")
403
-
404
- def enc_value(self, value, entry, **kv):
405
- """Check this value for this entry against my converter hierarchy"""
406
- conv = self._find_node(entry)
407
- if conv is None:
408
- return value
409
- codec = self.metaroot["codec"].follow(conv._data["codec"])
410
- return codec.enc_value(value, entry=entry, conv=conv, **kv)
411
-
412
- def dec_value(self, value, entry, **kv):
413
- """Check this value for this entry against my converter hierarchy"""
414
- conv = self._find_node(entry)
415
- if conv is None:
416
- return value
417
- codec = self.metaroot["codec"].follow(conv._data["codec"])
418
- return codec.dec_value(value, entry=entry, conv=conv, **kv)
419
-
420
-
421
- class ConvRoot(MetaEntry):
422
- SUBTYPE = ConvName
423
-
424
- async def set(self, value):
425
- if value is not None:
426
- raise ValueError("This node can't have data.")
427
-
428
-
429
- class AclEntry(MetaPathEntry):
430
- """I represent an ACL.
431
-
432
- My data must be a string of ACLish characters.
433
- """
434
-
435
- async def set(self, value):
436
- if value is NotGiven:
437
- pass
438
- elif not isinstance(value, str):
439
- raise ValueError("ACL is not a string")
440
- await super().set(value)
441
-
442
-
443
- AclEntry.SUBTYPE = AclEntry
444
-
445
-
446
- class AclName(AclEntry):
447
- """I am a named tree for ACL entries."""
448
-
449
- SUBTYPE = AclEntry
450
-
451
- async def check(self, entry, typ):
452
- acl = self._find_node(entry)
453
- if acl is None:
454
- return None
455
- return typ in acl.value
456
-
457
-
458
- class AclRoot(MetaEntry):
459
- SUBTYPE = AclName
460
-
461
- async def set(self, value):
462
- if value is not None:
463
- raise ValueError("This node can't have data.")
464
-
465
-
466
- class DelRoot(Entry):
467
- SUBTYPE = None
468
-
469
- async def set(self, value):
470
- await super().set(value)
471
- await self.root.server.del_check(value)
472
-
473
-
474
- class ActorRoot(Entry):
475
- SUBTYPE = None
476
- SUBTYPES = {"del": DelRoot}
477
-
478
-
479
- # ROOT
480
-
481
-
482
- class MetaRootEntry(Entry): # not MetaEntry
483
- """I am the special node off the MoaT-KV root that's named ``None``."""
484
-
485
- SUBTYPES = {
486
- "type": TypeRoot,
487
- "match": MatchRoot,
488
- "acl": AclRoot,
489
- "codec": CodecRoot,
490
- "conv": ConvRoot,
491
- "actor": ActorRoot,
492
- }
493
-
494
- def __init__(self, *a, **k):
495
- super().__init__(*a, **k)
496
- self._metaroot = weakref.ref(self)
497
-
498
-
499
- Entry.SUBTYPES[None] = MetaRootEntry
500
-
501
-
502
- class RootEntry(Entry):
503
- """I am the root of the MoaT-KV data tree."""
504
-
505
- def __init__(self, server, *a, **k):
506
- super().__init__("ROOT", None, *a, **k)
507
- self._server = weakref.ref(server)
508
-
509
- @property
510
- def server(self):
511
- return self._server()
512
-
513
- SUBTYPES = {None: MetaRootEntry}
docs/source/conf.py DELETED
@@ -1,201 +0,0 @@
1
- #!/usr/bin/env python3
2
- # -*- coding: utf-8 -*-
3
- #
4
- # Documentation build configuration file, created by
5
- # sphinx-quickstart on Sat Jan 21 19:11:14 2017.
6
- #
7
- # This file is execfile()d with the current directory set to its
8
- # containing dir.
9
- #
10
- # Note that not all possible configuration values are present in this
11
- # autogenerated file.
12
- #
13
- # All configuration values have a default; values that are commented out
14
- # serve to show the default.
15
-
16
- # If extensions (or modules to document with autodoc) are in another directory,
17
- # add these directories to sys.path here. If the directory is relative to the
18
- # documentation root, use os.path.abspath to make it absolute, like shown here.
19
- #
20
- import os
21
- import sys
22
-
23
- # So autodoc can import our package
24
- sys.path.insert(0, os.path.abspath("../.."))
25
-
26
- # Warn about all references to unknown targets
27
- nitpicky = True
28
- # Except for these ones, which we expect to point to unknown targets:
29
- nitpick_ignore = [
30
- # Format is ("sphinx reference type", "string"), e.g.:
31
- ("py:obj", "bytes-like"),
32
- ("py:class", "RangeSet"),
33
- ("py:class", "Any"),
34
- ]
35
-
36
- autodoc_inherit_docstrings = False
37
-
38
- # -- General configuration ------------------------------------------------
39
-
40
- # If your documentation needs a minimal Sphinx version, state it here.
41
- #
42
- # needs_sphinx = '1.0'
43
-
44
- # Add any Sphinx extension module names here, as strings. They can be
45
- # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
46
- # ones.
47
- extensions = [
48
- "sphinx.ext.autodoc",
49
- "sphinx.ext.intersphinx",
50
- "sphinx.ext.coverage",
51
- "sphinx.ext.napoleon",
52
- "sphinxcontrib_trio",
53
- ]
54
-
55
- intersphinx_mapping = {
56
- "python": ("https://docs.python.org/3", None),
57
- "trio": ("https://trio.readthedocs.io/en/stable", None),
58
- }
59
-
60
- autodoc_member_order = "bysource"
61
-
62
- # Add any paths that contain templates here, relative to this directory.
63
- templates_path = []
64
-
65
- # The suffix(es) of source filenames.
66
- # You can specify multiple suffix as a list of string:
67
- #
68
- # source_suffix = ['.rst', '.md']
69
- source_suffix = ".rst"
70
-
71
- # The master toctree document.
72
- master_doc = "index"
73
-
74
- # General information about the project.
75
- project = "MoaT-KV"
76
- copyright = "The MoaT-KV authors"
77
- author = "The MoaT-KV authors"
78
-
79
- # The version info for the project you're documenting, acts as replacement for
80
- # |version| and |release|, also used in various other places throughout the
81
- # built documents.
82
- #
83
- # The short X.Y version.
84
- import pkg_resources
85
-
86
- version = pkg_resources.get_distribution("moat.kv")._version
87
-
88
- # The full version, including alpha/beta/rc tags.
89
- release = version
90
-
91
- # The language for content autogenerated by Sphinx. Refer to documentation
92
- # for a list of supported languages.
93
- #
94
- # This is also used if you do content translation via gettext catalogs.
95
- # Usually you set "language" from the command line for these cases.
96
- language = None
97
-
98
- # List of patterns, relative to source directory, that match files and
99
- # directories to ignore when looking for source files.
100
- # This patterns also effect to html_static_path and html_extra_path
101
- exclude_patterns = []
102
-
103
- # The name of the Pygments (syntax highlighting) style to use.
104
- pygments_style = "sphinx"
105
-
106
- # The default language for :: blocks
107
- highlight_language = "python3"
108
-
109
- # If true, `todo` and `todoList` produce output, else they produce nothing.
110
- todo_include_todos = False
111
-
112
-
113
- # -- Options for HTML output ----------------------------------------------
114
-
115
- # The theme to use for HTML and HTML Help pages. See the documentation for
116
- # a list of builtin themes.
117
- #
118
- # html_theme = 'alabaster'
119
-
120
- # We have to set this ourselves, not only because it's useful for local
121
- # testing, but also because if we don't then RTD will throw away our
122
- # html_theme_options.
123
- import sphinx_rtd_theme
124
-
125
- html_theme = "sphinx_rtd_theme"
126
- html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
127
-
128
- # Theme options are theme-specific and customize the look and feel of a theme
129
- # further. For a list of options available for each theme, see the
130
- # documentation.
131
- #
132
- html_theme_options = {
133
- # default is 2
134
- # show deeper nesting in the RTD theme's sidebar TOC
135
- # https://stackoverflow.com/questions/27669376/
136
- # I'm not 100% sure this actually does anything with our current
137
- # versions/settings...
138
- "navigation_depth": 4,
139
- "logo_only": True,
140
- }
141
-
142
- # Add any paths that contain custom static files (such as style sheets) here,
143
- # relative to this directory. They are copied after the builtin static files,
144
- # so a file named "default.css" will overwrite the builtin "default.css".
145
- html_static_path = ["_static"]
146
-
147
-
148
- # -- Options for HTMLHelp output ------------------------------------------
149
-
150
- # Output file base name for HTML help builder.
151
- htmlhelp_basename = "moat.kv-doc"
152
-
153
-
154
- # -- Options for LaTeX output ---------------------------------------------
155
-
156
- latex_elements = {
157
- # The paper size ('letterpaper' or 'a4paper').
158
- #
159
- # 'papersize': 'letterpaper',
160
- # The font size ('10pt', '11pt' or '12pt').
161
- #
162
- # 'pointsize': '10pt',
163
- # Additional stuff for the LaTeX preamble.
164
- #
165
- # 'preamble': '',
166
- # Latex figure (float) alignment
167
- #
168
- # 'figure_align': 'htbp',
169
- }
170
-
171
- # Grouping the document tree into LaTeX files. List of tuples
172
- # (source start file, target name, title,
173
- # author, documentclass [howto, manual, or own class]).
174
- latex_documents = [
175
- (master_doc, "moat.kv.tex", "Trio Documentation", author, "manual"),
176
- ]
177
-
178
-
179
- # -- Options for manual page output ---------------------------------------
180
-
181
- # One entry per manual page. List of tuples
182
- # (source start file, name, description, authors, manual section).
183
- man_pages = [(master_doc, "moat.kv", "MoaT-KV Documentation", [author], 1)]
184
-
185
-
186
- # -- Options for Texinfo output -------------------------------------------
187
-
188
- # Grouping the document tree into Texinfo files. List of tuples
189
- # (source start file, target name, title, author,
190
- # dir menu entry, description, category)
191
- texinfo_documents = [
192
- (
193
- master_doc,
194
- "moat.kv",
195
- "MoaT-KV Documentation",
196
- author,
197
- "MoaT-KV",
198
- "A distributed no-master key-value store",
199
- "Miscellaneous",
200
- ),
201
- ]