sdmxlib 0.82.0__tar.gz → 0.83.0__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 (216) hide show
  1. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/PKG-INFO +1 -1
  2. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/pyproject.toml +1 -1
  3. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/pyproject.toml.orig +1 -1
  4. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/edition/EGM.md +29 -6
  5. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/edition/__init__.py +6 -2
  6. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/edition/_build.py +200 -35
  7. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/edition/_check.py +112 -33
  8. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/edition/_copy.py +29 -3
  9. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/edition/_write.py +24 -5
  10. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/local/EGM.md +4 -4
  11. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/storage/EGM.md +11 -4
  12. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/storage/_files.py +32 -1
  13. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/storage/_references.py +62 -7
  14. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/LICENSE +0 -0
  15. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/README.md +0 -0
  16. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/EGM.md +0 -0
  17. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/__init__.py +0 -0
  18. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/_duckdb.py +0 -0
  19. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/_facet_types.xsd +0 -0
  20. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/_facets.py +0 -0
  21. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/_read_errors.py +0 -0
  22. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/_singleflight.py +0 -0
  23. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/_time.py +0 -0
  24. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/api/EGM.md +0 -0
  25. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/api/__init__.py +0 -0
  26. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/api/_freshness.py +0 -0
  27. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/api/client.py +0 -0
  28. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/api/federated.py +0 -0
  29. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/api/policy.py +0 -0
  30. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/api/providers.py +0 -0
  31. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/api/registry.py +0 -0
  32. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/api/session.py +0 -0
  33. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/builders/EGM.md +0 -0
  34. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/builders/__init__.py +0 -0
  35. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/builders/contentconstraint.py +0 -0
  36. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/builders/metadata_annotation.py +0 -0
  37. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/data_store.py +0 -0
  38. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/edition/_availability.py +0 -0
  39. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/edition/_canonical.py +0 -0
  40. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/edition/_fetch.py +0 -0
  41. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/edition/_finding.py +0 -0
  42. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/edition/_fingerprint.py +0 -0
  43. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/edition/_overlay.py +0 -0
  44. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/edition/_remote.py +0 -0
  45. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/edition/manifest.schema.json +0 -0
  46. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/edition/overlay.schema.json +0 -0
  47. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/EGM.md +0 -0
  48. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/__init__.py +0 -0
  49. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/_arrow.py +0 -0
  50. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/_attachment.py +0 -0
  51. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/_coerce.py +0 -0
  52. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/_index.py +0 -0
  53. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/_positions.py +0 -0
  54. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/_refuse.py +0 -0
  55. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/_tags.py +0 -0
  56. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/data_format.py +0 -0
  57. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/gaps.py +0 -0
  58. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/render.py +0 -0
  59. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_csv/EGM.md +0 -0
  60. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_csv/__init__.py +0 -0
  61. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_csv/reader.py +0 -0
  62. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_csv/writer.py +0 -0
  63. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json/EGM.md +0 -0
  64. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json/__init__.py +0 -0
  65. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json/_data_common.py +0 -0
  66. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json/_dto.py +0 -0
  67. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json/_header.py +0 -0
  68. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json/_losses.py +0 -0
  69. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json/_periods.py +0 -0
  70. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json/_resolve.py +0 -0
  71. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json/_structure_dto.py +0 -0
  72. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json/_structure_ingest.py +0 -0
  73. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json/data.py +0 -0
  74. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json/data_v1.py +0 -0
  75. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json/data_v2.py +0 -0
  76. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json/metadata.py +0 -0
  77. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json/reader.py +0 -0
  78. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json/structure_values.py +0 -0
  79. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json/writer.py +0 -0
  80. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json_1_0/EGM.md +0 -0
  81. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json_1_0/__init__.py +0 -0
  82. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_json_1_0/writer.py +0 -0
  83. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml/EGM.md +0 -0
  84. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml/__init__.py +0 -0
  85. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml/_allowed_children.py +0 -0
  86. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml/_closed_world.py +0 -0
  87. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml/_common.py +0 -0
  88. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml/_header.py +0 -0
  89. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml/_losses.py +0 -0
  90. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml/_v3_reader.py +0 -0
  91. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml/_v3_writer.py +0 -0
  92. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml21/EGM.md +0 -0
  93. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml21/__init__.py +0 -0
  94. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml21/_providers.py +0 -0
  95. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml21/_synthetic.py +0 -0
  96. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml21/namespaces.py +0 -0
  97. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml21/reader.py +0 -0
  98. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml21/writer.py +0 -0
  99. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml30/EGM.md +0 -0
  100. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml30/__init__.py +0 -0
  101. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml30/metadata.py +0 -0
  102. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml30/namespaces.py +0 -0
  103. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml30/reader.py +0 -0
  104. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml30/writer.py +0 -0
  105. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml31/EGM.md +0 -0
  106. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml31/__init__.py +0 -0
  107. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml31/namespaces.py +0 -0
  108. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml31/reader.py +0 -0
  109. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/formats/sdmx_ml31/writer.py +0 -0
  110. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/inventory/EGM.md +0 -0
  111. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/inventory/__init__.py +0 -0
  112. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/inventory/_format.py +0 -0
  113. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/inventory/_reader.py +0 -0
  114. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/inventory/_rules.py +0 -0
  115. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/inventory/conformance.py +0 -0
  116. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/inventory/schemas/catalog.schema.json +0 -0
  117. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/inventory/schemas/current.schema.json +0 -0
  118. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/inventory/schemas/leaf.schema.json +0 -0
  119. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/inventory/schemas/root.schema.json +0 -0
  120. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/local/__init__.py +0 -0
  121. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/local/_scan.py +0 -0
  122. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/local/data_store.py +0 -0
  123. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/local/engine.py +0 -0
  124. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/local/object_store.py +0 -0
  125. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/local/registry.py +0 -0
  126. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/local/sql.py +0 -0
  127. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/EGM.md +0 -0
  128. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/__init__.py +0 -0
  129. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/_binding.py +0 -0
  130. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/_container.py +0 -0
  131. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/_invariants.py +0 -0
  132. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/_items.py +0 -0
  133. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/_label_match.py +0 -0
  134. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/_rebind.py +0 -0
  135. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/_referenceable.py +0 -0
  136. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/_refshape.py +0 -0
  137. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/_resolvers.py +0 -0
  138. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/_rules.py +0 -0
  139. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/_tree.py +0 -0
  140. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/annotations.py +0 -0
  141. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/base.py +0 -0
  142. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/binding.py +0 -0
  143. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/category.py +0 -0
  144. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/codelist.py +0 -0
  145. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/collections.py +0 -0
  146. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/concept.py +0 -0
  147. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/constraint.py +0 -0
  148. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/convert.py +0 -0
  149. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/dataflow.py +0 -0
  150. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/datastructure.py +0 -0
  151. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/errors.py +0 -0
  152. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/expr.py +0 -0
  153. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/header.py +0 -0
  154. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/hierarchy.py +0 -0
  155. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/in_memory_registry.py +0 -0
  156. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/istring.py +0 -0
  157. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/link.py +0 -0
  158. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/mapping.py +0 -0
  159. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/message.py +0 -0
  160. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/metadata_provision.py +0 -0
  161. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/metadataflow.py +0 -0
  162. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/metadataset.py +0 -0
  163. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/metadatastructure.py +0 -0
  164. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/organisation.py +0 -0
  165. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/provision.py +0 -0
  166. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/ref.py +0 -0
  167. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/registry.py +0 -0
  168. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/representation.py +0 -0
  169. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/rest_api.py +0 -0
  170. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/rollup.py +0 -0
  171. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/urn.py +0 -0
  172. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/validation.py +0 -0
  173. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/valuelist.py +0 -0
  174. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/version.py +0 -0
  175. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/model/version_rewrite.py +0 -0
  176. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/polars.py +0 -0
  177. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/py.typed +0 -0
  178. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/query/EGM.md +0 -0
  179. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/query/__init__.py +0 -0
  180. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/query/_closure.py +0 -0
  181. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/query/_common.py +0 -0
  182. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/query/_compile.py +0 -0
  183. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/query/_edges.py +0 -0
  184. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/query/_execute.py +0 -0
  185. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/query/_expr.py +0 -0
  186. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/query/_joins.py +0 -0
  187. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/query/_plan.py +0 -0
  188. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/query/_pushdown.py +0 -0
  189. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/query/_rebase.py +0 -0
  190. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/query/_rest.py +0 -0
  191. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/query/accessors.py +0 -0
  192. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/query/observations.py +0 -0
  193. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/query/query.py +0 -0
  194. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/query/raw.py +0 -0
  195. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/query/schema.py +0 -0
  196. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/rest.py +0 -0
  197. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/session.py +0 -0
  198. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/sql.py +0 -0
  199. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/storage/__init__.py +0 -0
  200. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/storage/_checked.py +0 -0
  201. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/storage/_columns.py +0 -0
  202. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/storage/_kinds.py +0 -0
  203. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/storage/_layout.py +0 -0
  204. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/storage/_manifest.py +0 -0
  205. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/storage/_parsed.py +0 -0
  206. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/storage/_projections.py +0 -0
  207. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/storage/_synthetic.py +0 -0
  208. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/storage/_tags.py +0 -0
  209. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/storage/_trim.py +0 -0
  210. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/storage/lazy.py +0 -0
  211. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/storage/readers.py +0 -0
  212. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/storage/resolve.py +0 -0
  213. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/storage/schema.py +0 -0
  214. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/storage/writers.py +0 -0
  215. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/testing.py +0 -0
  216. {sdmxlib-0.82.0 → sdmxlib-0.83.0}/src/sdmxlib/versions.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sdmxlib
