sdmxlib 0.78.0__tar.gz → 0.79.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.
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/PKG-INFO +1 -1
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/pyproject.toml +1 -1
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/pyproject.toml.orig +1 -1
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/__init__.py +10 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/bundle/EGM.md +3 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/bundle/_canonical.py +1 -1
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/bundle/_check.py +20 -1
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/bundle/_overlay.py +25 -8
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/bundle/overlay.schema.json +1 -1
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/EGM.md +6 -0
- sdmxlib-0.79.0/src/sdmxlib/formats/_tags.py +136 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_json/EGM.md +6 -2
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_json/_data_common.py +14 -11
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_json/_dto.py +39 -24
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_json/_header.py +8 -7
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_json/_structure_dto.py +8 -1
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_json/_structure_ingest.py +83 -82
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_json/data_v1.py +2 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_json/data_v2.py +2 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_json/metadata.py +19 -18
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_json/reader.py +8 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_ml/_common.py +13 -32
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_ml/_header.py +4 -5
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_ml/_v3_writer.py +2 -2
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_ml21/writer.py +2 -2
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_ml30/metadata.py +10 -17
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/local/registry.py +1 -1
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/EGM.md +27 -3
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/__init__.py +13 -1
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/_rules.py +2 -2
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/annotations.py +6 -3
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/codelist.py +6 -2
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/constraint.py +5 -2
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/convert.py +2 -2
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/datastructure.py +12 -3
- sdmxlib-0.79.0/src/sdmxlib/model/istring.py +582 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/link.py +9 -5
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/valuelist.py +8 -3
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/polars.py +18 -11
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/query/_expr.py +8 -4
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/query/observations.py +3 -1
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/storage/EGM.md +3 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/storage/_projections.py +5 -0
- sdmxlib-0.79.0/src/sdmxlib/storage/_tags.py +84 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/storage/lazy.py +7 -2
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/storage/readers.py +7 -3
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/storage/resolve.py +6 -7
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/storage/writers.py +4 -4
- sdmxlib-0.78.0/src/sdmxlib/model/istring.py +0 -157
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/LICENSE +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/README.md +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/EGM.md +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/_duckdb.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/_read_errors.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/_singleflight.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/_time.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/api/EGM.md +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/api/__init__.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/api/_freshness.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/api/client.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/api/federated.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/api/policy.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/api/providers.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/api/registry.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/api/session.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/builders/EGM.md +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/builders/__init__.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/builders/contentconstraint.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/builders/metadata_annotation.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/bundle/__init__.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/bundle/_availability.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/bundle/_build.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/bundle/_copy.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/bundle/_fetch.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/bundle/_finding.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/bundle/_fingerprint.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/bundle/_remote.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/bundle/_write.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/bundle/manifest.schema.json +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/data_store.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/__init__.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/_arrow.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/_attachment.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/_coerce.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/_index.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/_positions.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/_refuse.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/data_format.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/gaps.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/render.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_csv/EGM.md +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_csv/__init__.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_csv/reader.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_csv/writer.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_json/__init__.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_json/_losses.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_json/_periods.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_json/_resolve.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_json/data.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_json/structure_values.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_json/writer.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_json_1_0/EGM.md +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_json_1_0/__init__.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_json_1_0/writer.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_ml/EGM.md +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_ml/__init__.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_ml/_allowed_children.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_ml/_closed_world.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_ml/_losses.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_ml/_v3_reader.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_ml21/EGM.md +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_ml21/__init__.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_ml21/_providers.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_ml21/_synthetic.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_ml21/namespaces.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_ml21/reader.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_ml30/EGM.md +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_ml30/__init__.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_ml30/namespaces.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_ml30/reader.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_ml30/writer.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_ml31/EGM.md +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_ml31/__init__.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_ml31/namespaces.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_ml31/reader.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/formats/sdmx_ml31/writer.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/local/EGM.md +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/local/__init__.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/local/_scan.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/local/data_store.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/local/engine.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/local/object_store.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/local/sql.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/_binding.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/_container.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/_invariants.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/_items.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/_label_match.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/_rebind.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/_referenceable.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/_refshape.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/_resolvers.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/_tree.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/base.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/binding.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/category.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/collections.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/concept.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/dataflow.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/errors.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/expr.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/header.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/hierarchy.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/in_memory_registry.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/mapping.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/message.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/metadata_provision.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/metadataflow.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/metadataset.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/metadatastructure.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/organisation.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/provision.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/ref.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/registry.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/representation.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/rest_api.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/rollup.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/urn.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/validation.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/version.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/model/version_rewrite.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/py.typed +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/query/EGM.md +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/query/__init__.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/query/_closure.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/query/_common.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/query/_compile.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/query/_edges.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/query/_execute.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/query/_joins.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/query/_plan.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/query/_pushdown.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/query/_rebase.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/query/_rest.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/query/accessors.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/query/query.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/query/raw.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/query/schema.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/rest.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/session.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/sql.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/storage/__init__.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/storage/_checked.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/storage/_columns.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/storage/_kinds.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/storage/_manifest.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/storage/_parsed.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/storage/_references.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/storage/_synthetic.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/storage/_trim.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/storage/schema.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/testing.py +0 -0
- {sdmxlib-0.78.0 → sdmxlib-0.79.0}/src/sdmxlib/versions.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sdmxlib
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.79.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
|
|
@@ -159,6 +159,7 @@ from sdmxlib.model import (
|
|
|
159
159
|
InclusionMode,
|
|
160
160
|
InMemoryRegistry,
|
|
161
161
|
InternationalString,
|
|
162
|
+
InvalidTagError,
|
|
162
163
|
ItemExpr,
|
|
163
164
|
ItemList,
|
|
164
165
|
ItemMap,
|
|
@@ -169,9 +170,13 @@ from sdmxlib.model import (
|
|
|
169
170
|
TimeRange,
|
|
170
171
|
Level,
|
|
171
172
|
Link,
|
|
173
|
+
LocalisedString,
|
|
174
|
+
MissingTagError,
|
|
172
175
|
RepresentationMapping,
|
|
173
176
|
SourceValue,
|
|
174
177
|
item,
|
|
178
|
+
normalize_tag,
|
|
179
|
+
tag_alias,
|
|
175
180
|
Maintainable,
|
|
176
181
|
MaintainableArtefact,
|
|
177
182
|
MapDataType,
|
|
@@ -330,6 +335,7 @@ __all__ = [
|
|
|
330
335
|
"InMemoryRegistry",
|
|
331
336
|
"InclusionMode",
|
|
332
337
|
"InternationalString",
|
|
338
|
+
"InvalidTagError",
|
|
333
339
|
"ItemExpr",
|
|
334
340
|
"ItemList",
|
|
335
341
|
"ItemMap",
|
|
@@ -340,6 +346,7 @@ __all__ = [
|
|
|
340
346
|
"Level",
|
|
341
347
|
"Link",
|
|
342
348
|
"LocalRegistry",
|
|
349
|
+
"LocalisedString",
|
|
343
350
|
"LossyReadError",
|
|
344
351
|
"Maintainable",
|
|
345
352
|
"MaintainableArtefact",
|
|
@@ -358,6 +365,7 @@ __all__ = [
|
|
|
358
365
|
"MetadataSet",
|
|
359
366
|
"MetadataStructure",
|
|
360
367
|
"Metadataflow",
|
|
368
|
+
"MissingTagError",
|
|
361
369
|
"Num",
|
|
362
370
|
"ObsQuery",
|
|
363
371
|
"ObsRow",
|
|
@@ -445,12 +453,14 @@ __all__ = [
|
|
|
445
453
|
"from_dict",
|
|
446
454
|
"item",
|
|
447
455
|
"len",
|
|
456
|
+
"normalize_tag",
|
|
448
457
|
"parse",
|
|
449
458
|
"parse_components",
|
|
450
459
|
"q",
|
|
451
460
|
"read",
|
|
452
461
|
"schema",
|
|
453
462
|
"serialize",
|
|
463
|
+
"tag_alias",
|
|
454
464
|
"to_dict",
|
|
455
465
|
"to_json",
|
|
456
466
|
"to_xml",
|
|
@@ -96,6 +96,9 @@ publishes through `write_manifest(extensions=...)`.
|
|
|
96
96
|
- `check_on_open` writes a stamp only after a clean `receive` check, and only
|
|
97
97
|
to a path made of exactly two plain components under the stamps directory.
|
|
98
98
|
- `settle_lake` never deletes files from `data/`.
|
|
99
|
+
- `check_bundle`'s `tags` check, at `publish` and `receive`, reports every
|
|
100
|
+
stored language tag `normalize_tag` would change or refuse: a store built
|
|
101
|
+
before GH-280 from a source that sent one.
|
|
99
102
|
- A publication with a lake is refused when a coded column holds a value
|
|
100
103
|
outside its codelist. The survey scans every binding before refusing, and
|
|
101
104
|
stores availability only when nothing is refused.
|
|
@@ -79,7 +79,7 @@ def _plain(value: object, path: str) -> _Plain:
|
|
|
79
79
|
case Ref():
|
|
80
80
|
return str(value.urn)
|
|
81
81
|
case InternationalString():
|
|
82
|
-
return
|
|
82
|
+
return dict(value._backing())
|
|
83
83
|
case Annotations() | ItemList() | list() | tuple():
|
|
84
84
|
return [_plain(item, f"{path}[{i}]") for i, item in enumerate(value)]
|
|
85
85
|
case set() | frozenset():
|
|
@@ -44,6 +44,7 @@ from sdmxlib.storage._manifest import (
|
|
|
44
44
|
read_manifest,
|
|
45
45
|
)
|
|
46
46
|
from sdmxlib.storage._references import unresolved_references
|
|
47
|
+
from sdmxlib.storage._tags import stale_tags
|
|
47
48
|
from sdmxlib.storage.schema import StoreSchemaError
|
|
48
49
|
|
|
49
50
|
#: Where a check runs: where the bundle is built, where it lands, or where a
|
|
@@ -105,6 +106,7 @@ def check_bundle(
|
|
|
105
106
|
| lake: current files at their recorded size, no delete file, every referenced file listed | yes | yes | no |
|
|
106
107
|
| bindings: the manifest's, each with the count it gives | yes | yes | no |
|
|
107
108
|
| references: every stored reference names something in the store | yes | yes | no |
|
|
109
|
+
| tags: every stored language tag is in the form `normalize_tag` gives | yes | yes | no |
|
|
108
110
|
| fingerprints: recomputed, equal to the manifest's | yes | with `fingerprints` | no |
|
|
109
111
|
| availability: coded columns hold codes; stored availability is the data's | yes | no | no |
|
|
110
112
|
| expect: fingerprints equal to an earlier manifest's | with `expect` | with `expect` | with `expect` |
|
|
@@ -248,7 +250,11 @@ def _steps(
|
|
|
248
250
|
if at != "open":
|
|
249
251
|
if (root / "lake.ducklake").exists():
|
|
250
252
|
steps.append(("lake", partial(_lake, root, manifest, reg)))
|
|
251
|
-
steps += [
|
|
253
|
+
steps += [
|
|
254
|
+
("bindings", partial(_bindings, manifest, reg)),
|
|
255
|
+
("references", partial(_references, reg)),
|
|
256
|
+
("tags", partial(_tags, reg)),
|
|
257
|
+
]
|
|
252
258
|
if at == "publish" or fingerprints:
|
|
253
259
|
steps.append(("fingerprints", partial(_fingerprints, root, manifest, reg)))
|
|
254
260
|
if at == "publish":
|
|
@@ -669,6 +675,19 @@ def _bindings(manifest: Manifest, reg: BundleRegistry) -> list[Finding]:
|
|
|
669
675
|
return findings
|
|
670
676
|
|
|
671
677
|
|
|
678
|
+
def _tags(reg: BundleRegistry) -> list[Finding]:
|
|
679
|
+
"""A store built before tags were normalised (GH-280) answers Python reads and SQL lookups differently."""
|
|
680
|
+
return [
|
|
681
|
+
Finding(
|
|
682
|
+
"tags",
|
|
683
|
+
where,
|
|
684
|
+
f"holds the language tag {tag[:64]!r}, which normalize_tag would change or refuse; "
|
|
685
|
+
"rebuild the store from its sources (docs/upgrading.md)",
|
|
686
|
+
)
|
|
687
|
+
for where, tag in stale_tags(reg.connection)
|
|
688
|
+
]
|
|
689
|
+
|
|
690
|
+
|
|
672
691
|
def _references(reg: BundleRegistry) -> list[Finding]:
|
|
673
692
|
return [
|
|
674
693
|
Finding("references", u.source, f"its {u.role} reference {u.target} is not in the bundle")
|
|
@@ -37,7 +37,7 @@ from sdmxlib.model._refshape import item_fields
|
|
|
37
37
|
from sdmxlib.model.annotations import Annotation
|
|
38
38
|
from sdmxlib.model.base import MaintainableArtefact
|
|
39
39
|
from sdmxlib.model.collections import ArtefactList, ItemList, SdmxItem
|
|
40
|
-
from sdmxlib.model.istring import InternationalString
|
|
40
|
+
from sdmxlib.model.istring import InternationalString, _normalized, normalize_tag
|
|
41
41
|
from sdmxlib.model.message import StructureMessage
|
|
42
42
|
from sdmxlib.model.urn import SdmxUrn
|
|
43
43
|
from sdmxlib.storage._manifest import Manifest, read_manifest
|
|
@@ -100,6 +100,15 @@ class OverlayAnnotation(msgspec.Struct, frozen=True, kw_only=True, forbid_unknow
|
|
|
100
100
|
value: str | None = None
|
|
101
101
|
text: dict[str, str] = msgspec.field(default_factory=dict)
|
|
102
102
|
|
|
103
|
+
def __post_init__(self) -> None:
|
|
104
|
+
"""Refuse a malformed tag in `text`, or two of one tag; msgspec reports it as the document's decode error.
|
|
105
|
+
|
|
106
|
+
Raises:
|
|
107
|
+
ValueError: If a key of `text` is not a well-formed language tag,
|
|
108
|
+
or two keys normalise to one tag.
|
|
109
|
+
"""
|
|
110
|
+
_normalized(self.text)
|
|
111
|
+
|
|
103
112
|
|
|
104
113
|
class OverlayEntry(msgspec.Struct, frozen=True, kw_only=True, forbid_unknown_fields=True):
|
|
105
114
|
"""One change: which targets, what to do, to annotations of which type.
|
|
@@ -135,7 +144,9 @@ class OverlayText(msgspec.Struct, frozen=True, kw_only=True, forbid_unknown_fiel
|
|
|
135
144
|
op: ``set`` writes `text` as the `lang` text; ``remove`` drops the
|
|
136
145
|
`lang` text. A name keeps at least one language.
|
|
137
146
|
field: ``name`` or ``description``.
|
|
138
|
-
lang: The language tag it acts on.
|
|
147
|
+
lang: The language tag it acts on. A malformed one raises
|
|
148
|
+
`ValueError` (`normalize_tag`); `fold_overlays` applies it
|
|
149
|
+
normalised.
|
|
139
150
|
text: What ``set`` writes; absent for ``remove``.
|
|
140
151
|
scope: As `OverlayEntry`'s.
|
|
141
152
|
"""
|
|
@@ -147,6 +158,14 @@ class OverlayText(msgspec.Struct, frozen=True, kw_only=True, forbid_unknown_fiel
|
|
|
147
158
|
text: str | None = None
|
|
148
159
|
scope: str | None = None
|
|
149
160
|
|
|
161
|
+
def __post_init__(self) -> None:
|
|
162
|
+
"""Refuse a malformed `lang`; msgspec reports it as the document's decode error.
|
|
163
|
+
|
|
164
|
+
Raises:
|
|
165
|
+
ValueError: If `lang` is not a well-formed language tag.
|
|
166
|
+
"""
|
|
167
|
+
normalize_tag(self.lang)
|
|
168
|
+
|
|
150
169
|
|
|
151
170
|
class Overlay(msgspec.Struct, frozen=True, kw_only=True, forbid_unknown_fields=True, omit_defaults=True):
|
|
152
171
|
"""A versioned overlay document: an id, its annotation entries and its name and description texts, in order.
|
|
@@ -197,9 +216,6 @@ def read_overlay(path: str | Path) -> Overlay:
|
|
|
197
216
|
"gives no text" if text.text is None else "removes, so gives no text"
|
|
198
217
|
)
|
|
199
218
|
raise OverlayError(msg)
|
|
200
|
-
if not text.lang:
|
|
201
|
-
msg = f"{path}: text {n} ({text.op} {text.field}) names no language"
|
|
202
|
-
raise OverlayError(msg)
|
|
203
219
|
return overlay
|
|
204
220
|
|
|
205
221
|
|
|
@@ -474,15 +490,16 @@ class _Plan:
|
|
|
474
490
|
if current is None:
|
|
475
491
|
held: object = getattr(owner, text.field, None)
|
|
476
492
|
current = dict(held.as_dict()) if isinstance(held, InternationalString) else {}
|
|
493
|
+
lang = normalize_tag(text.lang)
|
|
477
494
|
if text.op == "set" and text.text is not None:
|
|
478
|
-
current[
|
|
495
|
+
current[lang] = text.text
|
|
479
496
|
else:
|
|
480
|
-
current.pop(
|
|
497
|
+
current.pop(lang, None)
|
|
481
498
|
fields[text.field] = current
|
|
482
499
|
if "name" in fields and not fields["name"]:
|
|
483
500
|
msg = f"{urn}: removing the last language of its name; a name keeps at least one"
|
|
484
501
|
raise OverlayError(msg)
|
|
485
|
-
return
|
|
502
|
+
return dict(fields)
|
|
486
503
|
|
|
487
504
|
def _apply(self, entry: OverlayEntry, current: list[Annotation]) -> list[Annotation]:
|
|
488
505
|
kept = [a for a in current if a.type != entry.type]
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
},
|
|
133
133
|
"OverlayText": {
|
|
134
134
|
"title": "OverlayText",
|
|
135
|
-
"description": "One language of a name or description, set or removed. Only `fold_overlays` applies it.\n\nA name is structure: it feeds search and every label map, so a change to\none is written into a new publication rather than applied as a response\nis served (design §5.4).\n\nAttributes:\n selector: ``*``, a class name, ``AGENCY:ID``, or a URN, as for an entry.\n op: ``set`` writes `text` as the `lang` text; ``remove`` drops the\n `lang` text. A name keeps at least one language.\n field: ``name`` or ``description``.\n lang: The language tag it acts on.\n text: What ``set`` writes; absent for ``remove``.\n scope: As `OverlayEntry`'s.",
|
|
135
|
+
"description": "One language of a name or description, set or removed. Only `fold_overlays` applies it.\n\nA name is structure: it feeds search and every label map, so a change to\none is written into a new publication rather than applied as a response\nis served (design §5.4).\n\nAttributes:\n selector: ``*``, a class name, ``AGENCY:ID``, or a URN, as for an entry.\n op: ``set`` writes `text` as the `lang` text; ``remove`` drops the\n `lang` text. A name keeps at least one language.\n field: ``name`` or ``description``.\n lang: The language tag it acts on. A malformed one raises\n `ValueError` (`normalize_tag`); `fold_overlays` applies it\n normalised.\n text: What ``set`` writes; absent for ``remove``.\n scope: As `OverlayEntry`'s.",
|
|
136
136
|
"type": "object",
|
|
137
137
|
"properties": {
|
|
138
138
|
"selector": {
|
|
@@ -73,6 +73,12 @@ target format cannot carry.
|
|
|
73
73
|
- A refused artefact is never partly built. References to it stay unresolved.
|
|
74
74
|
- A malformed value in a payload raises `SdmxParseError`, never a bare
|
|
75
75
|
`ValueError`.
|
|
76
|
+
- Every language tag is read through `_tags.py`, so a malformed tag, an
|
|
77
|
+
empty `xml:lang` or two texts of one tag refuse the artefact carrying them
|
|
78
|
+
(GH-280). An SDMX-ML `xml:lang` has its whitespace collapsed, as the
|
|
79
|
+
schema's `xs:language` does, and is English when absent. In a header, such
|
|
80
|
+
a tag reads as no header and a `ReadGap`, as any header the model cannot
|
|
81
|
+
hold does.
|
|
76
82
|
- Gaps in dimension positions are accepted, with a base of 0 or 1. Only
|
|
77
83
|
positions that contradict document order, or a repeated position, are
|
|
78
84
|
refused.
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"""Language tags as the readers meet them (GH-280).
|
|
2
|
+
|
|
3
|
+
`normalize_tag` raises `ValueError`, which no reader catches: `build_each`
|
|
4
|
+
refuses an artefact for a `SdmxConformanceError` and lets anything else
|
|
5
|
+
through as a defect. So the readers normalise every tag here, and a tag that
|
|
6
|
+
is not well-formed, or two texts of one tag, contradict the document as any
|
|
7
|
+
other schema violation does and refuse the artefact that carries them.
|
|
8
|
+
|
|
9
|
+
SDMX-ML's ``xml:lang`` is an ``xs:language``, a token type, so a schema
|
|
10
|
+
validator collapses its whitespace before checking it: ``xml:lang=" en "`` is
|
|
11
|
+
``en``. `xml_tag` does the same. An absent ``xml:lang`` is English, as every
|
|
12
|
+
SDMX-ML schema declares (`SCHEMA_DEFAULT_LANG`).
|
|
13
|
+
|
|
14
|
+
SDMX-JSON allows a lone ``name`` with no ``names`` map, which states no
|
|
15
|
+
language. When the message's ``meta.contentLanguages`` lists exactly one, every
|
|
16
|
+
text in the message is in it, and `current_message_language` gives it; otherwise the
|
|
17
|
+
reader refuses the text (`formats.sdmx_json._dto.ingest_istr`).
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
from collections.abc import Generator, Iterable
|
|
21
|
+
from contextlib import contextmanager
|
|
22
|
+
from contextvars import ContextVar
|
|
23
|
+
|
|
24
|
+
from lxml import etree
|
|
25
|
+
|
|
26
|
+
from sdmxlib.model.istring import InternationalString, normalize_tag
|
|
27
|
+
from sdmxlib.model.validation import SdmxConformanceError
|
|
28
|
+
|
|
29
|
+
XML_LANG = "{http://www.w3.org/XML/1998/namespace}lang"
|
|
30
|
+
|
|
31
|
+
#: The language of a `TextType` or `XHTMLType` element with no ``xml:lang``.
|
|
32
|
+
#: Not a library default: every SDMX-ML schema declares the attribute
|
|
33
|
+
#: ``default="en"``, so the element *is* English. The readers dropped it
|
|
34
|
+
#: instead, and an artefact named only that way lost its name unreported (#422).
|
|
35
|
+
SCHEMA_DEFAULT_LANG = "en"
|
|
36
|
+
|
|
37
|
+
#: The characters XML Schema's whitespace collapse removes.
|
|
38
|
+
_XML_SPACE = " \t\r\n"
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def tag(raw: str, where: str) -> str:
|
|
42
|
+
"""`raw` normalised, or a refusal naming `where`.
|
|
43
|
+
|
|
44
|
+
Raises:
|
|
45
|
+
SdmxConformanceError: If `raw` is not a well-formed language tag.
|
|
46
|
+
"""
|
|
47
|
+
try:
|
|
48
|
+
return normalize_tag(raw)
|
|
49
|
+
except ValueError as exc:
|
|
50
|
+
raise SdmxConformanceError(where, str(exc)) from None
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def xml_tag(el: etree._Element, where: str) -> str:
|
|
54
|
+
"""`el`'s ``xml:lang``, collapsed and normalised; English when absent.
|
|
55
|
+
|
|
56
|
+
Raises:
|
|
57
|
+
SdmxConformanceError: If the attribute is present and empty, or not a
|
|
58
|
+
well-formed tag.
|
|
59
|
+
"""
|
|
60
|
+
raw = el.get(XML_LANG)
|
|
61
|
+
return SCHEMA_DEFAULT_LANG if raw is None else tag(raw.strip(_XML_SPACE), where)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def optional_xml_tag(el: etree._Element, where: str) -> str | None:
|
|
65
|
+
"""`el`'s ``xml:lang``, collapsed and normalised; None when absent.
|
|
66
|
+
|
|
67
|
+
For an annotation URL and a constraint's value, whose language is
|
|
68
|
+
optional and has no schema default.
|
|
69
|
+
|
|
70
|
+
Raises:
|
|
71
|
+
SdmxConformanceError: If the attribute is present and empty, or not a
|
|
72
|
+
well-formed tag.
|
|
73
|
+
"""
|
|
74
|
+
raw = el.get(XML_LANG)
|
|
75
|
+
return None if raw is None else tag(raw.strip(_XML_SPACE), where)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def texts(pairs: Iterable[tuple[str, str]], where: str) -> InternationalString:
|
|
79
|
+
"""An `InternationalString` from `(tag, text)` pairs, each tag normalised.
|
|
80
|
+
|
|
81
|
+
Raises:
|
|
82
|
+
SdmxConformanceError: If a tag is not well-formed, or two normalise to
|
|
83
|
+
one tag: the document gives two texts for one language, and sdmxlib
|
|
84
|
+
never chooses between them.
|
|
85
|
+
"""
|
|
86
|
+
data: dict[str, str] = {}
|
|
87
|
+
for raw, text in pairs:
|
|
88
|
+
lang = tag(raw, where)
|
|
89
|
+
if lang in data:
|
|
90
|
+
raise SdmxConformanceError(where, f"two texts for language {lang!r}")
|
|
91
|
+
data[lang] = text
|
|
92
|
+
return InternationalString._from_normalized(data)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def xml_texts(elements: Iterable[etree._Element], where: str) -> InternationalString:
|
|
96
|
+
"""An `InternationalString` from SDMX-ML text elements, as `texts` builds one.
|
|
97
|
+
|
|
98
|
+
An empty element is read as the empty text it is (#452).
|
|
99
|
+
|
|
100
|
+
Raises:
|
|
101
|
+
SdmxConformanceError: As `texts`, and for an empty ``xml:lang``.
|
|
102
|
+
"""
|
|
103
|
+
data: dict[str, str] = {}
|
|
104
|
+
for el in elements:
|
|
105
|
+
lang = xml_tag(el, where)
|
|
106
|
+
if lang in data:
|
|
107
|
+
raise SdmxConformanceError(where, f"two texts for language {lang!r}")
|
|
108
|
+
data[lang] = el.text or ""
|
|
109
|
+
return InternationalString._from_normalized(data)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
#: The one language a SDMX-JSON message declares in ``meta.contentLanguages``,
|
|
113
|
+
#: while it is read. A context variable, as `_common.hierarchy_containers`'s
|
|
114
|
+
#: is: the readers are shared, and reads may overlap.
|
|
115
|
+
_MESSAGE_LANGUAGE: ContextVar[str | None] = ContextVar("sdmxlib_message_language", default=None)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
@contextmanager
|
|
119
|
+
def message_language(content_languages: list[str] | None) -> Generator[None]:
|
|
120
|
+
"""Make the message's one declared language, if it declares one, `current_message_language` inside.
|
|
121
|
+
|
|
122
|
+
Raises:
|
|
123
|
+
SdmxConformanceError: If an entry of ``contentLanguages`` is not a
|
|
124
|
+
well-formed tag. Raised outside any artefact, so it fails the read.
|
|
125
|
+
"""
|
|
126
|
+
langs = {tag(each, "contentLanguages") for each in content_languages or ()}
|
|
127
|
+
token = _MESSAGE_LANGUAGE.set(next(iter(langs)) if len(langs) == 1 else None)
|
|
128
|
+
try:
|
|
129
|
+
yield
|
|
130
|
+
finally:
|
|
131
|
+
_MESSAGE_LANGUAGE.reset(token)
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def current_message_language() -> str | None:
|
|
135
|
+
"""The language every text of the SDMX-JSON message being read is in, when it declares exactly one."""
|
|
136
|
+
return _MESSAGE_LANGUAGE.get()
|
|
@@ -80,8 +80,12 @@ serialisers in `structure_values.py`.
|
|
|
80
80
|
`check_writable(..., "json")`, or for a constraint with a date-time period
|
|
81
81
|
that has no zone. Both checks finish before any encoding.
|
|
82
82
|
- Pretty printing uses `msgspec.json.format(indent=2)`.
|
|
83
|
-
- A singular `name`
|
|
84
|
-
language.
|
|
83
|
+
- A singular `name` (or `description`, `text`) with no map states no
|
|
84
|
+
language. It is read in the language `meta.contentLanguages` declares when
|
|
85
|
+
it declares exactly one, and refuses the artefact otherwise (GH-280). A
|
|
86
|
+
malformed `contentLanguages` entry fails the read. msgspec keeps the last
|
|
87
|
+
of two equal keys in a JSON object, so an exact duplicate key cannot be
|
|
88
|
+
seen; two keys of one tag in different case refuse the artefact.
|
|
85
89
|
- `read_observations` (`data.py`) raises `SdmxParseError` for bytes that are
|
|
86
90
|
not a readable data message, with msgspec's error as `__cause__`: a wrong
|
|
87
91
|
shape, an observation key or attribute position outside its declaration, a
|
|
@@ -26,7 +26,7 @@ from sdmxlib.model.codelist import Code, CodelistLike, codes_for_all
|
|
|
26
26
|
from sdmxlib.model.dataflow import Dataflow
|
|
27
27
|
from sdmxlib.model.datastructure import Component, DataStructure, Dimension
|
|
28
28
|
from sdmxlib.model.errors import SdmxParseError
|
|
29
|
-
from sdmxlib.model.istring import InternationalString
|
|
29
|
+
from sdmxlib.model.istring import InternationalString, normalize_tag
|
|
30
30
|
from sdmxlib.model.ref import Ref
|
|
31
31
|
|
|
32
32
|
from ._dto import ENCODER, _camel_rename
|
|
@@ -170,15 +170,14 @@ def _convention_duration(freq_id: str) -> _Duration | None:
|
|
|
170
170
|
|
|
171
171
|
def _first_text(istr: InternationalString) -> str | None:
|
|
172
172
|
"""First localized value of an InternationalString, or None if empty."""
|
|
173
|
-
|
|
174
|
-
return first[1] if first is not None else None
|
|
173
|
+
return next(iter(istr._backing().values()), None)
|
|
175
174
|
|
|
176
175
|
|
|
177
176
|
def _annotation_duration(annotations: Annotations, lang: str) -> _Duration | None:
|
|
178
177
|
"""Duration from a ``duration`` annotation (case-insensitive type), if any."""
|
|
179
178
|
for ann in annotations:
|
|
180
179
|
if ann.type and ann.type.strip().lower() == "duration":
|
|
181
|
-
text = ann.text.
|
|
180
|
+
text = ann.text._text(lang) or _first_text(ann.text)
|
|
182
181
|
if text:
|
|
183
182
|
return _parse_iso_duration(text)
|
|
184
183
|
return None
|
|
@@ -337,7 +336,7 @@ class ComponentTable:
|
|
|
337
336
|
# component id -> its own annotation indices, resolved once here since
|
|
338
337
|
# the component set is fixed at construction.
|
|
339
338
|
self._component_annotations: dict[str, list[int]] = {}
|
|
340
|
-
self._lang = lang
|
|
339
|
+
self._lang = normalize_tag(lang)
|
|
341
340
|
self._kind = kind
|
|
342
341
|
self._time_dim_id = time_dim_id
|
|
343
342
|
# FREQ-driven period bounds (issue #149): the frequency dimension id,
|
|
@@ -383,7 +382,7 @@ class ComponentTable:
|
|
|
383
382
|
continue
|
|
384
383
|
name = cid
|
|
385
384
|
if isinstance(comp.concept, Ref) and comp.concept.resolved:
|
|
386
|
-
cname = comp.concept().name.
|
|
385
|
+
cname = comp.concept().name._text(self._lang)
|
|
387
386
|
if cname:
|
|
388
387
|
name = cname
|
|
389
388
|
self._names[cid] = name
|
|
@@ -438,7 +437,7 @@ class ComponentTable:
|
|
|
438
437
|
|
|
439
438
|
def _fill_entry(self, entry: dict[str, object], code: Code) -> None:
|
|
440
439
|
"""Write one resolved *code*'s name, ``parent`` and annotations into *entry*."""
|
|
441
|
-
entry["name"] = code.name.
|
|
440
|
+
entry["name"] = code.name._text(self._lang) or code.id
|
|
442
441
|
# A value's hierarchy edge (#365). `parent` is a first-class property of
|
|
443
442
|
# this object in the 1.0, 2.0 and 2.1 data schemas, and omitting it made
|
|
444
443
|
# every hierarchical codelist arrive flat: the .Stat Data Explorer groups
|
|
@@ -757,7 +756,11 @@ def display_names(
|
|
|
757
756
|
consumers like .Stat read the dataflow's display name to title
|
|
758
757
|
the dataset — falling through to the DSD only matters when the
|
|
759
758
|
caller passed ``Ref.unresolved(...)``.
|
|
759
|
+
|
|
760
|
+
Raises:
|
|
761
|
+
ValueError: If `lang` is not a well-formed language tag.
|
|
760
762
|
"""
|
|
763
|
+
lang = normalize_tag(lang)
|
|
761
764
|
# Either the resolved Dataflow or the DSD — both are nameable, and the
|
|
762
765
|
# dataflow wins when it has a name (SDMX-JSON data messages wrap a flow).
|
|
763
766
|
src: Dataflow | DataStructure = dsd
|
|
@@ -769,19 +772,19 @@ def display_names(
|
|
|
769
772
|
out: DisplayNamesJson = {}
|
|
770
773
|
name_attr: InternationalString | None = getattr(src, "name", None)
|
|
771
774
|
if name_attr:
|
|
772
|
-
localized = name_attr.
|
|
775
|
+
localized = name_attr._text(lang)
|
|
773
776
|
if localized:
|
|
774
777
|
out["name"] = localized
|
|
775
|
-
names_map =
|
|
778
|
+
names_map = name_attr.as_dict()
|
|
776
779
|
if names_map:
|
|
777
780
|
out["names"] = names_map
|
|
778
781
|
|
|
779
782
|
desc_attr: InternationalString | None = getattr(src, "description", None)
|
|
780
783
|
if desc_attr:
|
|
781
|
-
d_localized = desc_attr.
|
|
784
|
+
d_localized = desc_attr._text(lang)
|
|
782
785
|
if d_localized:
|
|
783
786
|
out["description"] = d_localized
|
|
784
|
-
descs_map =
|
|
787
|
+
descs_map = desc_attr.as_dict()
|
|
785
788
|
if descs_map:
|
|
786
789
|
out["descriptions"] = descs_map
|
|
787
790
|
return out
|
|
@@ -42,17 +42,12 @@ from datetime import datetime
|
|
|
42
42
|
|
|
43
43
|
import msgspec
|
|
44
44
|
|
|
45
|
+
from sdmxlib.formats._tags import current_message_language, tag, texts
|
|
45
46
|
from sdmxlib.model.annotations import Annotation as _ModelAnnotation
|
|
46
47
|
from sdmxlib.model.annotations import Annotations, AnnotationURL
|
|
47
48
|
from sdmxlib.model.istring import InternationalString
|
|
48
49
|
from sdmxlib.model.validation import SdmxConformanceError, _first_xml_incompatible
|
|
49
50
|
|
|
50
|
-
# Sentinel language used when a producer sends a singular ``name`` with no
|
|
51
|
-
# ``names`` map — we can't know the real language tag, so we mirror the
|
|
52
|
-
# dict-reader's behaviour and key it under ``_default``.
|
|
53
|
-
_DEFAULT_LANG = "_default"
|
|
54
|
-
|
|
55
|
-
|
|
56
51
|
# ── Wire-name convention ─────────────────────────────────────────────────────
|
|
57
52
|
# Struct fields are snake_case; `rename=_camel_rename` maps them to the SDMX-JSON
|
|
58
53
|
# camelCase wire names (msgspec's equivalent of pydantic's alias_generator).
|
|
@@ -96,21 +91,24 @@ def emit_istr(v: InternationalString | None) -> tuple[str | None, dict[str, str]
|
|
|
96
91
|
|
|
97
92
|
Returns ``(None, None)`` for an empty/absent istring so ``omit_defaults``
|
|
98
93
|
drops both the singular and plural fields. Delegates to
|
|
99
|
-
`InternationalString.
|
|
94
|
+
`InternationalString._emit_pair`, which does the empty-check + best-match +
|
|
100
95
|
backing-map fetch in one call (the map is shared, not copied: it feeds a
|
|
101
96
|
transient DTO that msgspec encodes and we then discard, so it is never
|
|
102
97
|
mutated).
|
|
103
98
|
"""
|
|
104
|
-
return v.
|
|
99
|
+
return v._emit_pair() if v is not None else (None, None)
|
|
105
100
|
|
|
106
101
|
|
|
107
|
-
def ingest_istr(name: str | None, names: dict[str, str] | None) ->
|
|
108
|
-
"""
|
|
102
|
+
def ingest_istr(name: str | None, names: dict[str, str] | None, field: str) -> InternationalString:
|
|
103
|
+
"""An ``InternationalString`` from a wire ``(name, names)`` pair.
|
|
109
104
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
105
|
+
The ``names`` map is the text, one entry per language, each tag
|
|
106
|
+
normalised (GH-280). A singular ``name`` with no ``names`` states no
|
|
107
|
+
language, though the schemas allow it, and the information model holds
|
|
108
|
+
every text under its locale. It takes the message's language when
|
|
109
|
+
``meta.contentLanguages`` declares exactly one
|
|
110
|
+
(`formats._tags.current_message_language`), and is refused otherwise.
|
|
111
|
+
Empty when neither is present.
|
|
114
112
|
|
|
115
113
|
Rejects text XML cannot represent. JSON permits ``\u0000`` in a string and
|
|
116
114
|
XML does not, so without this check the two readers disagreed about what a
|
|
@@ -120,27 +118,40 @@ def ingest_istr(name: str | None, names: dict[str, str] | None) -> dict[str, str
|
|
|
120
118
|
#190 established for non-conformant references.
|
|
121
119
|
|
|
122
120
|
Args:
|
|
123
|
-
name: The singular ``name
|
|
124
|
-
names: The full language map, if present.
|
|
121
|
+
name: The singular field, such as ``name``, if present.
|
|
122
|
+
names: The full language map, such as ``names``, if present.
|
|
123
|
+
field: The singular field's wire name, to name it in a refusal.
|
|
125
124
|
|
|
126
125
|
Returns:
|
|
127
|
-
The
|
|
126
|
+
The text in every language the map gives.
|
|
128
127
|
|
|
129
128
|
Raises:
|
|
130
|
-
SdmxConformanceError: If
|
|
129
|
+
SdmxConformanceError: If a value contains a character XML forbids, a
|
|
130
|
+
tag is not well-formed, two tags normalise to one, or ``name``
|
|
131
|
+
comes with no map in a message that declares no single language.
|
|
131
132
|
"""
|
|
132
|
-
|
|
133
|
-
|
|
133
|
+
if not names:
|
|
134
|
+
if not name:
|
|
135
|
+
return InternationalString.EMPTY
|
|
136
|
+
lang = current_message_language()
|
|
137
|
+
if lang is None:
|
|
138
|
+
detail = (
|
|
139
|
+
f"a {field!r} with no {field + 's'!r} map states no language, and meta.contentLanguages "
|
|
140
|
+
"does not declare exactly one; SDMX holds every text under its language"
|
|
141
|
+
)
|
|
142
|
+
raise SdmxConformanceError(field, detail)
|
|
143
|
+
names = {lang: name}
|
|
144
|
+
for lang, text in names.items():
|
|
134
145
|
bad = _first_xml_incompatible(text)
|
|
135
146
|
if bad is not None:
|
|
136
|
-
where = f"
|
|
147
|
+
where = f"{field}[{lang}]"
|
|
137
148
|
detail = (
|
|
138
149
|
f"contains U+{ord(bad):04X}, which XML cannot represent. SDMX string "
|
|
139
150
|
"types are XSD types, so this value has no valid SDMX-ML form — JSON "
|
|
140
151
|
"accepts it but the artefact could never be serialised back to XML."
|
|
141
152
|
)
|
|
142
153
|
raise SdmxConformanceError(where, detail)
|
|
143
|
-
return
|
|
154
|
+
return texts(names.items(), field + "s")
|
|
144
155
|
|
|
145
156
|
|
|
146
157
|
# ── Wire Struct base ─────────────────────────────────────────────────────────
|
|
@@ -286,7 +297,11 @@ def _annotation_urls(a: Annotation) -> list[AnnotationURL]:
|
|
|
286
297
|
``AnnotationURL``s, each localised by ``hreflang`` and carrying the
|
|
287
298
|
link's ``urn`` and ``type`` (#422).
|
|
288
299
|
"""
|
|
289
|
-
urls = [
|
|
300
|
+
urls = [
|
|
301
|
+
AnnotationURL(link.href, None if link.hreflang is None else tag(link.hreflang, "hreflang"), link.urn, link.type)
|
|
302
|
+
for link in a.links or []
|
|
303
|
+
if link.href
|
|
304
|
+
]
|
|
290
305
|
if not urls and a.url:
|
|
291
306
|
urls.append(AnnotationURL(a.url))
|
|
292
307
|
return urls
|
|
@@ -309,7 +324,7 @@ def ingest_annotations(annotations: list[Annotation] | None) -> Annotations:
|
|
|
309
324
|
title=a.title,
|
|
310
325
|
type=a.type,
|
|
311
326
|
urls=_annotation_urls(a),
|
|
312
|
-
text=ingest_istr(a.text, a.texts),
|
|
327
|
+
text=ingest_istr(a.text, a.texts, "text"),
|
|
313
328
|
value=a.value,
|
|
314
329
|
)
|
|
315
330
|
for a in annotations
|