elementpath 5.0.4__tar.gz → 5.1.1__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.
Files changed (151) hide show
  1. {elementpath-5.0.4 → elementpath-5.1.1}/CHANGELOG.rst +14 -0
  2. {elementpath-5.0.4 → elementpath-5.1.1}/LICENSE +1 -1
  3. {elementpath-5.0.4/elementpath.egg-info → elementpath-5.1.1}/PKG-INFO +6 -8
  4. {elementpath-5.0.4 → elementpath-5.1.1}/README.rst +1 -3
  5. {elementpath-5.0.4 → elementpath-5.1.1}/doc/advanced.rst +23 -0
  6. {elementpath-5.0.4 → elementpath-5.1.1}/doc/conf.py +3 -3
  7. {elementpath-5.0.4 → elementpath-5.1.1}/doc/xpath_api.rst +101 -0
  8. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/__init__.py +9 -8
  9. elementpath-5.1.1/elementpath/aliases.py +130 -0
  10. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/collations.py +1 -1
  11. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/compare.py +10 -12
  12. elementpath-5.1.1/elementpath/datatypes/__init__.py +53 -0
  13. elementpath-5.1.1/elementpath/datatypes/any_types.py +162 -0
  14. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/datatypes/binary.py +51 -34
  15. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/datatypes/datetime.py +555 -285
  16. elementpath-5.1.1/elementpath/datatypes/lists.py +99 -0
  17. elementpath-5.1.1/elementpath/datatypes/numeric.py +267 -0
  18. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/datatypes/proxies.py +89 -44
  19. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/datatypes/qname.py +43 -10
  20. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/datatypes/string.py +15 -10
  21. elementpath-5.1.1/elementpath/datatypes/untyped.py +171 -0
  22. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/datatypes/uri.py +28 -27
  23. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/decoder.py +19 -12
  24. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/etree.py +1 -1
  25. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/exceptions.py +1 -1
  26. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/extras/pathnodes.py +4 -4
  27. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/helpers.py +106 -55
  28. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/namespaces.py +2 -1
  29. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/protocols.py +12 -10
  30. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/regex/__init__.py +1 -1
  31. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/regex/categories_fallback.py +1 -1
  32. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/regex/character_classes.py +1 -1
  33. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/regex/codepoints.py +1 -1
  34. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/regex/patterns.py +1 -1
  35. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/regex/unicode_blocks.py +12 -1
  36. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/regex/unicode_categories.py +520 -503
  37. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/regex/unicode_subsets.py +1 -1
  38. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/schema_proxy.py +3 -4
  39. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/sequence_types.py +126 -87
  40. elementpath-5.1.1/elementpath/sequences.py +238 -0
  41. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/serialization.py +5 -5
  42. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/tdop.py +43 -31
  43. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/tree_builders.py +15 -16
  44. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/validators/__init__.py +1 -1
  45. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/xpath1/__init__.py +1 -1
  46. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/xpath1/_xpath1_axes.py +33 -30
  47. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/xpath1/_xpath1_functions.py +44 -45
  48. elementpath-5.1.1/elementpath/xpath1/_xpath1_operators.py +444 -0
  49. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/xpath1/xpath1_parser.py +59 -35
  50. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/xpath2/__init__.py +1 -1
  51. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/xpath2/_xpath2_constructors.py +194 -282
  52. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/xpath2/_xpath2_functions.py +193 -202
  53. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/xpath2/_xpath2_operators.py +100 -147
  54. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/xpath2/xpath2_parser.py +126 -216
  55. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/xpath3.py +1 -1
  56. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/xpath30/__init__.py +1 -1
  57. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/xpath30/_translation_maps.py +1 -1
  58. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/xpath30/_xpath30_functions.py +115 -241
  59. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/xpath30/_xpath30_operators.py +30 -28
  60. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/xpath30/xpath30_helpers.py +1 -1
  61. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/xpath30/xpath30_parser.py +1 -1
  62. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/xpath31/__init__.py +1 -1
  63. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/xpath31/_xpath31_functions.py +85 -81
  64. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/xpath31/_xpath31_operators.py +31 -29
  65. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/xpath31/xpath31_parser.py +4 -5
  66. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/xpath_context.py +64 -93
  67. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/xpath_nodes.py +148 -168
  68. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/xpath_selectors.py +7 -8
  69. elementpath-5.1.1/elementpath/xpath_tokens/__init__.py +78 -0
  70. elementpath-5.1.1/elementpath/xpath_tokens/arrays.py +160 -0
  71. elementpath-5.1.1/elementpath/xpath_tokens/axes.py +56 -0
  72. elementpath-5.1.1/elementpath/xpath_tokens/base.py +953 -0
  73. elementpath-5.1.1/elementpath/xpath_tokens/contructors.py +102 -0
  74. elementpath-5.1.1/elementpath/xpath_tokens/functions.py +424 -0
  75. elementpath-5.1.1/elementpath/xpath_tokens/maps.py +259 -0
  76. elementpath-5.1.1/elementpath/xpath_tokens/tokens.py +500 -0
  77. {elementpath-5.0.4 → elementpath-5.1.1/elementpath.egg-info}/PKG-INFO +6 -8
  78. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath.egg-info/SOURCES.txt +12 -2
  79. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath.egg-info/requires.txt +4 -2
  80. {elementpath-5.0.4 → elementpath-5.1.1}/pyproject.toml +5 -5
  81. elementpath-5.1.1/requirements-dev.txt +3 -0
  82. {elementpath-5.0.4 → elementpath-5.1.1}/scripts/generate_codepoints.py +3 -2
  83. {elementpath-5.0.4 → elementpath-5.1.1}/tests/memory_profiling.py +1 -1
  84. {elementpath-5.0.4 → elementpath-5.1.1}/tests/mypy_tests/advanced.py +2 -1
  85. {elementpath-5.0.4 → elementpath-5.1.1}/tests/run_all_tests.py +1 -1
  86. {elementpath-5.0.4 → elementpath-5.1.1}/tests/run_typing_tests.py +1 -1
  87. {elementpath-5.0.4 → elementpath-5.1.1}/tests/run_w3c_tests.py +18 -15
  88. {elementpath-5.0.4 → elementpath-5.1.1}/tests/test_collations.py +1 -1
  89. {elementpath-5.0.4 → elementpath-5.1.1}/tests/test_compare.py +5 -5
  90. {elementpath-5.0.4 → elementpath-5.1.1}/tests/test_datatypes.py +107 -96
  91. {elementpath-5.0.4 → elementpath-5.1.1}/tests/test_decoder.py +1 -1
  92. {elementpath-5.0.4 → elementpath-5.1.1}/tests/test_etree.py +7 -7
  93. {elementpath-5.0.4 → elementpath-5.1.1}/tests/test_exceptions.py +1 -1
  94. {elementpath-5.0.4 → elementpath-5.1.1}/tests/test_helpers.py +8 -16
  95. {elementpath-5.0.4 → elementpath-5.1.1}/tests/test_namespaces.py +1 -1
  96. {elementpath-5.0.4 → elementpath-5.1.1}/tests/test_package.py +27 -1
  97. {elementpath-5.0.4 → elementpath-5.1.1}/tests/test_pathnodes.py +1 -1
  98. {elementpath-5.0.4 → elementpath-5.1.1}/tests/test_regex.py +64 -64
  99. {elementpath-5.0.4 → elementpath-5.1.1}/tests/test_schema_context.py +20 -20
  100. {elementpath-5.0.4 → elementpath-5.1.1}/tests/test_schema_proxy.py +1 -1
  101. {elementpath-5.0.4 → elementpath-5.1.1}/tests/test_selectors.py +22 -22
  102. {elementpath-5.0.4 → elementpath-5.1.1}/tests/test_sequence_types.py +10 -9
  103. elementpath-5.1.1/tests/test_sequences.py +153 -0
  104. {elementpath-5.0.4 → elementpath-5.1.1}/tests/test_serialization.py +10 -6
  105. {elementpath-5.0.4 → elementpath-5.1.1}/tests/test_tdop_parser.py +35 -32
  106. {elementpath-5.0.4 → elementpath-5.1.1}/tests/test_tree_builders.py +1 -1
  107. {elementpath-5.0.4 → elementpath-5.1.1}/tests/test_validators.py +1 -1
  108. {elementpath-5.0.4 → elementpath-5.1.1}/tests/test_xpath1_parser.py +14 -17
  109. {elementpath-5.0.4 → elementpath-5.1.1}/tests/test_xpath2_constructors.py +15 -15
  110. {elementpath-5.0.4 → elementpath-5.1.1}/tests/test_xpath2_functions.py +9 -9
  111. {elementpath-5.0.4 → elementpath-5.1.1}/tests/test_xpath2_parser.py +85 -34
  112. {elementpath-5.0.4 → elementpath-5.1.1}/tests/test_xpath30.py +42 -42
  113. {elementpath-5.0.4 → elementpath-5.1.1}/tests/test_xpath31.py +57 -52
  114. {elementpath-5.0.4 → elementpath-5.1.1}/tests/test_xpath_context.py +84 -84
  115. {elementpath-5.0.4 → elementpath-5.1.1}/tests/test_xpath_nodes.py +19 -19
  116. {elementpath-5.0.4 → elementpath-5.1.1}/tests/test_xpath_tokens.py +23 -24
  117. {elementpath-5.0.4 → elementpath-5.1.1}/tests/xpath_test_class.py +20 -14
  118. {elementpath-5.0.4 → elementpath-5.1.1}/tox.ini +21 -18
  119. elementpath-5.0.4/elementpath/aliases.py +0 -42
  120. elementpath-5.0.4/elementpath/datatypes/__init__.py +0 -52
  121. elementpath-5.0.4/elementpath/datatypes/atomic_types.py +0 -105
  122. elementpath-5.0.4/elementpath/datatypes/numeric.py +0 -243
  123. elementpath-5.0.4/elementpath/datatypes/untyped.py +0 -149
  124. elementpath-5.0.4/elementpath/xpath1/_xpath1_operators.py +0 -781
  125. elementpath-5.0.4/elementpath/xpath_tokens.py +0 -1843
  126. elementpath-5.0.4/requirements-dev.txt +0 -13
  127. {elementpath-5.0.4 → elementpath-5.1.1}/MANIFEST.in +0 -0
  128. {elementpath-5.0.4 → elementpath-5.1.1}/doc/Makefile +0 -0
  129. {elementpath-5.0.4 → elementpath-5.1.1}/doc/index.rst +0 -0
  130. {elementpath-5.0.4 → elementpath-5.1.1}/doc/introduction.rst +0 -0
  131. {elementpath-5.0.4 → elementpath-5.1.1}/doc/make.bat +0 -0
  132. {elementpath-5.0.4 → elementpath-5.1.1}/doc/pratt_api.rst +0 -0
  133. {elementpath-5.0.4 → elementpath-5.1.1}/doc/requirements.txt +0 -0
  134. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/extras/__init__.py +0 -0
  135. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/py.typed +0 -0
  136. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/validators/analyze-string.xsd +0 -0
  137. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath/validators/schema-for-json.xsd +0 -0
  138. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath.egg-info/dependency_links.txt +0 -0
  139. {elementpath-5.0.4 → elementpath-5.1.1}/elementpath.egg-info/top_level.txt +0 -0
  140. {elementpath-5.0.4 → elementpath-5.1.1}/setup.cfg +0 -0
  141. {elementpath-5.0.4 → elementpath-5.1.1}/tests/__init__.py +0 -0
  142. {elementpath-5.0.4 → elementpath-5.1.1}/tests/mypy_tests/protocols.py +0 -0
  143. {elementpath-5.0.4 → elementpath-5.1.1}/tests/mypy_tests/selectors.py +0 -0
  144. {elementpath-5.0.4 → elementpath-5.1.1}/tests/resources/analyze-string.xsd +0 -0
  145. {elementpath-5.0.4 → elementpath-5.1.1}/tests/resources/external_entity.xml +0 -0
  146. {elementpath-5.0.4 → elementpath-5.1.1}/tests/resources/sample.xml +0 -0
  147. {elementpath-5.0.4 → elementpath-5.1.1}/tests/resources/schema-for-json.xsd +0 -0
  148. {elementpath-5.0.4 → elementpath-5.1.1}/tests/resources/unparsed_entity.xml +0 -0
  149. {elementpath-5.0.4 → elementpath-5.1.1}/tests/resources/unused_external_entity.xml +0 -0
  150. {elementpath-5.0.4 → elementpath-5.1.1}/tests/resources/unused_unparsed_entity.xml +0 -0
  151. {elementpath-5.0.4 → elementpath-5.1.1}/tests/resources/with_entity.xml +0 -0
