morphir-python 0.0.1__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.
Files changed (99) hide show
  1. morphir/__init__.py +14 -0
  2. morphir/ir/__init__.py +110 -0
  3. morphir/ir/access_controlled.py +15 -0
  4. morphir/ir/decorations.py +19 -0
  5. morphir/ir/diagnostics.py +105 -0
  6. morphir/ir/distribution.py +21 -0
  7. morphir/ir/document.py +37 -0
  8. morphir/ir/documented.py +11 -0
  9. morphir/ir/format_version.py +483 -0
  10. morphir/ir/fqname.py +9 -0
  11. morphir/ir/json.py +11 -0
  12. morphir/ir/literal.py +25 -0
  13. morphir/ir/meta.py +11 -0
  14. morphir/ir/migrate.py +1267 -0
  15. morphir/ir/module.py +17 -0
  16. morphir/ir/name.py +27 -0
  17. morphir/ir/package.py +15 -0
  18. morphir/ir/path.py +25 -0
  19. morphir/ir/qname.py +9 -0
  20. morphir/ir/ref.py +17 -0
  21. morphir/ir/type.py +37 -0
  22. morphir/ir/type_constraints.py +33 -0
  23. morphir/ir/type_def.py +19 -0
  24. morphir/ir/type_spec.py +25 -0
  25. morphir/ir/v3/__init__.py +64 -0
  26. morphir/ir/v3/_legacy_value.py +201 -0
  27. morphir/ir/v3/access_controlled.py +31 -0
  28. morphir/ir/v3/codec.py +1275 -0
  29. morphir/ir/v3/codec_v1.py +491 -0
  30. morphir/ir/v3/codec_v2.py +187 -0
  31. morphir/ir/v3/distribution.py +42 -0
  32. morphir/ir/v3/documented.py +13 -0
  33. morphir/ir/v3/fqname.py +30 -0
  34. morphir/ir/v3/literal.py +46 -0
  35. morphir/ir/v3/module.py +32 -0
  36. morphir/ir/v3/name.py +42 -0
  37. morphir/ir/v3/package.py +23 -0
  38. morphir/ir/v3/path.py +29 -0
  39. morphir/ir/v3/qname.py +16 -0
  40. morphir/ir/v3/type.py +126 -0
  41. morphir/ir/v3/value.py +235 -0
  42. morphir/ir/v4/__init__.py +160 -0
  43. morphir/ir/v4/access_controlled.py +17 -0
  44. morphir/ir/v4/annotation.py +75 -0
  45. morphir/ir/v4/codec.py +2161 -0
  46. morphir/ir/v4/decorations.py +88 -0
  47. morphir/ir/v4/distribution.py +56 -0
  48. morphir/ir/v4/document.py +69 -0
  49. morphir/ir/v4/documented.py +10 -0
  50. morphir/ir/v4/fqname.py +69 -0
  51. morphir/ir/v4/incompleteness.py +78 -0
  52. morphir/ir/v4/json.py +103 -0
  53. morphir/ir/v4/literal.py +51 -0
  54. morphir/ir/v4/meta.py +27 -0
  55. morphir/ir/v4/module.py +30 -0
  56. morphir/ir/v4/name.py +69 -0
  57. morphir/ir/v4/package.py +19 -0
  58. morphir/ir/v4/path.py +50 -0
  59. morphir/ir/v4/qname.py +34 -0
  60. morphir/ir/v4/ref.py +35 -0
  61. morphir/ir/v4/type.py +140 -0
  62. morphir/ir/v4/type_constraints.py +91 -0
  63. morphir/ir/v4/type_def.py +38 -0
  64. morphir/ir/v4/type_spec.py +64 -0
  65. morphir/ir/v4/value.py +480 -0
  66. morphir/ir/value.py +81 -0
  67. morphir/py.typed +0 -0
  68. morphir/sdk/__init__.py +110 -0
  69. morphir/sdk/_compare.py +187 -0
  70. morphir/sdk/aggregate.py +421 -0
  71. morphir/sdk/basics.py +504 -0
  72. morphir/sdk/char.py +110 -0
  73. morphir/sdk/decimal.py +311 -0
  74. morphir/sdk/dict.py +336 -0
  75. morphir/sdk/instant.py +118 -0
  76. morphir/sdk/int.py +86 -0
  77. morphir/sdk/key.py +522 -0
  78. morphir/sdk/list.py +356 -0
  79. morphir/sdk/local_date.py +436 -0
  80. morphir/sdk/local_time.py +267 -0
  81. morphir/sdk/maybe.py +135 -0
  82. morphir/sdk/number.py +237 -0
  83. morphir/sdk/regex.py +287 -0
  84. morphir/sdk/result.py +162 -0
  85. morphir/sdk/result_list.py +169 -0
  86. morphir/sdk/rule.py +103 -0
  87. morphir/sdk/set.py +214 -0
  88. morphir/sdk/stateful_app.py +49 -0
  89. morphir/sdk/string.py +427 -0
  90. morphir/sdk/tuple.py +43 -0
  91. morphir/sdk/uuid.py +209 -0
  92. morphir_python-0.0.1.dist-info/METADATA +269 -0
  93. morphir_python-0.0.1.dist-info/RECORD +99 -0
  94. morphir_python-0.0.1.dist-info/WHEEL +4 -0
  95. morphir_python-0.0.1.dist-info/entry_points.txt +2 -0
  96. morphir_python-0.0.1.dist-info/licenses/LICENSE +201 -0
  97. morphir_tools/__init__.py +13 -0
  98. morphir_tools/cli.py +223 -0
  99. morphir_tools/py.typed +0 -0