3
- Version: 0.82.0
3
+ Version: 0.83.0
4
4
  Summary: SDMX for Python: structures, reference metadata and observation data, from REST, files or a local DuckDB store.
5
5
  Keywords: sdmx,statistics,metadata,datastructure
6
6
  Author: gabrielgellner
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "sdmxlib"
3
- version = "0.82.0"
3
+ version = "0.83.0"
4
4
  description = "SDMX for Python: structures, reference metadata and observation data, from REST, files or a local DuckDB store."
5
5
  readme = "README.md"
6
6
  license = "Apache-2.0"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "sdmxlib"
3
- version = "0.82.0"
3
+ version = "0.83.0"
4
4
  description = "SDMX for Python: structures, reference metadata and observation data, from REST, files or a local DuckDB store."
5
5
  readme = "README.md"
6
6
  license = "Apache-2.0"
@@ -34,7 +34,14 @@ seals through `seal(extensions=...)`.
34
34
  implements, and `Profile` is the profile literal. Findings are `Finding`s
35
35
  (`_finding.py`). An argument the profile does not use (`structures=` at
36
36
  `open`, `remote=` at `publish`, `lookup=` or `fingerprints=` outside
37
- `receive`) raises `ValueError`.
37
+ `receive`) raises `ValueError`. `structures=` takes one edition or a
38
+ sequence of them, and a partial is checked against the one holding its
39
+ full artefact with its `partial_of` fingerprint; an empty sequence raises
40
+ `ValueError`. For an edition with no bindings (a structure product), the
41
+ `references` check also accepts a reference one of the `structures=`
42
+ editions holds as a full artefact or an item of one
43
+ (`storage._references.held_targets`; spec §6.5 item 9, GH-351). A data
44
+ product's references resolve in its own edition alone.
38
45
  - `check_on_open` (`_check.py`): runs one profile per call. Without a stamp