@@ -2,6 +2,18 @@
2
2
  CHANGELOG
3
3
  *********
4
4
 
5
+ `v5.1.1`_ (2026-01-20)
6
+ ======================
7
+ * Fix external function registrations (issue #099)
8
+ * Add ExternalFunction and SchemaConstructor token classes
9
+
10
+ `v5.1.0`_ (2025-12-28)
11
+ ======================
12
+ * Drop Python 3.9 compatibility and add Pyton 3.15 support
13
+ * Improve XPath sequence internal processing with a list derived type `xlist'
14
+ * Extensions and fixes for XSD datatypes
15
+ * Add `XSequence` datatype for external representation of XPath sequences
16
+
5
17
  `v5.0.4`_ (2025-08-16)
6
18
  ======================
7
19
  * Fix default/fixed values processing of schema annotated XML data (issue #94)
@@ -523,3 +535,5 @@ CHANGELOG
523
535
  .. _v5.0.2: https://github.com/sissaschool/elementpath/compare/v5.0.1...v5.0.2
524
536
  .. _v5.0.3: https://github.com/sissaschool/elementpath/compare/v5.0.2...v5.0.3
525
537
  .. _v5.0.4: https://github.com/sissaschool/elementpath/compare/v5.0.3...v5.0.4
538
+ .. _v5.1.0: https://github.com/sissaschool/elementpath/compare/v5.0.4...v5.1.0
539
+ .. _v5.1.1: https://github.com/sissaschool/elementpath/compare/v5.1.0...v5.1.1
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c), 2018-2021, SISSA (Scuola Internazionale Superiore di Studi Avanzati)
3
+ Copyright (c), 2018-2026, SISSA (Scuola Internazionale Superiore di Studi Avanzati)
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: elementpath
3
- Version: 5.0.4
3
+ Version: 5.1.1
4
4
  Summary: XPath 1.0/2.0/3.0/3.1 parsers and selectors for ElementTree and lxml
5
5
  Author-email: Davide Brunato <brunato@sissa.it>
6
6
  License-Expression: MIT
@@ -13,17 +13,17 @@ Classifier: Operating System :: OS Independent
13
13
  Classifier: Programming Language :: Python
14
14
  Classifier: Programming Language :: Python :: 3
15
15
  Classifier: Programming Language :: Python :: 3 :: Only
16
- Classifier: Programming Language :: Python :: 3.9
17
16
  Classifier: Programming Language :: Python :: 3.10
18
17
  Classifier: Programming Language :: Python :: 3.11
19
18
  Classifier: Programming Language :: Python :: 3.12
20
19
  Classifier: Programming Language :: Python :: 3.13
21
20
  Classifier: Programming Language :: Python :: 3.14
21
+ Classifier: Programming Language :: Python :: 3.15
22
22
  Classifier: Programming Language :: Python :: Implementation :: CPython
23
23
  Classifier: Programming Language :: Python :: Implementation :: PyPy
24
24
  Classifier: Topic :: Software Development :: Libraries
25
25
  Classifier: Topic :: Text Processing :: Markup :: XML
26
- Requires-Python: >=3.9
26
+ Requires-Python: >=3.10
27
27
  Description-Content-Type: text/x-rst
28
28
  License-File: LICENSE
29
29
  Provides-Extra: dev
@@ -31,11 +31,11 @@ Requires-Dist: coverage; extra == "dev"
31
31
  Requires-Dist: flake8; extra == "dev"
32
32
  Requires-Dist: lxml; extra == "dev"
33
33
  Requires-Dist: lxml-stubs; extra == "dev"
34
- Requires-Dist: memray; extra == "dev"
34
+ Requires-Dist: memray; platform_python_implementation != "PyPy" and extra == "dev"
35
35
  Requires-Dist: mypy; extra == "dev"
36
36
  Requires-Dist: psutil; extra == "dev"
37
37
  Requires-Dist: sphinx; extra == "dev"
38
- Requires-Dist: tox; extra == "dev"
38
+ Requires-Dist: tox>=4.0; extra == "dev"
39
39
  Requires-Dist: xmlschema>=4.0.1; extra == "dev"
40
40
  Provides-Extra: docs
41
41
  Requires-Dist: sphinx; extra == "docs"
@@ -55,8 +55,6 @@ elementpath
55
55
  .. image:: https://img.shields.io/badge/License-MIT-blue.svg
56
56
  :alt: MIT License
57
57
  :target: https://lbesson.mit-license.org/
58
- .. image:: https://img.shields.io/pypi/dm/elementpath.svg
59
- :target: https://pypi.python.org/pypi/elementpath/
60
58
 
61
59
  .. elementpath-introduction
62
60
 
@@ -72,7 +70,7 @@ has it's own implementation of XPath 1.0.
72
70
  Installation and usage
73
71
  ======================
74
72
 
75
- You can install the package with *pip* in a Python 3.9+ environment::
73
+ You can install the package with *pip* in a Python 3.10+ environment::
76
74
 
77
75
  pip install elementpath
78
76
 
@@ -11,8 +11,6 @@ elementpath
11
11
  .. image:: https://img.shields.io/badge/License-MIT-blue.svg
12
12
  :alt: MIT License
13
13
  :target: https://lbesson.mit-license.org/
14
- .. image:: https://img.shields.io/pypi/dm/elementpath.svg
15
- :target: https://pypi.python.org/pypi/elementpath/
16
14
 
17
15
  .. elementpath-introduction
18
16
 
@@ -28,7 +26,7 @@ has it's own implementation of XPath 1.0.
28
26
  Installation and usage
29
27
  ======================
30
28
 
31
- You can install the package with *pip* in a Python 3.9+ environment::
29
+ You can install the package with *pip* in a Python 3.10+ environment::
32
30
 
33
31
  pip install elementpath
34
32
 
@@ -80,6 +80,10 @@ represented by *XPathContext* objects.
80
80
  >>> token.evaluate(context)
81
81
  [EtreeElementNode(elem=<Element 'child' at ...)]
82
82
 
83
+ .. note::
84
+ Since release v4.2.0 the *root* is optional. If the argument *root* is absent
85
+ the argument *item* is mandatory and the dynamic context remain without a root.
86
+
83
87
  In this case an error is raised if you don't provide a context:
84
88
 
85
89
  .. doctest::
@@ -97,10 +101,15 @@ Expressions that not depend on XML data can be evaluated also without a context:
97
101
  >>> token.evaluate()
98
102
  'foo bar'
99
103
 
104
+ .. note::
105
+ Since release v4.2.0 the *root* is optional. If the argument *root* is absent
106
+ the argument *item* is mandatory and the dynamic context remain without a root.
107
+
100
108
  For more details on parsing and evaluation of XPath expressions see the
101
109
  `XPath processing model <https://www.w3.org/TR/xpath-3/#id-processing-model>`_.
102
110
 
103
111
 
112
+
104
113
  Node trees
105
114
  ==========
106
115
 
@@ -201,6 +210,20 @@ to restrict the scope to a subtree.
201
210
 
202
211
  The context *item* can be set with an XPath node, an atomic value or an XPath function.
203
212
 
213
+ .. note::
214
+ With XPath 4.0 the context *item* will be generalized as a context *value*, that
215
+ can be set with a sequence of items. On this way the
216
+
217
+ The data returned by dynamic evaluation can be a atomic value, a node or a function.
218
+ Also sequence of items can be returned. Until now these sequences were represented
219
+ using lists, but soon with XPath 4.0 an XPath sequence will be applicable also to
220
+ single results as *context value*, so for internal processing and by low-le
221
+ Soon, with
222
+
223
+
224
+ Since release v4.2.0 the *root* is optional. If the argument *root* is absent
225
+ the argument *item* is mandatory and the dynamic context remain without a root.
226
+
204
227
  .. note::
205
228
  Since release v4.2.0 the *root* is optional. If the argument *root* is absent
206
229
  the argument *item* is mandatory and the dynamic context remain without a root.
@@ -25,13 +25,13 @@ sys.path.insert(0, os.path.abspath('..'))
25
25
  # -- Project information -----------------------------------------------------
26
26
 
27
27
  project = 'elementpath'
28
- copyright = '2018-2025, SISSA (International School for Advanced Studies)'
28
+ copyright = '2018-2026, SISSA (International School for Advanced Studies)'
29
29
  author = 'Davide Brunato'
30
30
 
31
31
  # The short X.Y version
32
- version = '5.0'
32
+ version = '5.1'
33
33
  # The full version, including alpha/beta/rc tags
34
- release = '5.0.4'
34
+ release = '5.1.1'
35
35
 
36
36
  # -- General configuration ---------------------------------------------------
37
37
 
@@ -171,3 +171,104 @@ There are also other exceptions, multiple derived from the base exception
171
171
  .. autoexception:: elementpath.ElementPathTypeError
172
172
  .. autoexception:: elementpath.ElementPathValueError
173
173
  .. autoexception:: elementpath.ElementPathZeroDivisionError
174
+
175
+
176
+ XPath datatypes
177
+ ===============
178
+
179
+ XPath datatypes include XSD datatypes and other datatype specific for XPath, like untyped atomic
180
+ type and sequences.
181
+
182
+ XSD special types
183
+ -----------------
184
+ .. autoclass:: elementpath.datatypes.AnyType
185
+ .. autoclass:: elementpath.datatypes.AnySimpleType
186
+ .. autoclass:: elementpath.datatypes.AnyAtomicType
187
+
188
+ Proxy classes for primitive datatypes
189
+ -------------------------------------
190
+ .. automodule:: elementpath.datatypes.proxies
191
+ .. autoclass:: elementpath.datatypes.StringProxy
192
+ .. autoclass:: elementpath.datatypes.BooleanProxy
193
+ .. autoclass:: elementpath.datatypes.DecimalProxy
194
+ .. autoclass:: elementpath.datatypes.DoubleProxy
195
+
196
+ XPath specific types
197
+ --------------------
198
+ .. autoclass:: elementpath.datatypes.UntypedAtomic
199
+ .. autoclass:: elementpath.sequences.XSequence
200
+ .. autoclass:: elementpath.datatypes.ErrorProxy
201
+
202
+ Numeric types
203
+ -------------
204
+ .. autoclass:: elementpath.datatypes.Float
205
+ .. autoclass:: elementpath.datatypes.Integer
206
+ .. autoclass:: elementpath.datatypes.NonPositiveInteger
207
+ .. autoclass:: elementpath.datatypes.NegativeInteger
208
+ .. autoclass:: elementpath.datatypes.Long
209
+ .. autoclass:: elementpath.datatypes.Int
210
+ .. autoclass:: elementpath.datatypes.Short
211
+ .. autoclass:: elementpath.datatypes.Byte
212
+ .. autoclass:: elementpath.datatypes.NonNegativeInteger
213
+ .. autoclass:: elementpath.datatypes.PositiveInteger
214
+ .. autoclass:: elementpath.datatypes.UnsignedLong
215
+ .. autoclass:: elementpath.datatypes.UnsignedInt
216
+ .. autoclass:: elementpath.datatypes.UnsignedShort
217
+ .. autoclass:: elementpath.datatypes.UnsignedByte
218
+
219
+ String based types
220
+ ------------------
221
+ .. autoclass:: elementpath.datatypes.NormalizedString
222
+ .. autoclass:: elementpath.datatypes.XsdToken
223
+ .. autoclass:: elementpath.datatypes.Language
224
+ .. autoclass:: elementpath.datatypes.Name
225
+ .. autoclass:: elementpath.datatypes.NCName
226
+ .. autoclass:: elementpath.datatypes.Id
227
+ .. autoclass:: elementpath.datatypes.Idref
228
+ .. autoclass:: elementpath.datatypes.Entity
229
+ .. autoclass:: elementpath.datatypes.NMToken
230
+
231
+ List types
232
+ ----------
233
+ .. autoclass:: elementpath.datatypes.NMTokens
234
+ .. autoclass:: elementpath.datatypes.Idrefs
235
+ .. autoclass:: elementpath.datatypes.Entities
236
+
237
+ QName types
238
+ -----------
239
+ .. autoclass:: elementpath.datatypes.QName
240
+ .. autoclass:: elementpath.datatypes.Notation
241
+
242
+ Binary types
243
+ ------------
244
+ .. autoclass:: elementpath.datatypes.Base64Binary
245
+ .. autoclass:: elementpath.datatypes.HexBinary
246
+
247
+ URI types
248
+ ---------
249
+ .. autoclass:: elementpath.datatypes.AnyURI
250
+
251
+ Date and time types
252
+ -------------------
253
+ .. autoclass:: elementpath.datatypes.DateTime
254
+ .. autoclass:: elementpath.datatypes.DateTime10
255
+ .. autoclass:: elementpath.datatypes.DateTimeStamp
256
+ .. autoclass:: elementpath.datatypes.Date
257
+ .. autoclass:: elementpath.datatypes.Date10
258
+ .. autoclass:: elementpath.datatypes.GregorianDay
259
+ .. autoclass:: elementpath.datatypes.GregorianMonth
260
+ .. autoclass:: elementpath.datatypes.GregorianMonthDay
261
+ .. autoclass:: elementpath.datatypes.GregorianYear
262
+ .. autoclass:: elementpath.datatypes.GregorianYear10
263
+ .. autoclass:: elementpath.datatypes.GregorianYearMonth
264
+ .. autoclass:: elementpath.datatypes.GregorianYearMonth10
265
+ .. autoclass:: elementpath.datatypes.Time
266
+ .. autoclass:: elementpath.datatypes.Timezone
267
+
268
+ Duration types
269
+ --------------
270
+
271
+ .. autoclass:: elementpath.datatypes.Duration
272
+ .. autoclass:: elementpath.datatypes.YearMonthDuration
273
+ .. autoclass:: elementpath.datatypes.DayTimeDuration
274
+
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (c), 2018-2022, SISSA (International School for Advanced Studies).
2
+ # Copyright (c), 2018-2026, SISSA (International School for Advanced Studies).
3
3
  # All rights reserved.
4
4
  # This file is distributed under the terms of the MIT License.
5
5
  # See the file 'LICENSE' in the root directory of the present
@@ -7,10 +7,10 @@
7
7
  #
8
8
  # @author Davide Brunato <brunato@sissa.it>
9
9
  #
10
- __version__ = '5.0.4'
10
+ __version__ = '5.1.1'
11
11
  __author__ = "Davide Brunato"
12
12
  __contact__ = "brunato@sissa.it"
13
- __copyright__ = "Copyright 2018-2025, SISSA"
13
+ __copyright__ = "Copyright 2018-2026, SISSA"
14
14
  __license__ = "MIT"
15
15
  __status__ = "Production/Stable"
16
16
 
@@ -41,12 +41,13 @@ from .regex import RegexError, translate_pattern, install_unicode_data, unicode_
41
41
  __all__ = ['datatypes', 'protocols', 'etree', 'ElementPathError', 'MissingContextError',
42
42
  'UnsupportedFeatureError', 'ElementPathKeyError', 'ElementPathLocaleError',
43
43
  'ElementPathZeroDivisionError', 'ElementPathNameError',
44
- 'ElementPathOverflowError', 'ElementPathRuntimeError', 'ElementPathSyntaxError',
45
- 'ElementPathTypeError', 'ElementPathValueError', 'XPathContext',
46
- 'XPathSchemaContext', 'XPathNode', 'AttributeNode', 'NamespaceNode',
47
- 'CommentNode', 'ProcessingInstructionNode', 'TextNode', 'ElementNode',
44
+ 'ElementPathOverflowError', 'ElementPathRuntimeError',
45
+ 'ElementPathSyntaxError', 'ElementPathTypeError', 'ElementPathValueError',
46
+ 'XPathNode', 'AttributeNode', 'NamespaceNode', 'CommentNode',
47
+ 'ProcessingInstructionNode', 'TextNode', 'ElementNode',
48
48
  'LazyElementNode', 'SchemaElementNode', 'DocumentNode', 'get_node_tree',
49
- 'build_node_tree', 'build_lxml_node_tree', 'build_schema_node_tree', 'XPathToken',
49
+ 'build_node_tree', 'build_lxml_node_tree', 'build_schema_node_tree',
50
+ 'XPathContext', 'XPathSchemaContext', 'XPathToken',
50
51
  'XPathFunction', 'XPath1Parser', 'XPath2Parser', 'select', 'iter_select',
51
52
  'Selector', 'AbstractSchemaProxy', 'RegexError', 'translate_pattern',
52
53
  'install_unicode_data', 'unicode_version']
@@ -0,0 +1,130 @@
1
+ #
2
+ # Copyright (c), 2025-2026, SISSA (International School for Advanced Studies).
3
+ # All rights reserved.
4
+ # This file is distributed under the terms of the MIT License.
5
+ # See the file 'LICENSE' in the root directory of the present
6
+ # distribution, or http://opensource.org/licenses/MIT.
7
+ #
8
+ # @author Davide Brunato <brunato@sissa.it>
9
+ #
10
+ """Type annotation aliases for elementpath."""
11
+ from collections.abc import MutableMapping, Iterator
12
+ from decimal import Decimal
13
+ from typing import Any, Optional, NoReturn, TYPE_CHECKING, TypeVar, Union
14
+
15
+ if TYPE_CHECKING:
16
+ from .protocols import ElementProtocol, DocumentProtocol # noqa: F401
17
+ from .protocols import XsdElementProtocol, XsdAttributeProtocol # noqa: F401
18
+ from .protocols import DocumentType, ElementType, SchemaElemType # noqa: F401
19
+ from .datatypes import AnyAtomicType, AbstractDateTime, QName, AnyURI # noqa: F401
20
+ from .datatypes import Date, DateTime, Time, GregorianYear, GregorianMonth # noqa: F401
21
+ from .datatypes import GregorianDay, GregorianYearMonth, GregorianMonthDay # noqa: F401
22
+ from .datatypes import DateTimeStamp, Duration, UntypedAtomic # noqa: F401
23
+ from .datatypes import DayTimeDuration, YearMonthDuration # noqa: F401
24
+ from .schema_proxy import AbstractSchemaProxy # noqa: F401
25
+ from .xpath_nodes import XPathNode, ElementNode, AttributeNode # noqa: F401
26
+ from .xpath_nodes import TextNode, DocumentNode, NamespaceNode # noqa: F401
27
+ from .xpath_nodes import CommentNode, ProcessingInstructionNode # noqa: F401
28
+ from .xpath_tokens import XPathToken, XPathAxis, XPathFunction # noqa: F401
29
+ from .xpath_tokens import XPathConstructor, XPathMap, XPathArray # noqa: F401
30
+ from .xpath_context import XPathContext, XPathSchemaContext # noqa: F401
31
+ from .xpath1 import XPath1Parser # noqa: F401
32
+ from .xpath2 import XPath2Parser # noqa: F401
33
+ from .xpath30 import XPath30Parser # noqa: F401
34
+ from .xpath31 import XPath31Parser # noqa: F401
35
+
36
+ ###
37
+ # Namespace maps
38
+ NamespacesType = MutableMapping[str, str]
39
+ NsmapType = MutableMapping[Optional[str], str] # compatible with the nsmap of lxml Element
40
+ AnyNsmapType = Union[NamespacesType, NsmapType, None] # for composition and function arguments
41
+
42
+ ###
43
+ # Datatypes
44
+ NumericType = Union[int, float, Decimal]
45
+ DateTimeType = Union[
46
+ 'DateTime', 'Date', 'Time', 'GregorianYear', 'GregorianMonth',
47
+ 'GregorianDay', 'GregorianYearMonth', 'GregorianMonthDay'
48
+ ]
49
+ DurationType = Union['Duration', 'YearMonthDuration', 'DayTimeDuration']
50
+ ArithmeticType = Union[NumericType, DateTimeType, 'DurationType', 'UntypedAtomic']
51
+ AtomicType = Union['AnyAtomicType', str, bool, int, float, Decimal]
52
+
53
+ ###
54
+ # XPath nodes
55
+ TypedNodeType = Union['AttributeNode', 'ElementNode']
56
+ TaggedNodeType = Union['ElementNode', 'CommentNode', 'ProcessingInstructionNode']
57
+ ElementMapType = dict[object, TaggedNodeType]
58
+ FindAttrType = Optional['XsdAttributeProtocol']
59
+ FindElemType = Optional['XsdElementProtocol']
60
+ RootNodeType = Union['DocumentNode', 'ElementNode']
61
+
62
+ ParentNodeType = Union['DocumentNode', 'ElementNode']
63
+ ChildNodeType = Union['TextNode', TaggedNodeType]
64
+
65
+ # All possible variants for node as item
66
+ XPathNodeType = Union['XPathNode', 'DocumentNode', 'NamespaceNode', 'AttributeNode',
67
+ 'TextNode', 'ElementNode', 'CommentNode', 'ProcessingInstructionNode']
68
+
69
+ ###
70
+ # Sequence and item/value types (specifics and generics)
71
+ ItemType = Union['XPathNode', AtomicType, 'XPathFunction']
72
+
73
+ _T = TypeVar('_T', bound=ItemType)
74
+
75
+ OneOrEmpty = Union[_T, list[_T], list[NoReturn]]
76
+ OneOrMore = Union[_T, list[_T]]
77
+ AnyOrEmpty = Union[_T, list[_T], list[NoReturn]]
78
+
79
+ SequenceArgType = Union[
80
+ Iterator[_T], list[_T], list[NoReturn], tuple[_T, ...], tuple[_T], tuple[()]
81
+ ]
82
+
83
+ OneAtomicOrEmpty = OneOrEmpty[AtomicType]
84
+ OneNumericOrEmpty = OneOrEmpty[NumericType]
85
+ OneArithmeticOrEmpty = OneOrEmpty[ArithmeticType]
86
+ OneItemOrEmpty = OneOrEmpty[ItemType]
87
+
88
+ OneOrMoreAtomic = OneOrMore[AtomicType]
89
+ OneOrMoreNumeric = OneOrMore[NumericType]
90
+ OneOrMoreArithmetic = OneOrMore[ArithmeticType]
91
+ OneOrMoreItems = OneOrMore[ItemType]
92
+
93
+ AnyAtomicOrEmpty = AnyOrEmpty[AtomicType]
94
+ AnyNumericOrEmpty = AnyOrEmpty[NumericType]
95
+ AnyArithmeticOrEmpty = AnyOrEmpty[ArithmeticType]
96
+ AnyItemsOrEmpty = AnyOrEmpty[ItemType]
97
+
98
+ ValueType = Union[ItemType, list[ItemType], list[NoReturn], list['XPathNode'],
99
+ list[Union['AttributeNode', 'ElementNode']], list[AtomicType]]
100
+ ListItemType = Union[ItemType, list[ItemType], list[NoReturn]]
101
+ ResultType = Union[
102
+ AtomicType, 'ElementProtocol', 'XsdAttributeProtocol', tuple[Optional[str], str],
103
+ 'DocumentProtocol', 'DocumentNode', 'XPathFunction', object
104
+ ]
105
+ MapDictType = dict[Optional[AtomicType], ValueType]
106
+ SequenceTypesType = Union[str, list[str], tuple[str, ...]]
107
+
108
+ # Parsers and tokens
109
+ XPathParserType = Union['XPath1Parser', 'XPath2Parser', 'XPath30Parser', 'XPath31Parser']
110
+ XPathTokenType = Union['XPathToken', 'XPathAxis', 'XPathFunction', 'XPathConstructor']
111
+ XPath2ParserType = Union['XPath2Parser', 'XPath30Parser', 'XPath31Parser']
112
+ ParserClassType = Union[
113
+ type['XPath1Parser'], type['XPath2Parser'], type['XPath30Parser'], type['XPath31Parser']
114
+ ]
115
+ NargsType = Optional[Union[int, tuple[int, Optional[int]]]]
116
+ ClassCheckType = Union[type[Any], tuple[type[Any], ...]]
117
+
118
+ # Context arguments
119
+ ContextType = Union['XPathContext', 'XPathSchemaContext', None]
120
+ RootArgType = Union['DocumentType', 'ElementType', 'SchemaElemType', RootNodeType]
121
+ ItemArgType = Union[ItemType, 'ElementProtocol', 'DocumentProtocol']
122
+ SchemaProxyType = Union['AbstractSchemaProxy']
123
+
124
+ _S = TypeVar('_S', bound=ItemArgType)
125
+
126
+ InputType = Union[None, _S, list[_S], list[NoReturn], tuple[_S, ...], tuple[_S], tuple[()]]
127
+ VariableValueType = InputType[ItemArgType]
128
+ FunctionArgType = Union[VariableValueType, ValueType]
129
+ NodeArgType = Union['XPathNode', 'ElementProtocol', 'DocumentProtocol']
130
+ CollectionArgType = InputType[NodeArgType]
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (c), 2022, SISSA (International School for Advanced Studies).
2
+ # Copyright (c), 2022-2026, SISSA (International School for Advanced Studies).
3
3
  # All rights reserved.
4
4
  # This file is distributed under the terms of the MIT License.
5
5
  # See the file 'LICENSE' in the root directory of the present
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (c), 2022, SISSA (International School for Advanced Studies).
2
+ # Copyright (c), 2022-2026, SISSA (International School for Advanced Studies).
3
3
  # All rights reserved.
4
4
  # This file is distributed under the terms of the MIT License.
5
5
  # See the file 'LICENSE' in the root directory of the present
@@ -171,10 +171,6 @@ def deep_equal(seq1: Iterable[Any],
171
171
  return True
172
172
 
173
173
 
174
- def is_empty_sequence(x: Any) -> bool:
175
- return not x and isinstance(x, list)
176
-
177
-
178
174
  def deep_compare(obj1: Any,
179
175
  obj2: Any,
180
176
  collation: Optional[str] = None,
@@ -187,7 +183,7 @@ def deep_compare(obj1: Any,
187
183
  def iter_object(obj: Any) -> Iterator[Any]:
188
184
  if isinstance(obj, XPathArray):
189
185
  yield from obj.items()
190
- elif isinstance(obj, (list, Iterator)):
186
+ elif isinstance(obj, list):
191
187
  yield from obj
192
188
  else:
193
189
  yield obj
@@ -241,11 +237,13 @@ def deep_compare(obj1: Any,
241
237
  not isinstance(value2, XPathArray):
242
238
  raise xpath_error('FOTY0013', token=token)
243
239
 
244
- if (value1 is None) ^ (value2 is None):
245
- return -1 if value1 is None else 1
240
+ if value1 is None or value1 == []:
241
+ if value2 is not None and value2 != []:
242
+ return -1
246
243
 
247
- if is_empty_sequence(value1) ^ is_empty_sequence(value2):
248
- return -1 if is_empty_sequence(value1) else 1
244
+ if value2 is None or value2 == []:
245
+ if value1 is not None and value1 != []:
246
+ return 1
249
247
 
250
248
  if isinstance(value1, XPathNode) ^ isinstance(value2, XPathNode):
251
249
  msg = f"cannot compare {type(value1)} with {type(value2)}"
@@ -371,12 +369,12 @@ def get_key_function(collation: Optional[str] = None,
371
369
 
372
370
  def compare_func(obj1: Any, obj2: Any) -> int:
373
371
  if key_func is not None:
374
- if isinstance(obj1, (list, Iterator)):
372
+ if isinstance(obj1, list):
375
373
  obj1 = map(key_func, obj1)
376
374
  else:
377
375
  obj1 = key_func(obj1)
378
376
 
379
- if isinstance(obj2, (list, Iterator)):
377
+ if isinstance(obj2, list):
380
378
  obj2 = map(key_func, obj2)
381
379
  else:
382
380
  obj2 = key_func(obj2)
@@ -0,0 +1,53 @@
1
+ #
2
+ # Copyright (c), 2018-2026, SISSA (International School for Advanced Studies).
3
+ # All rights reserved.
4
+ # This file is distributed under the terms of the MIT License.
5
+ # See the file 'LICENSE' in the root directory of the present
6
+ # distribution, or http://opensource.org/licenses/MIT.
7
+ #
8
+ # @author Davide Brunato <brunato@sissa.it>
9
+ #
10
+ """
11
+ XSD atomic datatypes subpackage. Includes a class for UntypedAtomic data and
12
+ classes for other XSD built-in types. This subpackage raises only built-in
13
+ exceptions in order to be reusable by other packages.
14
+ """
15
+ from .any_types import builtin_atomic_types, AtomicTypeMeta, AnyType, \
16
+ AnySimpleType, AnyAtomicType
17
+ from .numeric import Float, Float10, Integer, Int, Long, \
18
+ NegativeInteger, PositiveInteger, NonNegativeInteger, \
19
+ NonPositiveInteger, Short, Byte, UnsignedByte, UnsignedInt, \
20
+ UnsignedLong, UnsignedShort
21
+ from .untyped import UntypedAtomic
22
+ from .qname import AbstractQName, QName, Notation
23
+ from .string import NormalizedString, XsdToken, Name, NCName, \
24
+ NMToken, Id, Idref, Language, Entity
25
+ from .lists import builtin_list_types, ListType, NMTokens, Idrefs, Entities
26
+ from .uri import AnyURI
27
+ from .binary import AbstractBinary, Base64Binary, HexBinary
28
+ from .datetime import AbstractDateTime, DateTime10, DateTime, DateTimeStamp, \
29
+ Date10, Date, GregorianDay, GregorianMonth, GregorianYear, GregorianYear10, \
30
+ GregorianMonthDay, GregorianYearMonth, GregorianYearMonth10, Time, Timezone, \
31
+ Duration, DayTimeDuration, YearMonthDuration
32
+ from .proxies import ErrorProxy, BooleanProxy, DecimalProxy, DoubleProxy, \
33
+ DoubleProxy10, StringProxy, NumericProxy, ArithmeticProxy
34
+ from ..sequences import XSequence
35
+
36
+ ###
37
+ # Alias kept for backward compatibility, will be removed in v6.0.
38
+ OrderedDateTime = AbstractDateTime
39
+
40
+ __all__ = ['AbstractBinary', 'AbstractDateTime', 'ListType', 'AbstractQName',
41
+ 'AnyAtomicType', 'AnyURI', 'ArithmeticProxy', 'AtomicTypeMeta', 'Base64Binary',
42
+ 'BooleanProxy', 'AtomicTypeMeta', 'Byte', 'Date', 'Date10', 'DateTime',
43
+ 'DateTime10', 'DateTimeStamp', 'DayTimeDuration', 'DecimalProxy', 'DoubleProxy',
44
+ 'DoubleProxy10', 'Duration', 'Entities', 'Entity', 'ErrorProxy',
45
+ 'Float', 'Float10', 'GregorianDay', 'GregorianMonth', 'GregorianMonthDay',
46
+ 'GregorianYear', 'GregorianYear10', 'GregorianYearMonth', 'GregorianYearMonth10',
47
+ 'HexBinary', 'Id', 'Idref', 'Idrefs', 'Int', 'Integer', 'Language', 'Long',
48
+ 'NCName', 'NMToken', 'NMTokens', 'Name', 'NegativeInteger', 'NonNegativeInteger',
49
+ 'NonPositiveInteger', 'NormalizedString', 'Notation', 'NumericProxy',
50
+ 'OrderedDateTime', 'PositiveInteger', 'QName', 'Short', 'StringProxy', 'Time',
51
+ 'Timezone', 'UnsignedByte', 'UnsignedInt', 'UnsignedLong', 'UnsignedShort',
52
+ 'UntypedAtomic', 'XsdToken', 'YearMonthDuration', 'ListType', 'XSequence',
53
+ 'builtin_atomic_types', 'builtin_list_types', 'AnyType', 'AnySimpleType']