morphir/ir/v4/value.py ADDED
@@ -0,0 +1,480 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass, field
4
+ from typing import TYPE_CHECKING, Any, Union
5
+ from typing import List as TList
6
+ from typing import Tuple as TTuple
7
+
8
+ from .fqname import FQName
9
+ from .incompleteness import HoleReason, Incompleteness
10
+ from .literal import Literal
11
+ from .name import Name
12
+ from .type import Type
13
+
14
+ if TYPE_CHECKING:
15
+ from .annotation import Annotation
16
+
17
+
18
+ @dataclass(frozen=True)
19
+ class SourceLocation:
20
+ """Represents a source location (line, column)."""
21
+
22
+ start_line: int
23
+ start_column: int
24
+ end_line: int
25
+ end_column: int
26
+
27
+
28
+ @dataclass(frozen=True)
29
+ class ValueAttributes:
30
+ """Attributes associated with a value."""
31
+
32
+ source: SourceLocation | None = None
33
+ inferred_type: Type | None = None
34
+ extensions: dict[FQName, Any] = field(default_factory=dict)
35
+
36
+
37
+ # --- Patterns ---
38
+ @dataclass(frozen=True)
39
+ class WildcardPattern:
40
+ """Represents a wildcard pattern (_)."""
41
+
42
+ attributes: ValueAttributes
43
+
44
+
45
+ @dataclass(frozen=True)
46
+ class AsPattern:
47
+ """Represents an as-pattern (alias)."""
48
+
49
+ attributes: ValueAttributes
50
+ pattern: Pattern
51
+ name: Name
52
+
53
+
54
+ @dataclass(frozen=True)
55
+ class TuplePattern:
56
+ """Represents a tuple pattern."""
57
+
58
+ attributes: ValueAttributes
59
+ elements: TList[Pattern]
60
+
61
+
62
+ @dataclass(frozen=True)
63
+ class ConstructorPattern:
64
+ """Represents a constructor pattern."""
65
+
66
+ attributes: ValueAttributes
67
+ constructor: FQName
68
+ args: TList[Pattern]
69
+
70
+
71
+ @dataclass(frozen=True)
72
+ class EmptyListPattern:
73
+ """Represents an empty list pattern."""
74
+
75
+ attributes: ValueAttributes
76
+
77
+
78
+ @dataclass(frozen=True)
79
+ class HeadTailPattern:
80
+ """Represents a head-tail list pattern."""
81
+
82
+ attributes: ValueAttributes
83
+ head: Pattern
84
+ tail: Pattern
85
+
86
+
87
+ @dataclass(frozen=True)
88
+ class LiteralPattern:
89
+ """Represents a literal pattern."""
90
+
91
+ attributes: ValueAttributes
92
+ literal: Literal
93
+
94
+
95
+ @dataclass(frozen=True)
96
+ class UnitPattern:
97
+ """Represents a unit pattern."""
98
+
99
+ attributes: ValueAttributes
100
+
101
+
102
+ Pattern = Union[
103
+ WildcardPattern,
104
+ AsPattern,
105
+ TuplePattern,
106
+ ConstructorPattern,
107
+ EmptyListPattern,
108
+ HeadTailPattern,
109
+ LiteralPattern,
110
+ UnitPattern,
111
+ ]
112
+
113
+ # --- Values ---
114
+
115
+
116
+ @dataclass(frozen=True)
117
+ class LiteralValue:
118
+ """Represents a literal value."""
119
+
120
+ attributes: ValueAttributes
121
+ literal: Literal
122
+
123
+
124
+ @dataclass(frozen=True)
125
+ class Constructor:
126
+ """Represents a constructor value."""
127
+
128
+ attributes: ValueAttributes
129
+ fqname: FQName
130
+
131
+
132
+ @dataclass(frozen=True)
133
+ class Tuple:
134
+ """Represents a Tuple value."""
135
+
136
+ attributes: ValueAttributes
137
+ elements: TList["Value"]
138
+
139
+
140
+ @dataclass(frozen=True)
141
+ class List:
142
+ """Represents a List value."""
143
+
144
+ attributes: ValueAttributes
145
+ elements: TList["Value"]
146
+
147
+
148
+ @dataclass(frozen=True)
149
+ class Record:
150
+ """Represents a Record value."""
151
+
152
+ attributes: ValueAttributes
153
+ fields: TList[TTuple[Name, "Value"]]
154
+
155
+
156
+ @dataclass(frozen=True)
157
+ class Variable:
158
+ """Represents a variable reference."""
159
+
160
+ attributes: ValueAttributes
161
+ name: Name
162
+
163
+
164
+ @dataclass(frozen=True)
165
+ class Reference:
166
+ """Represents a reference to a fully qualified name."""
167
+
168
+ attributes: ValueAttributes
169
+ fqname: FQName
170
+
171
+
172
+ @dataclass(frozen=True)
173
+ class Field:
174
+ """Represents a field access."""
175
+
176
+ attributes: ValueAttributes
177
+ subject: Value
178
+ field_name: Name
179
+
180
+
181
+ @dataclass(frozen=True)
182
+ class FieldFunction:
183
+ """Represents a field accessor function."""
184
+
185
+ attributes: ValueAttributes
186
+ name: Name
187
+
188
+
189
+ @dataclass(frozen=True)
190
+ class Apply:
191
+ """Represents function application."""
192
+
193
+ attributes: ValueAttributes
194
+ function: Value
195
+ argument: Value
196
+
197
+
198
+ @dataclass(frozen=True)
199
+ class Lambda:
200
+ """Represents a lambda abstraction."""
201
+
202
+ attributes: ValueAttributes
203
+ pattern: Pattern
204
+ body: Value
205
+
206
+
207
+ @dataclass(frozen=True)
208
+ class LetDefinition:
209
+ """Represents a let definition."""
210
+
211
+ attributes: ValueAttributes
212
+ name: Name
213
+ definition: ValueDefinitionBody
214
+ in_value: Value
215
+
216
+
217
+ @dataclass(frozen=True)
218
+ class LetRecursion:
219
+ """Represents a recursive let binding."""
220
+
221
+ attributes: ValueAttributes
222
+ definitions: dict[Name, ValueDefinitionBody]
223
+ in_value: Value
224
+
225
+
226
+ @dataclass(frozen=True)
227
+ class Destructure:
228
+ """Represents a destructuring let binding."""
229
+
230
+ attributes: ValueAttributes
231
+ pattern: Pattern
232
+ value_to_destructure: Value
233
+ in_value: Value
234
+
235
+
236
+ @dataclass(frozen=True)
237
+ class IfThenElse:
238
+ """Represents an if-then-else expression."""
239
+
240
+ attributes: ValueAttributes
241
+ condition: Value
242
+ then_branch: Value
243
+ else_branch: Value
244
+
245
+
246
+ @dataclass(frozen=True)
247
+ class PatternMatch:
248
+ """Represents a pattern match expression."""
249
+
250
+ attributes: ValueAttributes
251
+ branch_on: Value
252
+ cases: TList[TTuple[Pattern, Value]]
253
+
254
+
255
+ @dataclass(frozen=True)
256
+ class UpdateRecord:
257
+ """Represents a record update."""
258
+
259
+ attributes: ValueAttributes
260
+ value_to_update: Value
261
+ fields: TList[TTuple[Name, Value]]
262
+
263
+
264
+ @dataclass(frozen=True)
265
+ class Unit:
266
+ """Represents the Unit value."""
267
+
268
+ attributes: ValueAttributes
269
+
270
+
271
+ @dataclass(frozen=True)
272
+ class Hole:
273
+ """A hole in an expression: a part that is missing, with the reason why.
274
+
275
+ Attributes:
276
+ attributes: The value attributes.
277
+ reason: Why the hole exists.
278
+ expected_type: The type the missing part should have, if known.
279
+ """
280
+
281
+ attributes: ValueAttributes
282
+ reason: HoleReason
283
+ expected_type: Type | None
284
+
285
+
286
+ @dataclass(frozen=True)
287
+ class Native:
288
+ """A native reference as a value node.
289
+
290
+ Deprecated: upstream v4 makes native operations definition bodies, not
291
+ expressions (finos/morphir decision 0008), so this node has no v4 spelling and
292
+ encoding fails with ``no_v4_spelling``. Use `NativeBody` instead.
293
+ """
294
+
295
+ attributes: ValueAttributes
296
+ fqname: FQName
297
+ native_info: Any
298
+
299
+
300
+ @dataclass(frozen=True)
301
+ class External:
302
+ """An external reference as a value node.
303
+
304
+ Deprecated: upstream v4 makes external operations definition bodies, not
305
+ expressions (finos/morphir decision 0008), so this node has no v4 spelling and
306
+ encoding fails with ``no_v4_spelling``. Use `ExternalBody` instead.
307
+ """
308
+
309
+ attributes: ValueAttributes
310
+ external_name: str
311
+ target_platform: str
312
+
313
+
314
+ Value = (
315
+ LiteralValue
316
+ | Constructor
317
+ | Tuple
318
+ | List
319
+ | Record
320
+ | Variable
321
+ | Reference
322
+ | Field
323
+ | FieldFunction
324
+ | Apply
325
+ | Lambda
326
+ | LetDefinition
327
+ | LetRecursion
328
+ | Destructure
329
+ | IfThenElse
330
+ | PatternMatch
331
+ | UpdateRecord
332
+ | Unit
333
+ | Hole
334
+ | Native
335
+ | External
336
+ )
337
+
338
+ # --- Definitions & Specs ---
339
+
340
+
341
+ @dataclass(frozen=True)
342
+ class Specification:
343
+ """Value specification: the signature of a value, and its annotations."""
344
+
345
+ inputs: TList[TTuple[Name, Type]]
346
+ output: Type
347
+ annotations: TList[Annotation] = field(default_factory=lambda: [])
348
+
349
+
350
+ @dataclass(frozen=True)
351
+ class Definition:
352
+ """A value definition with an expression body (``ExpressionBody``).
353
+
354
+ Attributes:
355
+ input_types: Each input's name, value attributes and declared type. v4
356
+ JSON spells an input as a bare type, so attributes other than the
357
+ declared type cannot be encoded; see
358
+ `morphir.ir.migrate.drop_input_attributes`.
359
+ output_type: The declared output type.
360
+ body: The expression.
361
+ """
362
+
363
+ input_types: TList[TTuple[Name, ValueAttributes, Type]]
364
+ output_type: Type
365
+ body: Value
366
+
367
+
368
+ # --- Native and external definition bodies ---
369
+
370
+
371
+ @dataclass(frozen=True)
372
+ class Arithmetic:
373
+ """Native hint: a basic arithmetic or logic operation."""
374
+
375
+
376
+ @dataclass(frozen=True)
377
+ class Comparison:
378
+ """Native hint: a comparison operation."""
379
+
380
+
381
+ @dataclass(frozen=True)
382
+ class StringOp:
383
+ """Native hint: a string operation."""
384
+
385
+
386
+ @dataclass(frozen=True)
387
+ class CollectionOp:
388
+ """Native hint: a collection operation such as map, filter or fold."""
389
+
390
+
391
+ @dataclass(frozen=True)
392
+ class PlatformSpecific:
393
+ """Native hint: an operation specific to one platform.
394
+
395
+ Attributes:
396
+ platform: The platform, such as ``"wasm"`` or ``"javascript"``.
397
+ """
398
+
399
+ platform: str
400
+
401
+
402
+ NativeHint = Union[Arithmetic, Comparison, StringOp, CollectionOp, PlatformSpecific]
403
+ """What kind of operation a native definition performs."""
404
+
405
+
406
+ @dataclass(frozen=True)
407
+ class NativeInfo:
408
+ """Information about a native definition.
409
+
410
+ Attributes:
411
+ hint: The kind of operation.
412
+ """
413
+
414
+ hint: NativeHint
415
+
416
+
417
+ @dataclass(frozen=True)
418
+ class ExternalBinding:
419
+ """One target platform's binding for an external definition.
420
+
421
+ Attributes:
422
+ target_platform: The platform. Unique within an external body.
423
+ external_name: The name of the operation on that platform.
424
+ """
425
+
426
+ target_platform: str
427
+ external_name: str
428
+
429
+
430
+ @dataclass(frozen=True)
431
+ class NativeBody:
432
+ """A value definition implemented natively by each runtime (``NativeBody``).
433
+
434
+ Attributes:
435
+ input_types: Each input's name and declared type.
436
+ output_type: The declared output type.
437
+ native_info: What kind of operation it is.
438
+ """
439
+
440
+ input_types: TList[TTuple[Name, Type]]
441
+ output_type: Type
442
+ native_info: NativeInfo
443
+
444
+
445
+ @dataclass(frozen=True)
446
+ class ExternalBody:
447
+ """A value definition bound to external operations (``ExternalBody``).
448
+
449
+ Attributes:
450
+ input_types: Each input's name and declared type.
451
+ output_type: The declared output type.
452
+ externals: One or more platform bindings, unique by platform.
453
+ body: An optional fallback expression for other platforms.
454
+ """
455
+
456
+ input_types: TList[TTuple[Name, Type]]
457
+ output_type: Type
458
+ externals: TList[ExternalBinding]
459
+ body: Value | None = None
460
+
461
+
462
+ @dataclass(frozen=True)
463
+ class IncompleteBody:
464
+ """A value definition that is not complete yet (``IncompleteBody``).
465
+
466
+ Attributes:
467
+ input_types: Each input's name and declared type.
468
+ incompleteness: Why the definition is incomplete.
469
+ output_type: The declared output type, if known yet.
470
+ partial_body: The expression written so far, if any.
471
+ """
472
+
473
+ input_types: TList[TTuple[Name, Type]]
474
+ incompleteness: Incompleteness
475
+ output_type: Type | None = None
476
+ partial_body: Value | None = None
477
+
478
+
479
+ ValueDefinitionBody = Union[Definition, NativeBody, ExternalBody, IncompleteBody]
480
+ """A v4 value definition: an expression, native, external or incomplete body."""
morphir/ir/value.py ADDED
@@ -0,0 +1,81 @@
1
+ """Compatibility shim: re-exports `morphir.ir.v4.value`."""
2
+
3
+ from morphir.ir.v4.literal import Literal
4
+ from morphir.ir.v4.type import Type
5
+ from morphir.ir.v4.value import (
6
+ Apply,
7
+ AsPattern,
8
+ Constructor,
9
+ ConstructorPattern,
10
+ Definition,
11
+ Destructure,
12
+ EmptyListPattern,
13
+ External,
14
+ Field,
15
+ FieldFunction,
16
+ HeadTailPattern,
17
+ Hole,
18
+ IfThenElse,
19
+ Lambda,
20
+ LetDefinition,
21
+ LetRecursion,
22
+ List,
23
+ LiteralPattern,
24
+ LiteralValue,
25
+ Native,
26
+ Pattern,
27
+ PatternMatch,
28
+ Record,
29
+ Reference,
30
+ SourceLocation,
31
+ Specification,
32
+ Tuple,
33
+ TuplePattern,
34
+ Unit,
35
+ UnitPattern,
36
+ UpdateRecord,
37
+ Value,
38
+ ValueAttributes,
39
+ Variable,
40
+ WildcardPattern,
41
+ )
42
+
43
+ __all__ = [
44
+ "Apply",
45
+ "AsPattern",
46
+ "Constructor",
47
+ "ConstructorPattern",
48
+ "Definition",
49
+ "Destructure",
50
+ "EmptyListPattern",
51
+ "External",
52
+ "Field",
53
+ "FieldFunction",
54
+ "HeadTailPattern",
55
+ "Hole",
56
+ "IfThenElse",
57
+ "Lambda",
58
+ "LetDefinition",
59
+ "LetRecursion",
60
+ "List",
61
+ "Literal",
62
+ "LiteralPattern",
63
+ "LiteralValue",
64
+ "Native",
65
+ "Pattern",
66
+ "PatternMatch",
67
+ "Record",
68
+ "Reference",
69
+ "SourceLocation",
70
+ "Specification",
71
+ "Tuple",
72
+ "TuplePattern",
73
+ "Type",
74
+ "Unit",
75
+ "UnitPattern",
76
+ "UpdateRecord",
77
+ "Value",
78
+ "ValueAttributes",
79
+ "Variable",
80
+ "WildcardPattern",
81
+ ]
morphir/py.typed ADDED
File without changes
@@ -0,0 +1,110 @@
1
+ """The Morphir SDK: the standard library that Morphir models compile against.
2
+
3
+ Each module mirrors one `Morphir.SDK` module. The set of functions is the
4
+ `Morphir.IR.SDK.*` package specification of finos/morphir-elm. The reference
5
+ behaviour is elm/core 1.0.5 plus the `Morphir.SDK.*` Elm runtime.
6
+
7
+ ============ ======================= ========================================
8
+ Module Elm module Python data
9
+ ============ ======================= ========================================
10
+ basics Morphir.SDK.Basics `int`, `float`, `bool`, `Order`
11
+ char Morphir.SDK.Char `str` with one code point
12
+ string Morphir.SDK.String `str`
13
+ list Morphir.SDK.List `tuple[A, ...]`
14
+ dict Morphir.SDK.Dict `Dict[K, V]`, sorted by key
15
+ set Morphir.SDK.Set `Set[A]`, sorted
16
+ maybe Morphir.SDK.Maybe `Just[A] | Nothing`
17
+ result Morphir.SDK.Result `Ok[A] | Err[E]`
18
+ tuple Morphir.SDK.Tuple `tuple[A, B]`
19
+ decimal Morphir.SDK.Decimal `decimal.Decimal`
20
+ int Morphir.SDK.Int `Int8`, `Int16`, `Int32`, `Int64`
21
+ number Morphir.SDK.Number `Number`, an exact rational
22
+ local_date Morphir.SDK.LocalDate `datetime.date`
23
+ local_time Morphir.SDK.LocalTime `LocalTime`, milliseconds from the epoch
24
+ instant Morphir.SDK.Instant `Instant`, milliseconds from the epoch
25
+ uuid Morphir.SDK.UUID `uuid.UUID`
26
+ regex Morphir.SDK.Regex `Regex` over the `re` module
27
+ aggregate Morphir.SDK.Aggregate `Aggregation`, `Operator`
28
+ rule Morphir.SDK.Rule `Callable[[A], Maybe[B]]`
29
+ key Morphir.SDK.Key `int` and flat tuples
30
+ stateful_app Morphir.SDK.StatefulApp `StatefulApp`
31
+ result_list Morphir.SDK.ResultList `tuple[Result[E, A], ...]`
32
+ ============ ======================= ========================================
33
+
34
+ Conventions:
35
+
36
+ * Names are the Elm names in snake_case: `withDefault` is `with_default`,
37
+ `integerDivide` is `integer_divide`, `toInt8` is `to_int8`. A name that is a
38
+ Python keyword gets a trailing underscore: `not_`, `and_`, `or_`. The one
39
+ exception is `isNaN`, which is `is_nan`.
40
+ * Arguments are in Elm order, with the data last, and are not curried:
41
+ `list.map(f, xs)`, `dict.get(key, d)`, `maybe.with_default(0, m)`.
42
+ * All data is immutable. Functions are pure and never mutate their input.
43
+ * Where Elm's runtime fails (`mod_by(0, x)`, comparison of functions), the
44
+ Python function raises an exception. Each docstring names the exception.
45
+
46
+ Several modules and functions have the name of a Python built-in (`list`,
47
+ `dict`, `map`, `filter`, ...). Import the modules with an alias, and call the
48
+ functions through the module:
49
+
50
+ >>> from morphir.sdk import dict as Dict
51
+ >>> from morphir.sdk import list as List
52
+ >>> from morphir.sdk import maybe as Maybe
53
+ >>> ages = Dict.from_list((("tom", 42), ("sue", 38)))
54
+ >>> Maybe.with_default(0, Dict.get("sue", ages))
55
+ 38
56
+ >>> List.map(lambda n: n * 2, Dict.values(ages))
57
+ (76, 84)
58
+
59
+ This package has no dependencies and does no IO.
60
+ """
61
+
62
+ from morphir.sdk import (
63
+ aggregate,
64
+ basics,
65
+ char,
66
+ decimal,
67
+ dict,
68
+ instant,
69
+ int,
70
+ key,
71
+ list,
72
+ local_date,
73
+ local_time,
74
+ maybe,
75
+ number,
76
+ regex,
77
+ result,
78
+ result_list,
79
+ rule,
80
+ set,
81
+ stateful_app,
82
+ string,
83
+ tuple,
84
+ uuid,
85
+ )
86
+
87
+ __all__ = [
88
+ "aggregate",
89
+ "basics",
90
+ "char",
91
+ "decimal",
92
+ "dict",
93
+ "instant",
94
+ "int",
95
+ "key",
96
+ "list",
97
+ "local_date",
98
+ "local_time",
99
+ "maybe",
100
+ "number",
101
+ "regex",
102
+ "result",
103
+ "result_list",
104
+ "rule",
105
+ "set",
106
+ "stateful_app",
107
+ "string",
108
+ "tuple",
109
+ "uuid",
110
+ ]