39
46
  for this `(product_id, edition id, manifest sha256)` it runs `receive` and writes
40
47
  the stamp when the report is clean; with one it runs `open`. An unreadable
@@ -45,9 +52,18 @@ seals through `seal(extensions=...)`.
45
52
  - `verify_remote`, `RemoteFile`, `content_md5` and `content_crc32c`
46
53
  (`_remote.py`): check files in an object store by size and digest. The
47
54
  digests are the base64 values used in headers.
48
- - `build_edition` (`_build.py`): builds an edition from dataflow closures and
49
- producer observations. With `partials=True` (the default) it cuts codelists
50
- down to partials.
55
+ - `build_edition` (`_build.py`): builds a new product's first edition from
56
+ dataflow closures and producer observations. With `partials=True` (the
57
+ default) it cuts codelists down to partials. It opens the builder, calls
58
+ `fill_edition` and seals.
59
+ - `fill_edition` (`_build.py`): adds dataflow closures and observations to a
60
+ builder the caller opened, cuts its codelists, and returns the `partial_of`
61
+ mapping for the caller's `seal`. It keeps what the builder held; the cut
62
+ covers every binding in the builder (GH-347).
63
+ - `fill_structures` (`_build.py`): copies full artefacts into a builder for a
64
+ structure product, selected by family, agency, id pattern and URN. It
65
+ refuses dataflows, bindings, partials and an empty selection, and adds
66
+ nothing the selected artefacts reference (GH-347).
51
67
  - `fetch_edition` (`_fetch.py`): fetches one dataflow over SDMX REST into a new
