morphir-python 0.0.1__py3-none-any.whl → 0.0.2__py3-none-any.whl
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.
- morphir_python-0.0.2.dist-info/METADATA +97 -0
- morphir_python-0.0.2.dist-info/RECORD +8 -0
- morphir_tools/__init__.py +2 -2
- morphir/__init__.py +0 -14
- morphir/ir/__init__.py +0 -110
- morphir/ir/access_controlled.py +0 -15
- morphir/ir/decorations.py +0 -19
- morphir/ir/diagnostics.py +0 -105
- morphir/ir/distribution.py +0 -21
- morphir/ir/document.py +0 -37
- morphir/ir/documented.py +0 -11
- morphir/ir/format_version.py +0 -483
- morphir/ir/fqname.py +0 -9
- morphir/ir/json.py +0 -11
- morphir/ir/literal.py +0 -25
- morphir/ir/meta.py +0 -11
- morphir/ir/migrate.py +0 -1267
- morphir/ir/module.py +0 -17
- morphir/ir/name.py +0 -27
- morphir/ir/package.py +0 -15
- morphir/ir/path.py +0 -25
- morphir/ir/qname.py +0 -9
- morphir/ir/ref.py +0 -17
- morphir/ir/type.py +0 -37
- morphir/ir/type_constraints.py +0 -33
- morphir/ir/type_def.py +0 -19
- morphir/ir/type_spec.py +0 -25
- morphir/ir/v3/__init__.py +0 -64
- morphir/ir/v3/_legacy_value.py +0 -201
- morphir/ir/v3/access_controlled.py +0 -31
- morphir/ir/v3/codec.py +0 -1275
- morphir/ir/v3/codec_v1.py +0 -491
- morphir/ir/v3/codec_v2.py +0 -187
- morphir/ir/v3/distribution.py +0 -42
- morphir/ir/v3/documented.py +0 -13
- morphir/ir/v3/fqname.py +0 -30
- morphir/ir/v3/literal.py +0 -46
- morphir/ir/v3/module.py +0 -32
- morphir/ir/v3/name.py +0 -42
- morphir/ir/v3/package.py +0 -23
- morphir/ir/v3/path.py +0 -29
- morphir/ir/v3/qname.py +0 -16
- morphir/ir/v3/type.py +0 -126
- morphir/ir/v3/value.py +0 -235
- morphir/ir/v4/__init__.py +0 -160
- morphir/ir/v4/access_controlled.py +0 -17
- morphir/ir/v4/annotation.py +0 -75
- morphir/ir/v4/codec.py +0 -2161
- morphir/ir/v4/decorations.py +0 -88
- morphir/ir/v4/distribution.py +0 -56
- morphir/ir/v4/document.py +0 -69
- morphir/ir/v4/documented.py +0 -10
- morphir/ir/v4/fqname.py +0 -69
- morphir/ir/v4/incompleteness.py +0 -78
- morphir/ir/v4/json.py +0 -103
- morphir/ir/v4/literal.py +0 -51
- morphir/ir/v4/meta.py +0 -27
- morphir/ir/v4/module.py +0 -30
- morphir/ir/v4/name.py +0 -69
- morphir/ir/v4/package.py +0 -19
- morphir/ir/v4/path.py +0 -50
- morphir/ir/v4/qname.py +0 -34
- morphir/ir/v4/ref.py +0 -35
- morphir/ir/v4/type.py +0 -140
- morphir/ir/v4/type_constraints.py +0 -91
- morphir/ir/v4/type_def.py +0 -38
- morphir/ir/v4/type_spec.py +0 -64
- morphir/ir/v4/value.py +0 -480
- morphir/ir/value.py +0 -81
- morphir/py.typed +0 -0
- morphir/sdk/__init__.py +0 -110
- morphir/sdk/_compare.py +0 -187
- morphir/sdk/aggregate.py +0 -421
- morphir/sdk/basics.py +0 -504
- morphir/sdk/char.py +0 -110
- morphir/sdk/decimal.py +0 -311
- morphir/sdk/dict.py +0 -336
- morphir/sdk/instant.py +0 -118
- morphir/sdk/int.py +0 -86
- morphir/sdk/key.py +0 -522
- morphir/sdk/list.py +0 -356
- morphir/sdk/local_date.py +0 -436
- morphir/sdk/local_time.py +0 -267
- morphir/sdk/maybe.py +0 -135
- morphir/sdk/number.py +0 -237
- morphir/sdk/regex.py +0 -287
- morphir/sdk/result.py +0 -162
- morphir/sdk/result_list.py +0 -169
- morphir/sdk/rule.py +0 -103
- morphir/sdk/set.py +0 -214
- morphir/sdk/stateful_app.py +0 -49
- morphir/sdk/string.py +0 -427
- morphir/sdk/tuple.py +0 -43
- morphir/sdk/uuid.py +0 -209
- morphir_python-0.0.1.dist-info/METADATA +0 -269
- morphir_python-0.0.1.dist-info/RECORD +0 -99
- {morphir_python-0.0.1.dist-info → morphir_python-0.0.2.dist-info}/WHEEL +0 -0
- {morphir_python-0.0.1.dist-info → morphir_python-0.0.2.dist-info}/entry_points.txt +0 -0
- {morphir_python-0.0.1.dist-info → morphir_python-0.0.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: morphir-python
|
|
3
|
+
Version: 0.0.2
|
|
4
|
+
Summary: CLI tools and extensions for Morphir Python
|
|
5
|
+
Project-URL: Homepage, https://github.com/finos/morphir-python
|
|
6
|
+
Project-URL: Documentation, https://morphir.finos.org
|
|
7
|
+
Project-URL: Repository, https://github.com/finos/morphir-python
|
|
8
|
+
Project-URL: Issues, https://github.com/finos/morphir-python/issues
|
|
9
|
+
Author-email: FINOS <morphir@finos.org>
|
|
10
|
+
License-Expression: Apache-2.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: cli,code-generation,domain-modeling,morphir,tools
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Environment :: Console
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
+
Classifier: Topic :: Software Development :: Code Generators
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
21
|
+
Classifier: Typing :: Typed
|
|
22
|
+
Requires-Python: >=3.14
|
|
23
|
+
Requires-Dist: morphir>=0.0.1
|
|
24
|
+
Requires-Dist: pygments>=2.20.0
|
|
25
|
+
Requires-Dist: typer>=0.15
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# Morphir Python
|
|
29
|
+
|
|
30
|
+
CLI tools and extensions for [Morphir Python](https://github.com/finos/morphir-python).
|
|
31
|
+
|
|
32
|
+
This package provides:
|
|
33
|
+
|
|
34
|
+
- Command-line interface for Morphir operations
|
|
35
|
+
- Code generation backends
|
|
36
|
+
- File I/O utilities
|
|
37
|
+
- Development tools
|
|
38
|
+
|
|
39
|
+
## Installation
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pip install morphir-python
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Or with uv:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
uv add morphir-python
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The `morphir-python` distribution contains the CLI and depends on the separate
|
|
52
|
+
`morphir` library/SDK distribution. Python imports remain `morphir` and
|
|
53
|
+
`morphir_tools`. Version 0.0.1 was a bundle; for migration to CLI-only 0.0.2, see
|
|
54
|
+
the [repository installation guide](../../README.md#migrating-from-the-bundled-001-release).
|
|
55
|
+
|
|
56
|
+
## Usage
|
|
57
|
+
|
|
58
|
+
The `morphir-python` command inspects and converts versioned `morphir-ir.json`
|
|
59
|
+
files. It reads format 3.0.x (what morphir-elm writes), format 3.1.x (which adds
|
|
60
|
+
the v3 `Specs` distribution) and draft IR 4.0.x, reads the legacy formats 1 and 2
|
|
61
|
+
to upgrade them, and uses the `morphir` library for every read, write, and
|
|
62
|
+
migration.
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
morphir-python ir inspect morphir-ir.json
|
|
66
|
+
morphir-python ir convert morphir-ir.json --to v4 -o out.json --package-version 1.2.0
|
|
67
|
+
morphir-python ir convert v4.json --to v3 -o out.json --drop-source-locations
|
|
68
|
+
morphir-python ir convert old-format-1.json --to v3 -o out.json
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
`inspect` prints the normalized format version, the distribution kind
|
|
72
|
+
(`Library`, `Specs` or `Application`), and the package name, and labels v4 as
|
|
73
|
+
draft and formats 1 and 2 as legacy. `convert` handles `Library` and `Specs` in
|
|
74
|
+
both directions. It writes a v3 `Library` as format `3` and a v3 `Specs` as
|
|
75
|
+
`"3.1.0"`, the lowest version that holds each. A legacy format 1 or 2 file
|
|
76
|
+
converts to a format 3.0.0 `Library` or draft v4; nothing writes format 1 or 2.
|
|
77
|
+
`convert` writes through a temporary file and renames it only on success, so a
|
|
78
|
+
failed conversion leaves no output file.
|
|
79
|
+
Diagnostics go to standard error as `code at location: message`.
|
|
80
|
+
|
|
81
|
+
Exit codes are 0 for success (also with warnings), 1 for a diagnostic, and 2 for
|
|
82
|
+
a usage error. 3.x releases from 3.2.0 on are rejected; see the
|
|
83
|
+
[morphir package README](../morphir/README.md#morphir-ir-versions) for the
|
|
84
|
+
format-version rules and the draft v4 status.
|
|
85
|
+
|
|
86
|
+
## Requirements
|
|
87
|
+
|
|
88
|
+
- Python 3.14+
|
|
89
|
+
- `morphir>=0.0.1` (installed as a dependency)
|
|
90
|
+
|
|
91
|
+
## License
|
|
92
|
+
|
|
93
|
+
Apache-2.0 - see the [LICENSE](../../LICENSE) file for details.
|
|
94
|
+
|
|
95
|
+
## Related Packages
|
|
96
|
+
|
|
97
|
+
- [morphir](https://pypi.org/project/morphir/) - Core library
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
morphir_tools/__init__.py,sha256=JVDyT-b7VDd27BFNrpWHzl1eOt3Ibu9mKKEc2QY2IRc,348
|
|
2
|
+
morphir_tools/cli.py,sha256=EEq_4VrDozHQ4ZyOLnEUgSu8AG2aMAD6mk5JIusWc58,7802
|
|
3
|
+
morphir_tools/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
morphir_python-0.0.2.dist-info/METADATA,sha256=B8UFDrKxW29qP4NDJPTSM9HdTsMH1xcHewXH-HYygl8,3535
|
|
5
|
+
morphir_python-0.0.2.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
|
|
6
|
+
morphir_python-0.0.2.dist-info/entry_points.txt,sha256=ig7-ByPyqCN0S13AuOguSP9qT1npyySP6hVL32naLxA,58
|
|
7
|
+
morphir_python-0.0.2.dist-info/licenses/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
|
|
8
|
+
morphir_python-0.0.2.dist-info/RECORD,,
|
morphir_tools/__init__.py
CHANGED
morphir/__init__.py
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"""Morphir - Functional domain modeling for Python.
|
|
2
|
-
|
|
3
|
-
Morphir enables you to write business logic once and use it across multiple
|
|
4
|
-
platforms, languages, and runtimes. It provides a strongly-typed intermediate
|
|
5
|
-
representation (IR) that captures the semantics of your domain model.
|
|
6
|
-
|
|
7
|
-
Example:
|
|
8
|
-
>>> import morphir
|
|
9
|
-
>>> morphir.__version__
|
|
10
|
-
'0.0.1'
|
|
11
|
-
"""
|
|
12
|
-
|
|
13
|
-
__version__ = "0.0.1"
|
|
14
|
-
__all__ = ["__version__"]
|
morphir/ir/__init__.py
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
"""Morphir IR.
|
|
2
|
-
|
|
3
|
-
The default model is IR v4 (`morphir.ir.v4`); every name here is the same object
|
|
4
|
-
as its `morphir.ir.v4` counterpart. Format 3.0.0 lives in `morphir.ir.v3`.
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
from . import module, package
|
|
8
|
-
from .v4.access_controlled import AccessControlled
|
|
9
|
-
from .v4.decorations import (
|
|
10
|
-
DecorationFormat,
|
|
11
|
-
DecorationValuesFile,
|
|
12
|
-
LayerManifest,
|
|
13
|
-
SchemaRef,
|
|
14
|
-
)
|
|
15
|
-
from .v4.distribution import (
|
|
16
|
-
ApplicationDistribution,
|
|
17
|
-
Distribution,
|
|
18
|
-
EntryPoint,
|
|
19
|
-
EntryPointKind,
|
|
20
|
-
LibraryDistribution,
|
|
21
|
-
PackageInfo,
|
|
22
|
-
SpecsDistribution,
|
|
23
|
-
)
|
|
24
|
-
from .v4.document import (
|
|
25
|
-
DocArray,
|
|
26
|
-
DocBool,
|
|
27
|
-
DocFloat,
|
|
28
|
-
DocInt,
|
|
29
|
-
DocNull,
|
|
30
|
-
DocObject,
|
|
31
|
-
DocString,
|
|
32
|
-
Document,
|
|
33
|
-
)
|
|
34
|
-
from .v4.documented import Documented
|
|
35
|
-
from .v4.fqname import FQName
|
|
36
|
-
from .v4.literal import (
|
|
37
|
-
BoolLiteral,
|
|
38
|
-
CharLiteral,
|
|
39
|
-
DecimalLiteral,
|
|
40
|
-
FloatLiteral,
|
|
41
|
-
IntegerLiteral,
|
|
42
|
-
Literal,
|
|
43
|
-
StringLiteral,
|
|
44
|
-
)
|
|
45
|
-
from .v4.meta import FileMeta, SourceRange
|
|
46
|
-
from .v4.name import Name
|
|
47
|
-
from .v4.path import Path
|
|
48
|
-
from .v4.qname import QName
|
|
49
|
-
from .v4.ref import DefRef, FileWithDefs, PointerRef, Ref
|
|
50
|
-
from .v4.type import Field, Type, TypeAttributes
|
|
51
|
-
from .v4.type_constraints import TypeConstraints
|
|
52
|
-
from .v4.type_def import Definition as TypeDefinition
|
|
53
|
-
from .v4.type_spec import Specification as TypeSpecification
|
|
54
|
-
from .v4.value import Definition as ValueDefinition
|
|
55
|
-
from .v4.value import Pattern, Value, ValueAttributes
|
|
56
|
-
from .v4.value import Specification as ValueSpecification
|
|
57
|
-
|
|
58
|
-
__all__ = [
|
|
59
|
-
"AccessControlled",
|
|
60
|
-
"ApplicationDistribution",
|
|
61
|
-
"BoolLiteral",
|
|
62
|
-
"CharLiteral",
|
|
63
|
-
"DecimalLiteral",
|
|
64
|
-
"DecorationFormat",
|
|
65
|
-
"DecorationValuesFile",
|
|
66
|
-
"DefRef",
|
|
67
|
-
"Distribution",
|
|
68
|
-
"DocArray",
|
|
69
|
-
"DocBool",
|
|
70
|
-
"DocFloat",
|
|
71
|
-
"DocInt",
|
|
72
|
-
"DocNull",
|
|
73
|
-
"DocObject",
|
|
74
|
-
"DocString",
|
|
75
|
-
"Document",
|
|
76
|
-
"Documented",
|
|
77
|
-
"EntryPoint",
|
|
78
|
-
"EntryPointKind",
|
|
79
|
-
"FQName",
|
|
80
|
-
"Field",
|
|
81
|
-
"FileMeta",
|
|
82
|
-
"FileWithDefs",
|
|
83
|
-
"FloatLiteral",
|
|
84
|
-
"IntegerLiteral",
|
|
85
|
-
"LayerManifest",
|
|
86
|
-
"LibraryDistribution",
|
|
87
|
-
"Literal",
|
|
88
|
-
"Name",
|
|
89
|
-
"PackageInfo",
|
|
90
|
-
"Path",
|
|
91
|
-
"Pattern",
|
|
92
|
-
"PointerRef",
|
|
93
|
-
"QName",
|
|
94
|
-
"Ref",
|
|
95
|
-
"SchemaRef",
|
|
96
|
-
"SourceRange",
|
|
97
|
-
"SpecsDistribution",
|
|
98
|
-
"StringLiteral",
|
|
99
|
-
"Type",
|
|
100
|
-
"TypeAttributes",
|
|
101
|
-
"TypeConstraints",
|
|
102
|
-
"TypeDefinition",
|
|
103
|
-
"TypeSpecification",
|
|
104
|
-
"Value",
|
|
105
|
-
"ValueAttributes",
|
|
106
|
-
"ValueDefinition",
|
|
107
|
-
"ValueSpecification",
|
|
108
|
-
"module",
|
|
109
|
-
"package",
|
|
110
|
-
]
|
morphir/ir/access_controlled.py
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"""Compatibility shim: re-exports `morphir.ir.v4.access_controlled`."""
|
|
2
|
-
|
|
3
|
-
from morphir.ir.v4.access_controlled import (
|
|
4
|
-
AccessControlled,
|
|
5
|
-
Private,
|
|
6
|
-
Public,
|
|
7
|
-
T,
|
|
8
|
-
)
|
|
9
|
-
|
|
10
|
-
__all__ = [
|
|
11
|
-
"AccessControlled",
|
|
12
|
-
"Private",
|
|
13
|
-
"Public",
|
|
14
|
-
"T",
|
|
15
|
-
]
|
morphir/ir/decorations.py
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"""Compatibility shim: re-exports `morphir.ir.v4.decorations`."""
|
|
2
|
-
|
|
3
|
-
from morphir.ir.v4.decorations import (
|
|
4
|
-
DecorationFormat,
|
|
5
|
-
DecorationValuesFile,
|
|
6
|
-
LayerManifest,
|
|
7
|
-
SchemaRef,
|
|
8
|
-
deep_merge,
|
|
9
|
-
merge_decoration_values,
|
|
10
|
-
)
|
|
11
|
-
|
|
12
|
-
__all__ = [
|
|
13
|
-
"DecorationFormat",
|
|
14
|
-
"DecorationValuesFile",
|
|
15
|
-
"LayerManifest",
|
|
16
|
-
"SchemaRef",
|
|
17
|
-
"deep_merge",
|
|
18
|
-
"merge_decoration_values",
|
|
19
|
-
]
|
morphir/ir/diagnostics.py
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
"""Structured diagnostics shared by the IR readers, codecs, and migrations.
|
|
2
|
-
|
|
3
|
-
Every diagnostic code lives in this module so that an upstream rename is a single
|
|
4
|
-
edit. Codes reuse upstream vocabulary where it exists:
|
|
5
|
-
|
|
6
|
-
- format-version codes come from the finos/morphir format-version contract
|
|
7
|
-
(``docs/spec/ir/format-version.md``);
|
|
8
|
-
- ``specs_before_3_1`` comes from the finos/morphir v3 specification
|
|
9
|
-
(``docs/spec/ir/schemas/v3/whats-new.md``, decision record 0018);
|
|
10
|
-
- decoding codes come from the Morphir Compatibility Kit (morphir-rust
|
|
11
|
-
``ir/diagnostic.rs``);
|
|
12
|
-
- downgrade codes come from the finos CLI and morphir-moonbit
|
|
13
|
-
``migration/v3/migration.mbt``, and may be renamed when finos bead
|
|
14
|
-
``morphir-diwy`` settles;
|
|
15
|
-
- ``package_version_dropped``, ``source_location_dropped``,
|
|
16
|
-
``input_attributes_dropped``, and ``no_v4_spelling`` are local to
|
|
17
|
-
morphir-python.
|
|
18
|
-
"""
|
|
19
|
-
|
|
20
|
-
from __future__ import annotations
|
|
21
|
-
|
|
22
|
-
from dataclasses import dataclass
|
|
23
|
-
|
|
24
|
-
# Format version (finos/morphir format-version contract).
|
|
25
|
-
MISSING_FORMAT_VERSION = "missing_format_version"
|
|
26
|
-
DUPLICATE_FORMAT_VERSION = "duplicate_format_version"
|
|
27
|
-
INVALID_FORMAT_VERSION_TYPE = "invalid_format_version_type"
|
|
28
|
-
INVALID_FORMAT_VERSION_SYNTAX = "invalid_format_version_syntax"
|
|
29
|
-
FORMAT_VERSION_OUT_OF_RANGE = "format_version_out_of_range"
|
|
30
|
-
UNSUPPORTED_FORMAT_VERSION_MAJOR = "unsupported_format_version_major"
|
|
31
|
-
UNSUPPORTED_FORMAT_VERSION_MINOR = "unsupported_format_version_minor"
|
|
32
|
-
|
|
33
|
-
# A v3 Specs distribution declared below 3.1.0 (finos/morphir decision record 0018).
|
|
34
|
-
SPECS_BEFORE_3_1 = "specs_before_3_1"
|
|
35
|
-
|
|
36
|
-
# Decoding (Morphir Compatibility Kit).
|
|
37
|
-
UNKNOWN_NODE = "unknown_node"
|
|
38
|
-
UNKNOWN_MEMBER = "unknown_member"
|
|
39
|
-
MISSING_MEMBER = "missing_member"
|
|
40
|
-
DUPLICATE_MEMBER = "duplicate_member"
|
|
41
|
-
INVALID_NAME = "invalid_name"
|
|
42
|
-
INVALID_LITERAL = "invalid_literal"
|
|
43
|
-
INVALID_JSON = "invalid_json"
|
|
44
|
-
|
|
45
|
-
# Encoding a v4 construct that has no spelling in the pinned draft profile.
|
|
46
|
-
NO_V4_SPELLING = "no_v4_spelling"
|
|
47
|
-
|
|
48
|
-
# Reverse migration (finos CLI, morphir-moonbit).
|
|
49
|
-
UNSUPPORTED_V4_DOWNGRADE = "unsupported_v4_downgrade"
|
|
50
|
-
UNSUPPORTED_ATTRIBUTES_DOWNGRADE = "unsupported_attributes_downgrade"
|
|
51
|
-
MISSING_INFERRED_TYPE = "missing_inferred_type"
|
|
52
|
-
UNSUPPORTED_DOCUMENTATION_DOWNGRADE = "unsupported_documentation_downgrade"
|
|
53
|
-
|
|
54
|
-
# Warnings (morphir-python).
|
|
55
|
-
PACKAGE_VERSION_DROPPED = "package_version_dropped"
|
|
56
|
-
SOURCE_LOCATION_DROPPED = "source_location_dropped"
|
|
57
|
-
INPUT_ATTRIBUTES_DROPPED = "input_attributes_dropped"
|
|
58
|
-
|
|
59
|
-
Location = tuple[str | int, ...]
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
@dataclass(frozen=True)
|
|
63
|
-
class Diagnostic:
|
|
64
|
-
"""A machine-readable problem found while reading, writing, or migrating IR.
|
|
65
|
-
|
|
66
|
-
Attributes:
|
|
67
|
-
code: Stable diagnostic code, one of the constants in this module.
|
|
68
|
-
construct: Name of the IR construct involved, such as ``"Hole"``.
|
|
69
|
-
location: Path from the document root to the construct.
|
|
70
|
-
message: Human-readable explanation. Callers must not parse it.
|
|
71
|
-
"""
|
|
72
|
-
|
|
73
|
-
code: str
|
|
74
|
-
construct: str
|
|
75
|
-
location: Location
|
|
76
|
-
message: str
|
|
77
|
-
|
|
78
|
-
def render(self) -> str:
|
|
79
|
-
"""Render as ``code at location: message`` for terminal output."""
|
|
80
|
-
where = "/".join(str(part) for part in self.location) or "<root>"
|
|
81
|
-
return f"{self.code} at {where}: {self.message}"
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
class DiagnosticError(Exception):
|
|
85
|
-
"""Raised by readers and codecs when input cannot be processed.
|
|
86
|
-
|
|
87
|
-
Attributes:
|
|
88
|
-
diagnostics: One or more diagnostics describing the failure.
|
|
89
|
-
"""
|
|
90
|
-
|
|
91
|
-
def __init__(self, *diagnostics: Diagnostic) -> None:
|
|
92
|
-
self.diagnostics: tuple[Diagnostic, ...] = diagnostics
|
|
93
|
-
super().__init__("; ".join(d.render() for d in diagnostics))
|
|
94
|
-
|
|
95
|
-
@property
|
|
96
|
-
def codes(self) -> tuple[str, ...]:
|
|
97
|
-
"""The diagnostic codes, in order."""
|
|
98
|
-
return tuple(d.code for d in self.diagnostics)
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
def fail(
|
|
102
|
-
code: str, construct: str, location: Location, message: str
|
|
103
|
-
) -> DiagnosticError:
|
|
104
|
-
"""Build a `DiagnosticError` holding a single diagnostic."""
|
|
105
|
-
return DiagnosticError(Diagnostic(code, construct, location, message))
|
morphir/ir/distribution.py
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"""Compatibility shim: re-exports `morphir.ir.v4.distribution`."""
|
|
2
|
-
|
|
3
|
-
from morphir.ir.v4.distribution import (
|
|
4
|
-
ApplicationDistribution,
|
|
5
|
-
Distribution,
|
|
6
|
-
EntryPoint,
|
|
7
|
-
EntryPointKind,
|
|
8
|
-
LibraryDistribution,
|
|
9
|
-
PackageInfo,
|
|
10
|
-
SpecsDistribution,
|
|
11
|
-
)
|
|
12
|
-
|
|
13
|
-
__all__ = [
|
|
14
|
-
"ApplicationDistribution",
|
|
15
|
-
"Distribution",
|
|
16
|
-
"EntryPoint",
|
|
17
|
-
"EntryPointKind",
|
|
18
|
-
"LibraryDistribution",
|
|
19
|
-
"PackageInfo",
|
|
20
|
-
"SpecsDistribution",
|
|
21
|
-
]
|
morphir/ir/document.py
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"""Compatibility shim: re-exports `morphir.ir.v4.document`."""
|
|
2
|
-
|
|
3
|
-
from morphir.ir.v4.document import (
|
|
4
|
-
DocArray,
|
|
5
|
-
DocBool,
|
|
6
|
-
DocFloat,
|
|
7
|
-
DocInt,
|
|
8
|
-
DocNull,
|
|
9
|
-
DocObject,
|
|
10
|
-
DocString,
|
|
11
|
-
Document,
|
|
12
|
-
array,
|
|
13
|
-
bool_,
|
|
14
|
-
float_,
|
|
15
|
-
int_,
|
|
16
|
-
null,
|
|
17
|
-
object_,
|
|
18
|
-
string,
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
__all__ = [
|
|
22
|
-
"DocArray",
|
|
23
|
-
"DocBool",
|
|
24
|
-
"DocFloat",
|
|
25
|
-
"DocInt",
|
|
26
|
-
"DocNull",
|
|
27
|
-
"DocObject",
|
|
28
|
-
"DocString",
|
|
29
|
-
"Document",
|
|
30
|
-
"array",
|
|
31
|
-
"bool_",
|
|
32
|
-
"float_",
|
|
33
|
-
"int_",
|
|
34
|
-
"null",
|
|
35
|
-
"object_",
|
|
36
|
-
"string",
|
|
37
|
-
]
|