cognite-neat 0.88.1__tar.gz → 0.88.2__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.
Potentially problematic release.
This version of cognite-neat might be problematic. Click here for more details.
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/PKG-INFO +1 -1
- cognite_neat-0.88.2/cognite/neat/_version.py +1 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/exceptions.py +2 -2
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/loaders/_base.py +4 -4
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/loaders/_rdf2asset.py +12 -14
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/loaders/_rdf2dms.py +14 -10
- cognite_neat-0.88.2/cognite/neat/issues/__init__.py +16 -0
- cognite_neat-0.88.1/cognite/neat/issues.py → cognite_neat-0.88.2/cognite/neat/issues/_base.py +73 -5
- cognite_neat-0.88.2/cognite/neat/issues/errors/external.py +21 -0
- cognite_neat-0.88.2/cognite/neat/issues/errors/properties.py +75 -0
- cognite_neat-0.88.2/cognite/neat/issues/errors/resources.py +123 -0
- {cognite_neat-0.88.1/cognite/neat/rules → cognite_neat-0.88.2/cognite/neat}/issues/formatters.py +9 -9
- cognite_neat-0.88.2/cognite/neat/issues/neat_warnings/__init__.py +2 -0
- cognite_neat-0.88.2/cognite/neat/issues/neat_warnings/identifier.py +27 -0
- cognite_neat-0.88.2/cognite/neat/issues/neat_warnings/models.py +22 -0
- cognite_neat-0.88.2/cognite/neat/issues/neat_warnings/properties.py +77 -0
- cognite_neat-0.88.2/cognite/neat/issues/neat_warnings/resources.py +125 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/exporters/_rules2dms.py +3 -2
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/exporters/_validation.py +2 -2
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/importers/__init__.py +7 -3
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/importers/_base.py +3 -3
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/importers/_dms2rules.py +39 -18
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/importers/_dtdl2rules/dtdl_converter.py +44 -53
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/importers/_dtdl2rules/dtdl_importer.py +6 -5
- cognite_neat-0.88.2/cognite/neat/rules/importers/_rdf/_imf2rules/__init__.py +3 -0
- cognite_neat-0.88.2/cognite/neat/rules/importers/_rdf/_imf2rules/_imf2classes.py +82 -0
- cognite_neat-0.88.2/cognite/neat/rules/importers/_rdf/_imf2rules/_imf2metadata.py +34 -0
- cognite_neat-0.88.2/cognite/neat/rules/importers/_rdf/_imf2rules/_imf2properties.py +123 -0
- cognite_neat-0.88.1/cognite/neat/rules/importers/_owl2rules/_owl2rules.py → cognite_neat-0.88.2/cognite/neat/rules/importers/_rdf/_imf2rules/_imf2rules.py +15 -11
- {cognite_neat-0.88.1/cognite/neat/rules/importers → cognite_neat-0.88.2/cognite/neat/rules/importers/_rdf}/_inference2rules.py +1 -1
- cognite_neat-0.88.2/cognite/neat/rules/importers/_rdf/_owl2rules/_owl2classes.py +57 -0
- cognite_neat-0.88.2/cognite/neat/rules/importers/_rdf/_owl2rules/_owl2metadata.py +68 -0
- cognite_neat-0.88.2/cognite/neat/rules/importers/_rdf/_owl2rules/_owl2properties.py +59 -0
- cognite_neat-0.88.2/cognite/neat/rules/importers/_rdf/_owl2rules/_owl2rules.py +76 -0
- cognite_neat-0.88.2/cognite/neat/rules/importers/_rdf/_shared.py +586 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/importers/_spreadsheet2rules.py +1 -1
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/importers/_yaml2rules.py +2 -1
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/issues/__init__.py +1 -5
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/issues/base.py +2 -21
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/issues/dms.py +0 -134
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/issues/spreadsheet.py +3 -3
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/models/_types/_field.py +5 -2
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/models/asset/_validation.py +1 -1
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/models/dms/_schema.py +53 -30
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/models/dms/_validation.py +2 -2
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/models/entities.py +3 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/models/information/_validation.py +1 -1
- cognite_neat-0.88.2/cognite/neat/workflows/steps/__init__.py +0 -0
- cognite_neat-0.88.2/cognite/neat/workflows/steps/lib/__init__.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/workflows/steps/lib/current/rules_importer.py +73 -1
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/workflows/steps/lib/current/rules_validator.py +19 -7
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/pyproject.toml +1 -1
- cognite_neat-0.88.1/cognite/neat/_version.py +0 -1
- cognite_neat-0.88.1/cognite/neat/graph/issues/loader.py +0 -104
- cognite_neat-0.88.1/cognite/neat/rules/importers/_owl2rules/_owl2classes.py +0 -215
- cognite_neat-0.88.1/cognite/neat/rules/importers/_owl2rules/_owl2metadata.py +0 -209
- cognite_neat-0.88.1/cognite/neat/rules/importers/_owl2rules/_owl2properties.py +0 -203
- cognite_neat-0.88.1/cognite/neat/rules/issues/importing.py +0 -423
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/LICENSE +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/README.md +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/__init__.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/_shared.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/app/api/__init__.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/app/api/asgi/metrics.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/app/api/configuration.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/app/api/context_manager/__init__.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/app/api/context_manager/manager.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/app/api/data_classes/__init__.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/app/api/data_classes/rest.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/app/api/explorer.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/app/api/routers/configuration.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/app/api/routers/crud.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/app/api/routers/metrics.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/app/api/routers/workflows.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/app/api/utils/__init__.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/app/api/utils/data_mapping.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/app/api/utils/logging.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/app/api/utils/query_templates.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/app/main.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/app/monitoring/__init__.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/app/monitoring/metrics.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/app/ui/index.html +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/app/ui/neat-app/.gitignore +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/app/ui/neat-app/README.md +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/app/ui/neat-app/build/asset-manifest.json +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/app/ui/neat-app/build/favicon.ico +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/app/ui/neat-app/build/img/architect-icon.svg +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/app/ui/neat-app/build/img/developer-icon.svg +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/app/ui/neat-app/build/img/sme-icon.svg +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/app/ui/neat-app/build/index.html +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/app/ui/neat-app/build/logo192.png +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/app/ui/neat-app/build/manifest.json +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/app/ui/neat-app/build/robots.txt +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/app/ui/neat-app/build/static/css/main.72e3d92e.css +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/app/ui/neat-app/build/static/css/main.72e3d92e.css.map +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/app/ui/neat-app/build/static/js/main.5a52cf09.js +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/app/ui/neat-app/build/static/js/main.5a52cf09.js.LICENSE.txt +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/app/ui/neat-app/build/static/js/main.5a52cf09.js.map +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/app/ui/neat-app/build/static/media/logo.8093b84df9ed36a174c629d6fe0b730d.svg +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/config.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/constants.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/__init__.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/_shared.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/_tracking/__init__.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/_tracking/base.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/_tracking/log.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/examples/Knowledge-Graph-Nordic44-dirty.xml +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/examples/Knowledge-Graph-Nordic44.xml +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/examples/__init__.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/examples/skos-capturing-sheet-wind-topics.xlsx +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/exceptions.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/extractors/__init__.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/extractors/_base.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/extractors/_classic_cdf/__init__.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/extractors/_classic_cdf/_assets.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/extractors/_classic_cdf/_base.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/extractors/_classic_cdf/_events.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/extractors/_classic_cdf/_files.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/extractors/_classic_cdf/_labels.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/extractors/_classic_cdf/_relationships.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/extractors/_classic_cdf/_sequences.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/extractors/_classic_cdf/_timeseries.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/extractors/_dexpi.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/extractors/_mock_graph_generator.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/extractors/_rdf_file.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/loaders/__init__.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/models.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/queries/__init__.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/queries/_base.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/queries/_construct.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/queries/_shared.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/stores/__init__.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/stores/_base.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/stores/_provenance.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/transformers/__init__.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/transformers/_base.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/transformers/_classic_cdf.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/graph/transformers/_rdfpath.py +0 -0
- {cognite_neat-0.88.1/cognite/neat/graph/issues → cognite_neat-0.88.2/cognite/neat/issues/errors}/__init__.py +0 -0
- /cognite_neat-0.88.1/cognite/neat/py.typed → /cognite_neat-0.88.2/cognite/neat/issues/errors/schema.py +0 -0
- /cognite_neat-0.88.1/cognite/neat/rules/__init__.py → /cognite_neat-0.88.2/cognite/neat/py.typed +0 -0
- {cognite_neat-0.88.1/cognite/neat/utils → cognite_neat-0.88.2/cognite/neat/rules}/__init__.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/_shared.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/analysis/__init__.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/analysis/_asset.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/analysis/_base.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/analysis/_information.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/examples/__init__.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/examples/wind-energy.owl +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/exporters/__init__.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/exporters/_base.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/exporters/_rules2excel.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/exporters/_rules2ontology.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/exporters/_rules2yaml.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/importers/_dtdl2rules/__init__.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/importers/_dtdl2rules/_unit_lookup.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/importers/_dtdl2rules/spec.py +0 -0
- {cognite_neat-0.88.1/cognite/neat/utils/cdf → cognite_neat-0.88.2/cognite/neat/rules/importers/_rdf}/__init__.py +0 -0
- {cognite_neat-0.88.1/cognite/neat/rules/importers → cognite_neat-0.88.2/cognite/neat/rules/importers/_rdf}/_owl2rules/__init__.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/issues/fileread.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/issues/ontology.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/issues/spreadsheet_file.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/issues/tables.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/models/__init__.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/models/_base.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/models/_constants.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/models/_rdfpath.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/models/_types/__init__.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/models/asset/__init__.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/models/asset/_converter.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/models/asset/_rules.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/models/asset/_rules_input.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/models/asset/_serializer.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/models/data_types.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/models/dms/__init__.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/models/dms/_converter.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/models/dms/_exporter.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/models/dms/_rules.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/models/dms/_rules_input.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/models/dms/_serializer.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/models/domain.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/models/information/__init__.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/models/information/_converter.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/models/information/_rules.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/models/information/_rules_input.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/models/information/_serializer.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/rules/models/wrapped_entities.py +0 -0
- {cognite_neat-0.88.1/cognite/neat/workflows/steps → cognite_neat-0.88.2/cognite/neat/utils}/__init__.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/utils/auth.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/utils/auxiliary.py +0 -0
- {cognite_neat-0.88.1/cognite/neat/workflows/steps/lib → cognite_neat-0.88.2/cognite/neat/utils/cdf}/__init__.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/utils/cdf/data_classes.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/utils/cdf/loaders/__init__.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/utils/cdf/loaders/_base.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/utils/cdf/loaders/_data_modeling.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/utils/cdf/loaders/_ingestion.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/utils/collection_.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/utils/rdf_.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/utils/regex_patterns.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/utils/spreadsheet.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/utils/text.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/utils/time_.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/utils/upload.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/utils/xml_.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/workflows/__init__.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/workflows/_exceptions.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/workflows/base.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/workflows/cdf_store.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/workflows/examples/Export_DMS/workflow.yaml +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/workflows/examples/Import_DMS/workflow.yaml +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/workflows/examples/Validate_Rules/workflow.yaml +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/workflows/examples/Validate_Solution_Model/workflow.yaml +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/workflows/examples/Visualize_Data_Model_Using_Mock_Graph/workflow.yaml +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/workflows/examples/Visualize_Semantic_Data_Model/workflow.yaml +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/workflows/manager.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/workflows/model.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/workflows/steps/data_contracts.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/workflows/steps/lib/current/__init__.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/workflows/steps/lib/current/graph_extractor.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/workflows/steps/lib/current/graph_loader.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/workflows/steps/lib/current/graph_store.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/workflows/steps/lib/current/rules_exporter.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/workflows/steps/lib/io/__init__.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/workflows/steps/lib/io/io_steps.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/workflows/steps/step_model.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/workflows/steps_registry.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/workflows/tasks.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/workflows/triggers.py +0 -0
- {cognite_neat-0.88.1 → cognite_neat-0.88.2}/cognite/neat/workflows/utils.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.88.2"
|
|
@@ -121,12 +121,12 @@ def wrangle_warnings(list_of_warnings: list[WarningMessage]) -> list[dict]:
|
|
|
121
121
|
def _neat_warning_to_dict(warning: WarningMessage) -> dict:
|
|
122
122
|
category: Any = warning.category
|
|
123
123
|
return {
|
|
124
|
-
"type": category.
|
|
124
|
+
"type": category.resource_type,
|
|
125
125
|
"loc": (),
|
|
126
126
|
"msg": str(warning.message),
|
|
127
127
|
"input": None,
|
|
128
128
|
"ctx": dict(
|
|
129
|
-
type_=category.
|
|
129
|
+
type_=category.resource_type,
|
|
130
130
|
code=category.code,
|
|
131
131
|
description=category.description,
|
|
132
132
|
example=category.example,
|
|
@@ -7,8 +7,8 @@ from cognite.client import CogniteClient
|
|
|
7
7
|
from cognite.client.data_classes.capabilities import Capability
|
|
8
8
|
|
|
9
9
|
from cognite.neat.graph import NeatGraphStore
|
|
10
|
-
from cognite.neat.
|
|
11
|
-
from cognite.neat.issues import
|
|
10
|
+
from cognite.neat.issues import IssueList, NeatIssue, NeatIssueList
|
|
11
|
+
from cognite.neat.issues.errors.external import FailedAuthorizationError
|
|
12
12
|
from cognite.neat.utils.auxiliary import class_html_doc
|
|
13
13
|
from cognite.neat.utils.upload import UploadResult, UploadResultList
|
|
14
14
|
|
|
@@ -66,7 +66,7 @@ class CDFLoader(BaseLoader[T_Output]):
|
|
|
66
66
|
yield upload_result
|
|
67
67
|
return
|
|
68
68
|
|
|
69
|
-
issues =
|
|
69
|
+
issues = IssueList()
|
|
70
70
|
items: list[T_Output] = []
|
|
71
71
|
for result in self._load(stop_on_exception=False):
|
|
72
72
|
if isinstance(result, NeatIssue):
|
|
@@ -79,7 +79,7 @@ class CDFLoader(BaseLoader[T_Output]):
|
|
|
79
79
|
|
|
80
80
|
if len(items) >= self._UPLOAD_BATCH_SIZE or result is _END_OF_CLASS:
|
|
81
81
|
yield from self._upload_to_cdf(client, items, dry_run, issues)
|
|
82
|
-
issues =
|
|
82
|
+
issues = IssueList()
|
|
83
83
|
items = []
|
|
84
84
|
if items:
|
|
85
85
|
yield from self._upload_to_cdf(client, items, dry_run, issues)
|
|
@@ -19,9 +19,9 @@ from cognite.client.exceptions import CogniteAPIError, CogniteDuplicatedError
|
|
|
19
19
|
|
|
20
20
|
from cognite.neat.graph._tracking.base import Tracker
|
|
21
21
|
from cognite.neat.graph._tracking.log import LogTracker
|
|
22
|
-
from cognite.neat.graph.issues import loader as loader_issues
|
|
23
22
|
from cognite.neat.graph.stores import NeatGraphStore
|
|
24
|
-
from cognite.neat.issues import NeatIssue, NeatIssueList
|
|
23
|
+
from cognite.neat.issues import IssueList, NeatIssue, NeatIssueList
|
|
24
|
+
from cognite.neat.issues.errors.resources import InvalidResourceError
|
|
25
25
|
from cognite.neat.rules.analysis._asset import AssetAnalysis
|
|
26
26
|
from cognite.neat.rules.models import AssetRules
|
|
27
27
|
from cognite.neat.rules.models.entities import ClassEntity, EntityTypes
|
|
@@ -80,7 +80,7 @@ class AssetLoader(CDFLoader[AssetWrite]):
|
|
|
80
80
|
self.external_id_prefix = external_id_prefix
|
|
81
81
|
|
|
82
82
|
self.processed_assets: set[str] = set()
|
|
83
|
-
self._issues =
|
|
83
|
+
self._issues = IssueList(create_issues or [])
|
|
84
84
|
self._tracker: type[Tracker] = tracker or LogTracker
|
|
85
85
|
|
|
86
86
|
def _load(self, stop_on_exception: bool = False) -> Iterable[AssetWrite | NeatIssue | type[_END_OF_CLASS]]:
|
|
@@ -143,8 +143,8 @@ class AssetLoader(CDFLoader[AssetWrite]):
|
|
|
143
143
|
|
|
144
144
|
# check on parent
|
|
145
145
|
if "parentExternalId" in fields and fields["parentExternalId"] not in self.processed_assets:
|
|
146
|
-
error =
|
|
147
|
-
|
|
146
|
+
error = InvalidResourceError(
|
|
147
|
+
resource_type=EntityTypes.asset,
|
|
148
148
|
identifier=identifier,
|
|
149
149
|
reason=(
|
|
150
150
|
f"Parent asset {fields['parentExternalId']} does not exist or failed creation"
|
|
@@ -171,9 +171,7 @@ class AssetLoader(CDFLoader[AssetWrite]):
|
|
|
171
171
|
yield AssetWrite.load(fields)
|
|
172
172
|
self.processed_assets.add(identifier)
|
|
173
173
|
except KeyError as e:
|
|
174
|
-
error =
|
|
175
|
-
type_=EntityTypes.asset, identifier=identifier, reason=str(e)
|
|
176
|
-
)
|
|
174
|
+
error = InvalidResourceError(resource_type=EntityTypes.asset, identifier=identifier, reason=str(e))
|
|
177
175
|
tracker.issue(error)
|
|
178
176
|
if stop_on_exception:
|
|
179
177
|
raise error.as_exception() from e
|
|
@@ -203,8 +201,8 @@ class AssetLoader(CDFLoader[AssetWrite]):
|
|
|
203
201
|
|
|
204
202
|
# check if source asset exists
|
|
205
203
|
if source_external_id not in self.processed_assets:
|
|
206
|
-
error =
|
|
207
|
-
|
|
204
|
+
error = InvalidResourceError(
|
|
205
|
+
resource_type=EntityTypes.relationship,
|
|
208
206
|
identifier=source_external_id,
|
|
209
207
|
reason=(
|
|
210
208
|
f"Asset {source_external_id} does not exist! "
|
|
@@ -223,8 +221,8 @@ class AssetLoader(CDFLoader[AssetWrite]):
|
|
|
223
221
|
target_external_id = f"{self.external_id_prefix or ''}{target_external_id}"
|
|
224
222
|
# check if source asset exists
|
|
225
223
|
if target_external_id not in self.processed_assets:
|
|
226
|
-
error =
|
|
227
|
-
|
|
224
|
+
error = InvalidResourceError(
|
|
225
|
+
resource_type=EntityTypes.relationship,
|
|
228
226
|
identifier=target_external_id,
|
|
229
227
|
reason=(
|
|
230
228
|
f"Asset {target_external_id} does not exist! "
|
|
@@ -250,8 +248,8 @@ class AssetLoader(CDFLoader[AssetWrite]):
|
|
|
250
248
|
labels=[label] if self.use_labels else None,
|
|
251
249
|
)
|
|
252
250
|
except KeyError as e:
|
|
253
|
-
error =
|
|
254
|
-
|
|
251
|
+
error = InvalidResourceError(
|
|
252
|
+
resource_type=EntityTypes.relationship,
|
|
255
253
|
identifier=external_id,
|
|
256
254
|
reason=str(e),
|
|
257
255
|
)
|
|
@@ -14,10 +14,12 @@ from cognite.client.data_classes.data_modeling.views import SingleEdgeConnection
|
|
|
14
14
|
from cognite.client.exceptions import CogniteAPIError
|
|
15
15
|
from pydantic import BaseModel, ValidationInfo, create_model, field_validator
|
|
16
16
|
|
|
17
|
+
import cognite.neat.issues.errors.resources
|
|
17
18
|
from cognite.neat.graph._tracking import LogTracker, Tracker
|
|
18
|
-
from cognite.neat.graph.issues import loader as loader_issues
|
|
19
19
|
from cognite.neat.graph.stores import NeatGraphStore
|
|
20
|
-
from cognite.neat.issues import NeatIssue, NeatIssueList
|
|
20
|
+
from cognite.neat.issues import IssueList, NeatIssue, NeatIssueList
|
|
21
|
+
from cognite.neat.issues.errors.resources import FailedConvertError, InvalidResourceError, ResourceNotFoundError
|
|
22
|
+
from cognite.neat.issues.neat_warnings.models import InvalidClassWarning
|
|
21
23
|
from cognite.neat.rules.models import DMSRules
|
|
22
24
|
from cognite.neat.rules.models.data_types import _DATA_TYPE_BY_DMS_TYPE, Json
|
|
23
25
|
from cognite.neat.utils.auxiliary import create_sha256_hash
|
|
@@ -51,7 +53,7 @@ class DMSLoader(CDFLoader[dm.InstanceApply]):
|
|
|
51
53
|
self.data_model = data_model
|
|
52
54
|
self.instance_space = instance_space
|
|
53
55
|
self.class_by_view_id = class_by_view_id or {}
|
|
54
|
-
self._issues =
|
|
56
|
+
self._issues = IssueList(create_issues or [])
|
|
55
57
|
self._tracker: type[Tracker] = tracker or LogTracker
|
|
56
58
|
|
|
57
59
|
@classmethod
|
|
@@ -67,7 +69,9 @@ class DMSLoader(CDFLoader[dm.InstanceApply]):
|
|
|
67
69
|
try:
|
|
68
70
|
data_model = client.data_modeling.data_models.retrieve(data_model_id, inline_views=True).latest_version()
|
|
69
71
|
except Exception as e:
|
|
70
|
-
issues.append(
|
|
72
|
+
issues.append(
|
|
73
|
+
ResourceNotFoundError(identifier=repr(data_model_id), resource_type="Data Model", reason=str(e))
|
|
74
|
+
)
|
|
71
75
|
|
|
72
76
|
return cls(graph_store, data_model, instance_space, {}, issues)
|
|
73
77
|
|
|
@@ -79,7 +83,7 @@ class DMSLoader(CDFLoader[dm.InstanceApply]):
|
|
|
79
83
|
data_model = rules.as_schema().as_read_model()
|
|
80
84
|
except Exception as e:
|
|
81
85
|
issues.append(
|
|
82
|
-
|
|
86
|
+
FailedConvertError(
|
|
83
87
|
identifier=rules.metadata.as_identifier(),
|
|
84
88
|
target_format="read DMS model",
|
|
85
89
|
reason=str(e),
|
|
@@ -110,7 +114,7 @@ class DMSLoader(CDFLoader[dm.InstanceApply]):
|
|
|
110
114
|
try:
|
|
111
115
|
yield self._create_node(identifier, properties, pydantic_cls, view_id)
|
|
112
116
|
except ValueError as e:
|
|
113
|
-
error =
|
|
117
|
+
error = InvalidResourceError(resource_type="node", identifier=identifier, reason=str(e))
|
|
114
118
|
tracker.issue(error)
|
|
115
119
|
if stop_on_exception:
|
|
116
120
|
raise error.as_exception() from e
|
|
@@ -141,7 +145,7 @@ class DMSLoader(CDFLoader[dm.InstanceApply]):
|
|
|
141
145
|
def _create_validation_classes(
|
|
142
146
|
self, view: dm.View
|
|
143
147
|
) -> tuple[type[BaseModel], dict[str, dm.EdgeConnection], NeatIssueList]:
|
|
144
|
-
issues =
|
|
148
|
+
issues = IssueList()
|
|
145
149
|
field_definitions: dict[str, tuple[type, Any]] = {}
|
|
146
150
|
edge_by_property: dict[str, dm.EdgeConnection] = {}
|
|
147
151
|
validators: dict[str, classmethod] = {}
|
|
@@ -158,7 +162,7 @@ class DMSLoader(CDFLoader[dm.InstanceApply]):
|
|
|
158
162
|
data_type = _DATA_TYPE_BY_DMS_TYPE.get(prop.type._type)
|
|
159
163
|
if not data_type:
|
|
160
164
|
issues.append(
|
|
161
|
-
|
|
165
|
+
InvalidClassWarning(
|
|
162
166
|
class_name=repr(view.as_id()),
|
|
163
167
|
reason=f"Unknown data type for property {prop_name}: {prop.type._type}",
|
|
164
168
|
)
|
|
@@ -247,8 +251,8 @@ class DMSLoader(CDFLoader[dm.InstanceApply]):
|
|
|
247
251
|
continue
|
|
248
252
|
edge = edge_by_properties[prop]
|
|
249
253
|
if isinstance(edge, SingleEdgeConnection) and len(values) > 1:
|
|
250
|
-
error =
|
|
251
|
-
|
|
254
|
+
error = cognite.neat.issues.errors.resources.InvalidResourceError(
|
|
255
|
+
resource_type="edge",
|
|
252
256
|
identifier=identifier,
|
|
253
257
|
reason=f"Multiple values for single edge {edge}. Expected only one.",
|
|
254
258
|
)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""This is module contains all the Neat Exceptions (Errors) and Warnings as well
|
|
2
|
+
as
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from ._base import DefaultWarning, IssueList, MultiValueError, NeatError, NeatIssue, NeatIssueList, NeatWarning
|
|
7
|
+
|
|
8
|
+
__all__ = [
|
|
9
|
+
"NeatIssue",
|
|
10
|
+
"NeatError",
|
|
11
|
+
"NeatWarning",
|
|
12
|
+
"DefaultWarning",
|
|
13
|
+
"NeatIssueList",
|
|
14
|
+
"IssueList",
|
|
15
|
+
"MultiValueError",
|
|
16
|
+
]
|
cognite_neat-0.88.1/cognite/neat/issues.py → cognite_neat-0.88.2/cognite/neat/issues/_base.py
RENAMED
|
@@ -9,7 +9,7 @@ from typing import Any, ClassVar, TypeVar
|
|
|
9
9
|
from warnings import WarningMessage
|
|
10
10
|
|
|
11
11
|
import pandas as pd
|
|
12
|
-
from pydantic_core import PydanticCustomError
|
|
12
|
+
from pydantic_core import ErrorDetails, PydanticCustomError
|
|
13
13
|
|
|
14
14
|
if sys.version_info < (3, 11):
|
|
15
15
|
from exceptiongroup import ExceptionGroup
|
|
@@ -18,11 +18,24 @@ else:
|
|
|
18
18
|
from typing import Self
|
|
19
19
|
|
|
20
20
|
|
|
21
|
+
__all__ = [
|
|
22
|
+
"NeatIssue",
|
|
23
|
+
"NeatError",
|
|
24
|
+
"NeatWarning",
|
|
25
|
+
"DefaultWarning",
|
|
26
|
+
"NeatIssueList",
|
|
27
|
+
"MultiValueError",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
|
|
21
31
|
@total_ordering
|
|
22
32
|
@dataclass(frozen=True)
|
|
23
33
|
class NeatIssue(ABC):
|
|
34
|
+
"""This is the base class for all exceptions and warnings (issues) used in Neat."""
|
|
35
|
+
|
|
24
36
|
description: ClassVar[str]
|
|
25
|
-
|
|
37
|
+
extra: ClassVar[str | None] = None
|
|
38
|
+
fix: ClassVar[str | None] = None
|
|
26
39
|
|
|
27
40
|
def message(self) -> str:
|
|
28
41
|
"""Return a human-readable message for the issue.
|
|
@@ -31,7 +44,7 @@ class NeatIssue(ABC):
|
|
|
31
44
|
It is recommended to override this method in subclasses with a more
|
|
32
45
|
specific message.
|
|
33
46
|
"""
|
|
34
|
-
return self.
|
|
47
|
+
return self.__doc__ or "Missing"
|
|
35
48
|
|
|
36
49
|
@abstractmethod
|
|
37
50
|
def dump(self) -> dict[str, Any]:
|
|
@@ -59,11 +72,63 @@ class NeatError(NeatIssue, ABC):
|
|
|
59
72
|
|
|
60
73
|
def as_pydantic_exception(self) -> PydanticCustomError:
|
|
61
74
|
return PydanticCustomError(
|
|
62
|
-
self.
|
|
75
|
+
type(self).__name__,
|
|
63
76
|
self.message(),
|
|
64
|
-
dict(description=self.
|
|
77
|
+
dict(description=self.__doc__, fix=self.fix),
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
@classmethod
|
|
81
|
+
def from_pydantic_errors(cls, errors: list[ErrorDetails], **kwargs) -> "list[NeatError]":
|
|
82
|
+
"""Convert a list of pydantic errors to a list of Error instances.
|
|
83
|
+
|
|
84
|
+
This is intended to be overridden in subclasses to handle specific error types.
|
|
85
|
+
"""
|
|
86
|
+
all_errors: list[NeatError] = []
|
|
87
|
+
for error in errors:
|
|
88
|
+
if isinstance(ctx := error.get("ctx"), dict) and isinstance(
|
|
89
|
+
multi_error := ctx.get("error"), MultiValueError
|
|
90
|
+
):
|
|
91
|
+
all_errors.extend(multi_error.errors) # type: ignore[arg-type]
|
|
92
|
+
else:
|
|
93
|
+
all_errors.append(DefaultPydanticError.from_pydantic_error(error))
|
|
94
|
+
return all_errors
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
@dataclass(frozen=True)
|
|
98
|
+
class DefaultPydanticError(NeatError):
|
|
99
|
+
type: str
|
|
100
|
+
loc: tuple[int | str, ...]
|
|
101
|
+
msg: str
|
|
102
|
+
input: Any
|
|
103
|
+
ctx: dict[str, Any] | None
|
|
104
|
+
|
|
105
|
+
@classmethod
|
|
106
|
+
def from_pydantic_error(cls, error: ErrorDetails) -> "DefaultPydanticError":
|
|
107
|
+
return cls(
|
|
108
|
+
type=error["type"],
|
|
109
|
+
loc=error["loc"],
|
|
110
|
+
msg=error["msg"],
|
|
111
|
+
input=error.get("input"),
|
|
112
|
+
ctx=error.get("ctx"),
|
|
65
113
|
)
|
|
66
114
|
|
|
115
|
+
def dump(self) -> dict[str, Any]:
|
|
116
|
+
output = super().dump()
|
|
117
|
+
output["type"] = self.type
|
|
118
|
+
output["loc"] = self.loc
|
|
119
|
+
output["msg"] = self.msg
|
|
120
|
+
output["input"] = self.input
|
|
121
|
+
output["ctx"] = self.ctx
|
|
122
|
+
return output
|
|
123
|
+
|
|
124
|
+
def message(self) -> str:
|
|
125
|
+
if self.loc and len(self.loc) == 1:
|
|
126
|
+
return f"{self.loc[0]} sheet: {self.msg}"
|
|
127
|
+
elif self.loc and len(self.loc) == 2:
|
|
128
|
+
return f"{self.loc[0]} sheet field/column <{self.loc[1]}>: {self.msg}"
|
|
129
|
+
else:
|
|
130
|
+
return self.msg
|
|
131
|
+
|
|
67
132
|
|
|
68
133
|
@dataclass(frozen=True)
|
|
69
134
|
class NeatWarning(NeatIssue, ABC, UserWarning):
|
|
@@ -156,3 +221,6 @@ class MultiValueError(ValueError):
|
|
|
156
221
|
|
|
157
222
|
def __init__(self, errors: Sequence[T_NeatIssue]):
|
|
158
223
|
self.errors = list(errors)
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
class IssueList(NeatIssueList[NeatIssue]): ...
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
from cognite.neat.issues import NeatError
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@dataclass(frozen=True)
|
|
8
|
+
class FailedAuthorizationError(NeatError):
|
|
9
|
+
description = "Missing authorization for {action}: {reason}"
|
|
10
|
+
|
|
11
|
+
action: str
|
|
12
|
+
reason: str
|
|
13
|
+
|
|
14
|
+
def message(self) -> str:
|
|
15
|
+
return self.description.format(action=self.action, reason=self.reason)
|
|
16
|
+
|
|
17
|
+
def dump(self) -> dict[str, Any]:
|
|
18
|
+
output = super().dump()
|
|
19
|
+
output["action"] = self.action
|
|
20
|
+
output["reason"] = self.reason
|
|
21
|
+
return output
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from typing import Any, Generic
|
|
3
|
+
|
|
4
|
+
from .resources import ResourceError, T_Identifier, T_ReferenceIdentifier
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@dataclass(frozen=True)
|
|
8
|
+
class PropertyNotFoundError(ResourceError[T_Identifier]):
|
|
9
|
+
"""The {resource_type} with identifier {identifier} does not have a property {property_name}"""
|
|
10
|
+
|
|
11
|
+
property_name: str
|
|
12
|
+
|
|
13
|
+
def message(self) -> str:
|
|
14
|
+
return (self.__doc__ or "").format(
|
|
15
|
+
resource_type=self.resource_type, identifier=repr(self.identifier), property_name=self.property_name
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
def dump(self) -> dict[str, Any]:
|
|
19
|
+
output = super().dump()
|
|
20
|
+
output["property_name"] = self.property_name
|
|
21
|
+
return output
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@dataclass(frozen=True)
|
|
25
|
+
class ReferredPropertyNotFoundError(ResourceError, Generic[T_Identifier, T_ReferenceIdentifier]):
|
|
26
|
+
"""The {resource_type} with identifier {identifier} does not have a property {property_name} referred
|
|
27
|
+
to by {referred_type} {referred_by} does not exist
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
fix = "Ensure the {resource_type} {identifier} has a {property_name} property"
|
|
31
|
+
|
|
32
|
+
referred_by: T_ReferenceIdentifier
|
|
33
|
+
referred_type: str
|
|
34
|
+
property_name: str
|
|
35
|
+
|
|
36
|
+
def message(self) -> str:
|
|
37
|
+
return (self.__doc__ or "").format(
|
|
38
|
+
resource_type=self.resource_type,
|
|
39
|
+
identifier=repr(self.identifier),
|
|
40
|
+
referred_type=self.referred_type,
|
|
41
|
+
referred_by=repr(self.referred_by),
|
|
42
|
+
property_name=self.property_name,
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
def dump(self) -> dict[str, Any]:
|
|
46
|
+
output = super().dump()
|
|
47
|
+
output["resource_type"] = self.resource_type
|
|
48
|
+
output["identifier"] = self.identifier
|
|
49
|
+
output["referred_by"] = self.referred_by
|
|
50
|
+
output["referred_type"] = self.referred_type
|
|
51
|
+
output["property_name"] = self.property_name
|
|
52
|
+
return output
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@dataclass(frozen=True)
|
|
56
|
+
class PropertyTypeNotSupportedError(ResourceError[T_Identifier]):
|
|
57
|
+
"""The {resource_type} with identifier {identifier} has a property {property_name}
|
|
58
|
+
of unsupported type {property_type}"""
|
|
59
|
+
|
|
60
|
+
property_name: str
|
|
61
|
+
property_type: str
|
|
62
|
+
|
|
63
|
+
def message(self) -> str:
|
|
64
|
+
return (self.__doc__ or "").format(
|
|
65
|
+
resource_type=self.resource_type,
|
|
66
|
+
identifier=repr(self.identifier),
|
|
67
|
+
property_name=self.property_name,
|
|
68
|
+
property_type=self.property_type,
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
def dump(self) -> dict[str, Any]:
|
|
72
|
+
output = super().dump()
|
|
73
|
+
output["property_name"] = self.property_name
|
|
74
|
+
output["property_type"] = self.property_type
|
|
75
|
+
return output
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
from collections.abc import Hashable
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
from typing import Any, Generic, TypeVar
|
|
4
|
+
|
|
5
|
+
from cognite.neat.issues import NeatError
|
|
6
|
+
|
|
7
|
+
T_Identifier = TypeVar("T_Identifier", bound=Hashable)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@dataclass(frozen=True)
|
|
11
|
+
class ResourceError(NeatError, Generic[T_Identifier]):
|
|
12
|
+
"""Base class for resource errors"""
|
|
13
|
+
|
|
14
|
+
identifier: T_Identifier
|
|
15
|
+
resource_type: str
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@dataclass(frozen=True)
|
|
19
|
+
class ResourceNotFoundError(ResourceError[T_Identifier]):
|
|
20
|
+
"""The {resource_type} with identifier {identifier} is missing: {reason}"""
|
|
21
|
+
|
|
22
|
+
fix = "Check the {resource_type} {identifier} and try again."
|
|
23
|
+
reason: str
|
|
24
|
+
|
|
25
|
+
def message(self) -> str:
|
|
26
|
+
return (self.__doc__ or "").format(
|
|
27
|
+
resource_type=self.resource_type, identifier=repr(self.identifier), reason=self.reason
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
def dump(self) -> dict[str, Any]:
|
|
31
|
+
output = super().dump()
|
|
32
|
+
output["resource_type"] = self.resource_type
|
|
33
|
+
output["identifier"] = self.identifier
|
|
34
|
+
output["reason"] = self.reason
|
|
35
|
+
return output
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
T_ReferenceIdentifier = TypeVar("T_ReferenceIdentifier", bound=Hashable)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
@dataclass(frozen=True)
|
|
42
|
+
class ReferredResourceNotFoundError(ResourceError, Generic[T_Identifier, T_ReferenceIdentifier]):
|
|
43
|
+
"""The {resource_type} with identifier {identifier} referred by {referred_type} {referred_by} does not exist"""
|
|
44
|
+
|
|
45
|
+
fix = "Create the {resource_type}"
|
|
46
|
+
|
|
47
|
+
referred_by: T_ReferenceIdentifier
|
|
48
|
+
referred_type: str
|
|
49
|
+
|
|
50
|
+
def message(self) -> str:
|
|
51
|
+
return (self.__doc__ or "").format(
|
|
52
|
+
resource_type=self.resource_type,
|
|
53
|
+
identifier=repr(self.identifier),
|
|
54
|
+
referred_type=self.referred_type,
|
|
55
|
+
referred_by=repr(self.referred_by),
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
def dump(self) -> dict[str, Any]:
|
|
59
|
+
output = super().dump()
|
|
60
|
+
output["resource_type"] = self.resource_type
|
|
61
|
+
output["identifier"] = self.identifier
|
|
62
|
+
output["referred_by"] = self.referred_by
|
|
63
|
+
output["referred_type"] = self.referred_type
|
|
64
|
+
return output
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
@dataclass(frozen=True)
|
|
68
|
+
class FailedConvertError(NeatError):
|
|
69
|
+
description = "Failed to convert the {identifier} to {target_format}: {reason}"
|
|
70
|
+
fix = "Check the error message and correct the rules."
|
|
71
|
+
identifier: str
|
|
72
|
+
target_format: str
|
|
73
|
+
reason: str
|
|
74
|
+
|
|
75
|
+
def message(self) -> str:
|
|
76
|
+
return self.description.format(identifier=self.identifier, target_format=self.target_format, reason=self.reason)
|
|
77
|
+
|
|
78
|
+
def dump(self) -> dict[str, Any]:
|
|
79
|
+
output = super().dump()
|
|
80
|
+
output["identifier"] = self.identifier
|
|
81
|
+
output["targetFormat"] = self.target_format
|
|
82
|
+
output["reason"] = self.reason
|
|
83
|
+
return output
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
@dataclass(frozen=True)
|
|
87
|
+
class InvalidResourceError(NeatError):
|
|
88
|
+
"""The {resource_type} with identifier {identifier} is invalid and will be skipped. {reason}"""
|
|
89
|
+
|
|
90
|
+
fix = "Check the error message and correct the instance."
|
|
91
|
+
|
|
92
|
+
resource_type: str
|
|
93
|
+
identifier: str
|
|
94
|
+
reason: str
|
|
95
|
+
|
|
96
|
+
def message(self) -> str:
|
|
97
|
+
return (self.__doc__ or "").format(
|
|
98
|
+
resource_type=self.resource_type, identifier=self.identifier, reason=self.reason
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
def dump(self) -> dict[str, Any]:
|
|
102
|
+
output = super().dump()
|
|
103
|
+
output["type"] = self.resource_type
|
|
104
|
+
output["identifier"] = self.identifier
|
|
105
|
+
output["reason"] = self.reason
|
|
106
|
+
return output
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
@dataclass(frozen=True)
|
|
110
|
+
class MissingIdentifierError(NeatError):
|
|
111
|
+
"""The {resource_type} with name {name} is missing an identifier."""
|
|
112
|
+
|
|
113
|
+
resource_type: str
|
|
114
|
+
name: str | None = None
|
|
115
|
+
|
|
116
|
+
def message(self) -> str:
|
|
117
|
+
return (self.__doc__ or "").format(resource_type=self.resource_type, name=self.name or "unknown")
|
|
118
|
+
|
|
119
|
+
def dump(self) -> dict[str, Any]:
|
|
120
|
+
output = super().dump()
|
|
121
|
+
output["type"] = self.resource_type
|
|
122
|
+
output["name"] = self.name
|
|
123
|
+
return output
|
{cognite_neat-0.88.1/cognite/neat/rules → cognite_neat-0.88.2/cognite/neat}/issues/formatters.py
RENAMED
|
@@ -3,7 +3,7 @@ import xml.etree.ElementTree as ET
|
|
|
3
3
|
from abc import ABC, abstractmethod
|
|
4
4
|
from pathlib import Path
|
|
5
5
|
|
|
6
|
-
from .
|
|
6
|
+
from ._base import NeatError, NeatIssueList, NeatWarning
|
|
7
7
|
|
|
8
8
|
__all__ = ["Formatter", "BasicHTML", "FORMATTER_BY_NAME"]
|
|
9
9
|
|
|
@@ -13,14 +13,14 @@ class Formatter(ABC):
|
|
|
13
13
|
default_file_prefix: str = "validation_report"
|
|
14
14
|
|
|
15
15
|
@abstractmethod
|
|
16
|
-
def create_report(self, issues:
|
|
16
|
+
def create_report(self, issues: NeatIssueList) -> str:
|
|
17
17
|
raise NotImplementedError()
|
|
18
18
|
|
|
19
19
|
@property
|
|
20
20
|
def default_file_name(self) -> str:
|
|
21
21
|
return f"{self.default_file_prefix}_{type(self).__name__.lower()}{self.file_suffix}"
|
|
22
22
|
|
|
23
|
-
def write_to_file(self, issues:
|
|
23
|
+
def write_to_file(self, issues: NeatIssueList, file_or_dir_path: Path | None = None) -> None:
|
|
24
24
|
if file_or_dir_path is None:
|
|
25
25
|
file_or_dir_path = Path(self.default_file_name)
|
|
26
26
|
elif file_or_dir_path.is_dir():
|
|
@@ -41,9 +41,9 @@ class BasicHTML(Formatter):
|
|
|
41
41
|
self._doc = ET.Element("html")
|
|
42
42
|
self._body = ET.SubElement(self._doc, "body")
|
|
43
43
|
|
|
44
|
-
def create_report(self, issues:
|
|
45
|
-
errors = [issue for issue in issues if isinstance(issue,
|
|
46
|
-
warnings_ = [issue for issue in issues if isinstance(issue,
|
|
44
|
+
def create_report(self, issues: NeatIssueList) -> str:
|
|
45
|
+
errors = [issue for issue in issues if isinstance(issue, NeatError)]
|
|
46
|
+
warnings_ = [issue for issue in issues if isinstance(issue, NeatWarning)]
|
|
47
47
|
self._doc.clear()
|
|
48
48
|
self._body = ET.SubElement(self._doc, "body")
|
|
49
49
|
h1 = ET.SubElement(self._body, "h1")
|
|
@@ -61,11 +61,11 @@ class BasicHTML(Formatter):
|
|
|
61
61
|
|
|
62
62
|
return ET.tostring(self._doc, encoding="unicode")
|
|
63
63
|
|
|
64
|
-
def _write_errors_or_warnings(self, issues: list[
|
|
65
|
-
issue_name = "errors" if isinstance(issues[0],
|
|
64
|
+
def _write_errors_or_warnings(self, issues: list[NeatError] | list[NeatWarning]) -> None:
|
|
65
|
+
issue_name = "errors" if isinstance(issues[0], NeatError) else "warnings"
|
|
66
66
|
main_categories = {base_ for issue in issues for base_ in type(issue).__bases__}
|
|
67
67
|
for category in main_categories:
|
|
68
|
-
issues_in_category: list[
|
|
68
|
+
issues_in_category: list[NeatError] | list[NeatWarning] = [ # type: ignore[assignment]
|
|
69
69
|
issue for issue in issues if isinstance(issue, category)
|
|
70
70
|
]
|
|
71
71
|
h3 = ET.SubElement(self._body, "h3")
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
from cognite.neat.issues import NeatWarning
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@dataclass(frozen=True)
|
|
8
|
+
class RegexViolationWarning(NeatWarning):
|
|
9
|
+
"""The value '{value}' of {identifier} does not match the {pattern_name} pattern '{pattern}'"""
|
|
10
|
+
|
|
11
|
+
value: str
|
|
12
|
+
pattern: str
|
|
13
|
+
identifier: str
|
|
14
|
+
pattern_name: str
|
|
15
|
+
|
|
16
|
+
def message(self) -> str:
|
|
17
|
+
return (self.__doc__ or "").format(
|
|
18
|
+
value=self.value, pattern=self.pattern, identifier=self.identifier, pattern_name=self.pattern_name
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
def dump(self) -> dict[str, Any]:
|
|
22
|
+
output = super().dump()
|
|
23
|
+
output["value"] = self.value
|
|
24
|
+
output["pattern"] = self.pattern
|
|
25
|
+
output["identifier"] = self.identifier
|
|
26
|
+
output["pattern_name"] = self.pattern_name
|
|
27
|
+
return output
|