drb 2.3.2__tar.gz → 2.3.4__tar.gz
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.
- {drb-2.3.2/drb.egg-info → drb-2.3.4}/PKG-INFO +1 -1
- {drb-2.3.2 → drb-2.3.4}/drb/core/_version.py +3 -3
- {drb-2.3.2 → drb-2.3.4}/drb/nodes/abstract_node.py +23 -0
- {drb-2.3.2 → drb-2.3.4}/drb/topics/resolver.py +6 -0
- {drb-2.3.2 → drb-2.3.4}/drb/xquery/drb_xquery_visitor.py +42 -0
- {drb-2.3.2 → drb-2.3.4/drb.egg-info}/PKG-INFO +1 -1
- {drb-2.3.2 → drb-2.3.4}/drb.egg-info/SOURCES.txt +1 -0
- drb-2.3.4/tests/test_children_unresolved.py +62 -0
- {drb-2.3.2 → drb-2.3.4}/LICENCE.txt +0 -0
- {drb-2.3.2 → drb-2.3.4}/MANIFEST.in +0 -0
- {drb-2.3.2 → drb-2.3.4}/README.md +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/addons/addon.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/core/__init__.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/core/cortex_validator.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/core/events.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/core/factory.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/core/impls.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/core/item.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/core/node.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/core/path.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/core/predicate.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/core/signature.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/drivers/file/__init__.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/drivers/file/file.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/drivers/xml/__init__.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/drivers/xml/factory.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/drivers/xml/node.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/exceptions/core.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/exceptions/file.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/keyring/bitwarden/__init__.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/keyring/bitwarden/bitwarden.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/nodes/logical_node.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/nodes/mutable_node.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/nodes/url_node.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/signatures/core.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/signatures/xquery.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/topics/dao/__init__.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/topics/dao/manager_dao.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/topics/dao/rdf_dao.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/topics/dao/topic_dao.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/topics/dao/topic_schema.yml +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/topics/dao/xml_dao.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/topics/dao/yaml_dao.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/topics/file/__init__.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/topics/file/cortex.yml +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/topics/topic.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/topics/xml/__init__.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/topics/xml/cortex.yml +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/utils/__init__.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/utils/drb_python_script.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/utils/plugins.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/utils/url_security.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/utils/utils.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/xquery/XQueryLexer.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/xquery/XQueryParser.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/xquery/XQueryParserListener.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/xquery/XQueryParserVisitor.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/xquery/__init__.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/xquery/drb_xquery.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/xquery/drb_xquery_cmd.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/xquery/drb_xquery_context.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/xquery/drb_xquery_func.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/xquery/drb_xquery_item.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/xquery/drb_xquery_res_to_string.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/xquery/drb_xquery_utils.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/xquery/drb_xquery_variable.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb/xquery/exceptions.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb.egg-info/dependency_links.txt +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb.egg-info/entry_points.txt +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb.egg-info/not-zip-safe +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb.egg-info/requires.txt +0 -0
- {drb-2.3.2 → drb-2.3.4}/drb.egg-info/top_level.txt +0 -0
- {drb-2.3.2 → drb-2.3.4}/pyproject.toml +0 -0
- {drb-2.3.2 → drb-2.3.4}/requirements.txt +0 -0
- {drb-2.3.2 → drb-2.3.4}/setup.cfg +0 -0
- {drb-2.3.2 → drb-2.3.4}/setup.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/tests/test_abstract_node.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/tests/test_addon.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/tests/test_drb_node_list.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/tests/test_drb_python_script.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/tests/test_event.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/tests/test_factory.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/tests/test_factory_resolver.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/tests/test_implementation_manager.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/tests/test_keyring_bitwarden.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/tests/test_logical_node.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/tests/test_manager_dao.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/tests/test_node_descendant.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/tests/test_path.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/tests/test_rdf_dao.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/tests/test_rdf_dao_multi_url.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/tests/test_signatures.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/tests/test_topic.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/tests/test_url_node.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/tests/test_url_security.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/tests/test_xml_dao.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/tests/test_yaml_dao.py +0 -0
- {drb-2.3.2 → drb-2.3.4}/versioneer.py +0 -0
|
@@ -8,11 +8,11 @@ import json
|
|
|
8
8
|
|
|
9
9
|
version_json = '''
|
|
10
10
|
{
|
|
11
|
-
"date": "2026-06-
|
|
11
|
+
"date": "2026-06-19T11:01:35+0000",
|
|
12
12
|
"dirty": false,
|
|
13
13
|
"error": null,
|
|
14
|
-
"full-revisionid": "
|
|
15
|
-
"version": "2.3.
|
|
14
|
+
"full-revisionid": "ad5712117cb18c0a99fbddcf98e59256eafd435e",
|
|
15
|
+
"version": "2.3.4"
|
|
16
16
|
}
|
|
17
17
|
''' # END VERSION_JSON
|
|
18
18
|
|
|
@@ -61,6 +61,29 @@ class AbstractNode(DrbNode, abc.ABC):
|
|
|
61
61
|
return DrbNodeList(children)
|
|
62
62
|
raise TypeError(f"{type(item)} type not supported.")
|
|
63
63
|
|
|
64
|
+
@property
|
|
65
|
+
def children_unresolved(self) -> List[DrbNode]:
|
|
66
|
+
"""Direct children without topic resolution of each child.
|
|
67
|
+
|
|
68
|
+
``children`` (and bracket browsing) resolve every child to its
|
|
69
|
+
topic-specific node, so a recursive walk descends into the *content*
|
|
70
|
+
of each file (e.g. the XML element tree of a metadata file inside an
|
|
71
|
+
archive), which can dwarf the container's own structure. This
|
|
72
|
+
accessor returns the children as produced by the node itself, so a
|
|
73
|
+
structural traversal stays within the container (TICKET-003):
|
|
74
|
+
|
|
75
|
+
def walk(n):
|
|
76
|
+
return 1 + sum(walk(c) for c in n.children_unresolved)
|
|
77
|
+
|
|
78
|
+
Returns:
|
|
79
|
+
list: the unresolved direct children.
|
|
80
|
+
"""
|
|
81
|
+
from drb.topics.resolver import DrbNodeList
|
|
82
|
+
children = self._browse_children()
|
|
83
|
+
if isinstance(children, DrbNodeList):
|
|
84
|
+
return children.unresolved
|
|
85
|
+
return list(children)
|
|
86
|
+
|
|
64
87
|
def descendant(self, path: str) -> DrbNode:
|
|
65
88
|
"""Navigate to a descendant node by a relative path.
|
|
66
89
|
|
|
@@ -301,6 +301,12 @@ class DrbNodeList(list):
|
|
|
301
301
|
super(DrbNodeList, self).__init__()
|
|
302
302
|
self._list: List[DrbNode] = children
|
|
303
303
|
|
|
304
|
+
@property
|
|
305
|
+
def unresolved(self) -> List[DrbNode]:
|
|
306
|
+
"""The backing children as produced by the node, without resolving
|
|
307
|
+
each one to its topic-specific type."""
|
|
308
|
+
return list(self._list)
|
|
309
|
+
|
|
304
310
|
@staticmethod
|
|
305
311
|
def __resolve_node(node: DrbNode):
|
|
306
312
|
try:
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import re
|
|
2
|
+
|
|
1
3
|
from antlr4 import InputStream, CommonTokenStream
|
|
2
4
|
from antlr4.error.ErrorListener import ErrorListener
|
|
3
5
|
from antlr4.tree.Tree import TerminalNodeImpl
|
|
@@ -1351,6 +1353,16 @@ class DrbQueryVisitor(XQueryParserVisitor):
|
|
|
1351
1353
|
elif exp.getText() == '//':
|
|
1352
1354
|
step_nav = NavigationStep.DESCENDANT_OR_SELF
|
|
1353
1355
|
elif isinstance(exp, XQueryParser.StepExprContext):
|
|
1356
|
+
# A path step whose whole text is digits is parsed as a numeric
|
|
1357
|
+
# literal because an NCName cannot start with a digit; in
|
|
1358
|
+
# path-step position it is a name test (e.g. /2026/01/15).
|
|
1359
|
+
# Resolve it as such (TICKET-006).
|
|
1360
|
+
if re.fullmatch(r'\d+', exp.getText()):
|
|
1361
|
+
self.list_context = self._numeric_name_step(
|
|
1362
|
+
exp.getText(), step_nav)
|
|
1363
|
+
result = self.list_context
|
|
1364
|
+
continue
|
|
1365
|
+
|
|
1354
1366
|
result = []
|
|
1355
1367
|
index = 0
|
|
1356
1368
|
for node in self.list_context:
|
|
@@ -1373,6 +1385,36 @@ class DrbQueryVisitor(XQueryParserVisitor):
|
|
|
1373
1385
|
self.list_context = result
|
|
1374
1386
|
return result
|
|
1375
1387
|
|
|
1388
|
+
def _numeric_name_step(self, name, step_nav):
|
|
1389
|
+
"""Resolve a numeric path step as a name test (TICKET-006).
|
|
1390
|
+
|
|
1391
|
+
Selects, from the current context, the children named exactly
|
|
1392
|
+
``name`` (CHILD navigation) or any such descendant ('//' navigation).
|
|
1393
|
+
"""
|
|
1394
|
+
result = []
|
|
1395
|
+
for ctx_node in self.list_context:
|
|
1396
|
+
node = ctx_node.node \
|
|
1397
|
+
if isinstance(ctx_node, DynamicContext) else ctx_node
|
|
1398
|
+
if not isinstance(node, DrbNode):
|
|
1399
|
+
continue
|
|
1400
|
+
if step_nav == NavigationStep.DESCENDANT_OR_SELF:
|
|
1401
|
+
candidates = self._all_descendants(node)
|
|
1402
|
+
else:
|
|
1403
|
+
candidates = node._browse_children()
|
|
1404
|
+
for child in candidates:
|
|
1405
|
+
if child.name == name:
|
|
1406
|
+
result.append(DynamicContext(
|
|
1407
|
+
child, position=len(result) + 1))
|
|
1408
|
+
return result
|
|
1409
|
+
|
|
1410
|
+
@staticmethod
|
|
1411
|
+
def _all_descendants(node):
|
|
1412
|
+
result = []
|
|
1413
|
+
for child in node._browse_children():
|
|
1414
|
+
result.append(child)
|
|
1415
|
+
result.extend(DrbQueryVisitor._all_descendants(child))
|
|
1416
|
+
return result
|
|
1417
|
+
|
|
1376
1418
|
# Visit a parse tree produced by XQueryParser#enclosedContentExpr.
|
|
1377
1419
|
|
|
1378
1420
|
def visitEnclosedExpression(self,
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
|
|
3
|
+
from drb.nodes.abstract_node import AbstractNode
|
|
4
|
+
from drb.nodes.logical_node import DrbLogicalNode
|
|
5
|
+
from drb.topics.resolver import DrbNodeList
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class _StubContainer(AbstractNode):
|
|
9
|
+
"""Node whose children are wrapped in a DrbNodeList, like a driver
|
|
10
|
+
using @resolve_children."""
|
|
11
|
+
|
|
12
|
+
def __init__(self, name, raw_children):
|
|
13
|
+
super().__init__()
|
|
14
|
+
self.name = name
|
|
15
|
+
self._raw = raw_children
|
|
16
|
+
|
|
17
|
+
@property
|
|
18
|
+
def children(self):
|
|
19
|
+
return DrbNodeList(self._raw)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class TestChildrenUnresolved(unittest.TestCase):
|
|
23
|
+
"""Structural (non-resolving) child access (TICKET-003)."""
|
|
24
|
+
|
|
25
|
+
def test_node_list_unresolved_returns_backing(self):
|
|
26
|
+
a, b = DrbLogicalNode('a'), DrbLogicalNode('b')
|
|
27
|
+
nl = DrbNodeList([a, b])
|
|
28
|
+
self.assertEqual([a, b], nl.unresolved)
|
|
29
|
+
# The backing objects are returned as-is (no resolution attempted).
|
|
30
|
+
self.assertIs(a, nl.unresolved[0])
|
|
31
|
+
|
|
32
|
+
def test_children_unresolved_bypasses_resolution(self):
|
|
33
|
+
a, b = DrbLogicalNode('a.xml'), DrbLogicalNode('b.zip')
|
|
34
|
+
stub = _StubContainer('c', [a, b])
|
|
35
|
+
unresolved = stub.children_unresolved
|
|
36
|
+
self.assertEqual(['a.xml', 'b.zip'], [n.name for n in unresolved])
|
|
37
|
+
# Same raw objects as provided, untouched by the resolver.
|
|
38
|
+
self.assertIs(a, unresolved[0])
|
|
39
|
+
self.assertIs(b, unresolved[1])
|
|
40
|
+
|
|
41
|
+
def test_children_unresolved_on_plain_list_node(self):
|
|
42
|
+
root = DrbLogicalNode('root')
|
|
43
|
+
root.append_child(DrbLogicalNode('child'))
|
|
44
|
+
self.assertEqual(['child'],
|
|
45
|
+
[n.name for n in root.children_unresolved])
|
|
46
|
+
|
|
47
|
+
def test_structural_walk_is_bounded(self):
|
|
48
|
+
# A small tree; walking via children_unresolved counts every node
|
|
49
|
+
# exactly once without descending into any resolved content.
|
|
50
|
+
root = DrbLogicalNode('root')
|
|
51
|
+
sub = DrbLogicalNode('sub')
|
|
52
|
+
sub.append_child(DrbLogicalNode('leaf'))
|
|
53
|
+
root.append_child(sub)
|
|
54
|
+
|
|
55
|
+
def walk(n):
|
|
56
|
+
return 1 + sum(walk(c) for c in n.children_unresolved)
|
|
57
|
+
|
|
58
|
+
self.assertEqual(3, walk(root))
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
if __name__ == '__main__':
|
|
62
|
+
unittest.main()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{drb-2.3.2 → drb-2.3.4}/setup.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|