52
68
  sealed edition that records its `Provenance`. It calls `build_edition`
53
69
  with `partials=False`.
@@ -82,6 +98,10 @@ seals through `seal(extensions=...)`.
82
98
 
83
99
  - An edition is never rewritten. `seal` raises `ManifestError`
84
100
  when `manifest.json` already exists.
101
+ - `seal` records `partial_of` for a partial its `partial_of=` names, and
102
+ otherwise the value the previous edition's manifest records for it.
103
+ - `fill_edition` and `fill_structures` never open, close or seal the
104
+ builder. `fill_structures` checks its whole selection before it writes.
85
105
  - `seal` requires a `edition_id` in the meta store, which
86
106
  `LocalRegistry.build` sets. It then works in this order: `settle_lake` (when
87
107
  `tables.ducklake` exists), `clear_availability`, the binding survey (when
@@ -102,7 +122,8 @@ seals through `seal(extensions=...)`.
102
122
  tier 1, and other files to tier 2.
103
123
  - `copy_edition` skips a `data/` file already present with the same size and
104
124
  digest, raises when a copied file does not match, and refuses a destination
105
- that is already sealed.
125
+ that is already sealed. Every file it copied is fsynced before the manifest
126
+ exists.
106
127
  - `check_on_open` writes a stamp only after a clean `receive` check, and only
107
128
  to a path made of exactly two plain components under the stamps directory.
108
129
  - `settle_lake` never deletes files from `data/`.
@@ -130,7 +151,9 @@ seals through `seal(extensions=...)`.
130
151
  - `seal` clears per-binding availability in `metadata.duckdb` and, when
131
152
  availability is enabled, stores it again.
132
153
  - `copy_edition` creates directories and copies files with `shutil.copyfile`,
133
- then copies the detached signature and the manifest last.
154
+ then copies the detached signature. It fsyncs each copied file, the
155
+ signature included, and each directory it created or wrote into (with the
156
+ directory naming a created one), then creates the manifest last (GH-344).
134
157
  - `check_on_open` writes the JSON stamp `<stamps>/<product_id>/<edition_id>`
135
158
  with `storage._files.replace_durably`, which replaces any stamp there.
136
159
  - `fetch_edition` makes SDMX REST requests and creates a product directory.
@@ -12,7 +12,9 @@ an ETag keys on. ``LocalRegistry.edition(edition_dir)`` opens it read-only.
12
12
  what such a copy needs for another tool; `verify_remote` checks the
13
13
  files a server reads from object storage by size and a digest the store keeps; `build_edition`
14
14
  builds one from dataflows' closures at a registry and the observations a
15
- producer holds, cutting codelists to partials; and `fetch_edition` lands
15
+ producer holds, cutting codelists to partials; `fill_edition` does the same
16
+ into a builder its caller opened and seals, and `fill_structures` fills one
17
+ with a structure product's full artefacts; and `fetch_edition` lands
16
18
  one dataflow from an SDMX REST source as a sealed edition, its provenance
17
19
  recorded. `apply_overlays` changes display annotations without a rebuild,
18
20
  `effective_token` is what a cache keys on when it does, and `fold_overlays`
@@ -44,7 +46,7 @@ from sdmxlib.edition._check import Check, Profile, Report, check_edition, check_
44
46
  from sdmxlib.edition._finding import Finding
45
47
  from sdmxlib.edition._copy import edition_files, copy_edition
46
48
  from sdmxlib.edition._remote import RemoteFile, content_crc32c, content_md5, verify_remote
47
- from sdmxlib.edition._build import build_edition
49
+ from sdmxlib.edition._build import build_edition, fill_edition, fill_structures
48
50
  from sdmxlib.edition._fetch import fetch_edition
49
51
  from sdmxlib.edition._overlay import (
50
52
  OVERLAY_FORMAT,
@@ -135,6 +137,8 @@ __all__ = [
135
137
  "edition_files",
136
138
  "effective_token",
137
139
  "fetch_edition",
140
+ "fill_edition",
141
+ "fill_structures",
138
142
  "fold_overlays",
139
143
  "list_editions",
140
144
  "list_files",
@@ -1,8 +1,11 @@
1
- """Building an edition from a registry and the observations a producer holds (GH-223).
1
+ """Building an edition from a registry and the observations a producer holds (GH-223, GH-347).
2
2
 
3
- `build_edition` is the one place a dataflow's structural closure is selected and
4
- its codelists cut to partials. `fetch_edition` is a call to it; so is any
5
- producer holding structures in a registry and observations in a lake.
3
+ `fill_edition` is the one place a dataflow's structural closure is selected and
4
+ its codelists cut to partials, into a builder its caller opened and seals.
5
+ `build_edition` opens a new product's first edition, fills it and seals it;
6
+ `fetch_edition` is a call to it. `fill_structures` fills a builder with the
7
+ full artefacts of a structure product, chosen by family, agency, id pattern and
8
+ URN (`docs/design/open-builder-structures.md`).
6
9
 
7
10
  **The closure is the fingerprint's.** It is what `References.closure` selects
8
11
  from the dataflow and its data structure: what they refer to, every artefact
@@ -21,7 +24,8 @@ stays full too when it has extensions, when a component it enumerates has no
21
24
  column in written observations, and when the cut would keep every code.
22
25
  """
23
26
 
24
- from collections.abc import Iterable, Mapping, Sequence
27
+ from collections.abc import Collection, Iterable, Mapping, Sequence
28
+ from fnmatch import fnmatchcase
25
29
  from pathlib import Path
26
30
 
27
31
  import msgspec
@@ -38,9 +42,10 @@ from sdmxlib.model.codelist import CascadeSelection, Codelist
38
42
  from sdmxlib.model.constraint import ComponentValueSet, ConstraintType, DataConstraint, KeyValue
39
43
  from sdmxlib.model.dataflow import Dataflow
40
44
  from sdmxlib.model.datastructure import DataStructure
41
- from sdmxlib.model.ref import Ref
45
+ from sdmxlib.model.ref import Ref, urn_of
42
46
  from sdmxlib.model.urn import SdmxUrn
43
47
  from sdmxlib.storage._columns import table_columns
48
+ from sdmxlib.storage._kinds import CLASS_TO_NAME
44
49
  from sdmxlib.storage._manifest import Manifest, Producer, Provenance
45
50
 
46
51
  #: The lake schema a dataflow's observations are written to.
@@ -98,23 +103,13 @@ def build_edition(
98
103
  column holds a value outside its codelist, naming the dataflow,
99
104
  the component and the values.
100
105
  """
101
- rows = dict(observations or {})
102
106
  root = Path(path)
103
107
  if root.exists() and any(root.iterdir()):
104
108
  msg = f"{root} exists and is not empty; build_edition creates a new edition"
105
109
  raise FileExistsError(msg)
106
110
  root.mkdir(parents=True, exist_ok=True)
107
111
  with LocalRegistry.build(root) as builder:
108
- flows = _structures(source, dataflows, builder)
109
- # Rows are found by the URN given or the one it resolved to.
110
- keys = [{str(given), str(flow.urn)} for given, (flow, _) in zip(dataflows, flows, strict=True)]
111
- unknown = sorted(set(rows) - set().union(*keys))
112
- if unknown:
113
- msg = f"observations name {', '.join(unknown)}, which is not among the dataflows built"
114
- raise ValueError(msg)
115
- found = [next((rows[key] for key in sorted(names) if key in rows), None) for names in keys]
116
- bound = _write(builder, flows, found)
117
- cut = _cut(builder, flows, bound) if partials else {}
112
+ cut = fill_edition(builder, source, dataflows, observations=observations, partials=partials)
118
113
  stored = builder.connection.execute(
119
114
  "SELECT urn FROM sdmx.artefact WHERE artefact_type <> 'DataflowBinding' ORDER BY urn"
120
115
  ).fetchall()
@@ -127,6 +122,158 @@ def build_edition(
127
122
  )
128
123
 
129
124
 
125
+ def fill_edition(
126
+ builder: LocalRegistry,
127
+ source: RestRegistry | EditionRegistry,
128
+ dataflows: Sequence[SdmxUrn[Dataflow]],
129
+ *,
130
+ observations: Mapping[str, WriteSource] | None = None,
131
+ partials: bool = True,
132
+ ) -> dict[str, str]:
133
+ """Add each dataflow's closure at `source` and its observations to an open builder, and cut its codelists.
134
+
135
+ The builder is the caller's: `LocalRegistry.build` opened it, empty or
136
+ on a previous edition, and the caller seals it, passing the returned
137
+ mapping as ``seal(partial_of=...)``. Nothing here opens, closes or seals it.
138
+
139
+ What the builder held before is kept. An artefact of the closure the
140
+ builder already held is replaced by the one at `source`, so a full
141
+ codelist from `source` replaces a partial carried from the previous
142
+ edition. A dataflow given rows gets a table, ``obs.<table_for(urn)>``,
143
+ whose rows the new ones replace, and a binding; a dataflow given none
144
+ keeps the binding the builder holds, if any. With `partials`, the cut
145
+ covers every binding in the builder, so a codelist another bound dataflow
146
+ shares keeps the codes that dataflow holds too, and a codelist a dataflow
147
+ given here with no binding enumerates stays full. A codelist the builder
148
+ holds as a partial is not cut again.
149
+
150
+ Args:
151
+ builder: The open builder of an unsealed edition.
152
+ source: Where the structures are: a `RestRegistry`, asked for each
153
+ dataflow's closure, or a sealed edition's `EditionRegistry`.
154
+ dataflows: The dataflows, by URN. A `latest` URN is filled at the
155
+ version it resolves to.
156
+ observations: The rows of each dataflow that has any, by URN string,
157
+ as `LocalRegistry.write_observations` reads them.
158
+ partials: Whether to cut codelists to partials.
159
+
160
+ Returns:
161
+ The fingerprint of the full codelist each partial cut here was cut
162
+ from, by URN: ``seal``'s `partial_of`.
163
+
164
+ Raises:
165
+ TypeError: If a URN names no dataflow at `source`.
166
+ ValueError: If a dataflow has no data structure at `source`, if
167
+ `observations` names a dataflow not in `dataflows`, or if a coded
168
+ column holds a value outside its codelist, naming the dataflow,
169
+ the component and the values.
170
+ """
171
+ rows = dict(observations or {})
172
+ flows = _structures(source, dataflows, builder)
173
+ # Rows are found by the URN given or the one it resolved to.
174
+ keys = [{str(given), str(flow.urn)} for given, (flow, _) in zip(dataflows, flows, strict=True)]
175
+ unknown = sorted(set(rows) - set().union(*keys))
176
+ if unknown:
177
+ msg = f"observations name {', '.join(unknown)}, which is not among the dataflows built"
178
+ raise ValueError(msg)
179
+ found = [next((rows[key] for key in sorted(names) if key in rows), None) for names in keys]
180
+ _write(builder, flows, found)
181
+ return _cut(builder, flows) if partials else {}
182
+
183
+
184
+ #: Classes a structure product never holds: it binds no dataflow (the sharded catalog spec §8).
185
+ _NOT_STRUCTURES: tuple[type, ...] = (Dataflow, DataflowBinding)
186
+
187
+
188
+ def fill_structures(
189
+ builder: LocalRegistry,
190
+ source: EditionRegistry,
191
+ *,
192
+ families: Collection[type[MaintainableArtefact]] = (),
193
+ agency: str | None = None,
194
+ ids: Collection[str] = (),
195
+ artefacts: Collection[SdmxUrn[MaintainableArtefact] | str] = (),
196
+ ) -> tuple[str, ...]:
197
+ """Copy full artefacts from `source` into an open builder, for a structure product.
198
+
199
+ An artefact is selected when `artefacts` names its URN, or when its class
200
+ is one of `families`, its agency is `agency` (any agency when None) and
201
+ its id matches one of the `ids` patterns (`fnmatch.fnmatchcase`, so
202
+ ``SGC*``; any id when `ids` is empty). A family selects full artefacts
203
+ only, so a data edition holding partials can be the source. Nothing is
204
+ added for what a selected artefact references: each full artefact has one
205
+ structure home, so a reference into another structure product stays open.
206
+ The builder is the caller's to seal; an artefact it already holds at a
207
+ selected URN is replaced.
208
+
209
+ Args:
210
+ builder: The open builder of an unsealed edition.
211
+ source: The registry holding the full artefacts.
212
+ families: The artefact classes to select, such as `Codelist` or
213
+ `ConceptScheme`. `Codelist` selects geographic codelists too.
214
+ agency: The maintenance agency of the artefacts `families` selects.
215
+ ids: Patterns the id of an artefact `families` selects must match.
216
+ artefacts: More artefacts, by URN.
217
+
218
+ Returns:
219
+ The URNs copied, sorted.
220
+
221
+ Raises:
222
+ TypeError: If a family is not a class the store holds, or is
223
+ `Dataflow` or `DataflowBinding`.
224
+ ValueError: If a URN names a dataflow or a binding, if a URN
225
+ names an artefact `source` does not hold or holds as a partial, or
226
+ if nothing is selected.
227
+ """
228
+ names: list[str] = []
229
+ for family in families:
230
+ name = CLASS_TO_NAME.get(family)
231
+ if name is None:
232
+ stored = next((cls.__name__ for cls in family.__mro__ if cls in CLASS_TO_NAME), None)
233
+ held_as = "" if stored is None else f"; it is stored as a {stored}, the family to name"
234
+ msg = f"{family.__name__} is not an artefact class the store holds{held_as}"
235
+ raise TypeError(msg)
236
+ if issubclass(family, _NOT_STRUCTURES):
237
+ msg = f"a structure product binds no dataflow, so it holds no {family.__name__}"
238
+ raise TypeError(msg)
239
+ names.append(name)
240
+ held = {
241
+ urn: (kind, owner, resource, partial)
242
+ for urn, kind, owner, resource, partial in source.connection.execute(
243
+ "SELECT urn, artefact_type, agency_id, resource_id, is_partial FROM sdmx.artefact"
244
+ ).fetchall()
245
+ }
246
+ selected = {
247
+ urn
248
+ for urn, (kind, owner, resource, partial) in held.items()
249
+ if kind in names
250
+ and not partial
251
+ and (agency is None or owner == agency)
252
+ and (not ids or any(fnmatchcase(resource, pattern) for pattern in ids))
253
+ }
254
+ for named in artefacts:
255
+ urn = str(named)
256
+ found = held.get(urn)
257
+ if found is None:
258
+ msg = f"{urn} is not held at {source}"
259
+ raise ValueError(msg)
260
+ kind, _, _, partial = found
261
+ if kind in {CLASS_TO_NAME[cls] for cls in _NOT_STRUCTURES}:
262
+ msg = f"{urn} is a {kind}, and a structure product binds no dataflow"
263
+ raise ValueError(msg)
264
+ if partial:
265
+ msg = f"{urn} is a partial artefact at {source}; a structure product holds full artefacts"
266
+ raise ValueError(msg)
267
+ selected.add(urn)
268
+ if not selected:
269
+ msg = f"nothing at {source} matches families={sorted(names)}, agency={agency!r}, ids={sorted(ids)}"
270
+ raise ValueError(msg)
271
+ kept = sorted(selected)
272
+ copied = (source.get(SdmxUrn.parse(urn), expect=MaintainableArtefact, eager=True) for urn in kept)
273
+ builder.add_all([artefact for artefact in copied if artefact is not None])
274
+ return tuple(kept)
275
+
276
+
130
277
  def table_for(urn: SdmxUrn[Dataflow]) -> str:
131
278
  """The lake table a dataflow's observations go in: its URN's parts, as an identifier."""
132
279
  parts = f"{urn.agency}_{urn.id}_{urn.version}"
@@ -154,10 +301,19 @@ def _structures(
154
301
  raise ValueError(msg)
155
302
  flows.append((flow, structure))
156
303
  if isinstance(source, RestRegistry):
157
- # Everything fetched goes in, and what the closure does not reach comes out.
158
- edition.add_all(list(source.registry))
159
- for urn in _held(edition) - _closure(edition, flows):
304
+ # What was fetched and is new goes in, and what of it the closure does
305
+ # not reach comes out; then the closure's members the builder already
306
+ # held are replaced by the fetched ones. Into an empty builder this is
307
+ # every fetched artefact in, the rest of the closure out.
308
+ before = _held(edition)
309
+ fetched = list(source.registry)
310
+ edition.add_all([artefact for artefact in fetched if str(urn_of(artefact)) not in before])
311
+ closure = _closure(edition, flows)
312
+ for urn in _held(edition) - before - closure:
160
313
  edition.drop(SdmxUrn.parse(urn))
314
+ replaced = [artefact for artefact in fetched if str(urn_of(artefact)) in before & closure]
315
+ if replaced:
316
+ edition.add_all(replaced)
161
317
  else:
162
318
  kept = sorted(_closure(source, flows))
163
319
  copied = (source.get(SdmxUrn.parse(urn), expect=MaintainableArtefact, eager=True) for urn in kept)
@@ -178,11 +334,8 @@ def _closure(registry: EditionRegistry, flows: Iterable[tuple[Dataflow, DataStru
178
334
  return {urn for flow, dsd in flows for urn in references.closure(str(flow.urn), [str(dsd.urn)])}
179
335
 
180
336
 
181
- def _write(
182
- edition: LocalRegistry, flows: list[tuple[Dataflow, DataStructure]], rows: list[WriteSource | None]
183
- ) -> list[tuple[DataflowBinding, DataStructure]]:
184
- """Write each dataflow's rows to its own table and bind it; the bindings, located, with their structures."""
185
- bound: list[tuple[DataflowBinding, DataStructure]] = []
337
+ def _write(edition: LocalRegistry, flows: list[tuple[Dataflow, DataStructure]], rows: list[WriteSource | None]) -> None:
338
+ """Write each dataflow's rows to its own table and bind it."""
186
339
  for (flow, dsd), found in zip(flows, rows, strict=True):
187
340
  if found is None:
188
341
  continue
@@ -190,27 +343,39 @@ def _write(
190
343
  edition.write_observations(schema=SCHEMA, table=table, source=found)
191
344
  binding = DataflowBinding.from_dsd(dsd, dataflow=Ref[Dataflow].unresolved(flow.urn), schema=SCHEMA, table=table)
192
345
  edition.add(binding)
193
- bound.append((edition.locate(binding), dsd))
346
+
347
+
348
+ def _bound(edition: LocalRegistry) -> list[tuple[Dataflow, DataflowBinding, DataStructure]]:
349
+ """Every binding the builder holds, located, with its dataflow and data structure."""
350
+ bound: list[tuple[Dataflow, DataflowBinding, DataStructure]] = []
351
+ for binding in edition.get_all(DataflowBinding):
352
+ flow = edition.get(binding.dataflow.urn, expect=Dataflow)
353
+ dsd = None if flow is None else edition.dsd(flow.urn)
354
+ if flow is not None and dsd is not None:
355
+ bound.append((flow, edition.locate(binding), dsd))
194
356
  return bound
195
357
 
196
358
 
197
- def _cut(
198
- edition: LocalRegistry,
199
- flows: list[tuple[Dataflow, DataStructure]],
200
- bound: list[tuple[DataflowBinding, DataStructure]],
201
- ) -> dict[str, str]:
202
- """Replace each codelist that can be cut by its partial; the full fingerprint of each, by URN."""
359
+ def _cut(edition: LocalRegistry, flows: list[tuple[Dataflow, DataStructure]]) -> dict[str, str]:
360
+ """Replace each codelist that can be cut by its partial; the full fingerprint of each, by URN.
361
+
362
+ The codes kept are those of every binding in the builder; a dataflow of
363
+ `flows` with no binding keeps the codelists it enumerates full.
364
+ """
203
365
  used: dict[str, set[str]] = {}
204
366
  full: set[str] = set()
205
- observed = {str(binding.dataflow.urn) for binding, _ in bound}
367
+ bound = _bound(edition)
368
+ observed = {str(flow.urn) for flow, _, _ in bound}
206
369
  for flow, dsd in flows:
207
370
  if str(flow.urn) not in observed:
208
371
  full |= set(_components(dsd).values())
209
- for binding, dsd in bound:
372
+ for _, binding, dsd in bound:
210
373
  _observed_codes(edition, binding, dsd, used, full)
211
374
  placed, referenced = _code_references(edition)
212
375
  full |= placed
213
- for urn, codes in _constraint_codes(edition, flows).items():
376
+ served = {str(flow.urn): (flow, dsd) for flow, dsd in flows}
377
+ served.update({str(flow.urn): (flow, dsd) for flow, _, dsd in bound})
378
+ for urn, codes in _constraint_codes(edition, list(served.values())).items():
214
379
  used.setdefault(urn, set()).update(codes)
215
380
  cut: dict[str, str] = {}
216
381
  for urn in sorted(set(used) - full):