sysmlpy 0.62.0__tar.gz → 0.64.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.
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/PKG-INFO +1 -1
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/pyproject.toml +1 -1
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/__init__.py +11 -1
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/__main__.py +235 -1
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/antlr_visitor.py +11 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/definition.py +8 -0
- sysmlpy-0.64.0/src/sysmlpy/evaluator.py +1156 -0
- sysmlpy-0.64.0/src/sysmlpy/interchange.py +294 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/usage.py +15 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/LICENSE +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/README.md +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/antlr/README.md +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/antlr/SysMLv2Lexer.interp +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/antlr/SysMLv2Lexer.py +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/antlr/SysMLv2Lexer.tokens +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/antlr/SysMLv2Parser.interp +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/antlr/SysMLv2Parser.py +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/antlr/SysMLv2Parser.tokens +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/antlr/SysMLv2ParserListener.py +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/antlr/SysMLv2ParserVisitor.py +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/antlr/src/sysmlpy/grammar/antlr4/SysMLv2Lexer.interp +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/antlr/src/sysmlpy/grammar/antlr4/SysMLv2Lexer.py +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/antlr/src/sysmlpy/grammar/antlr4/SysMLv2Lexer.tokens +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/antlr_parser.py +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/boxes_view.py +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/examples/attribute_values.py +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/examples/part_attributes.py +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/examples/tuples_sequences.py +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/formatting.py +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/grammar/antlr4/README.md +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/grammar/antlr4/SysMLv2Lexer.g4 +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/grammar/antlr4/SysMLv2Lexer.interp +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/grammar/antlr4/SysMLv2Lexer.py +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/grammar/antlr4/SysMLv2Lexer.tokens +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/grammar/antlr4/SysMLv2Parser.g4 +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/grammar/antlr4/SysMLv2Parser.interp +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/grammar/antlr4/SysMLv2Parser.py +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/grammar/antlr4/SysMLv2Parser.tokens +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/grammar/antlr4/SysMLv2ParserListener.py +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/grammar/antlr4/SysMLv2ParserVisitor.py +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/grammar/antlr4/desc.xml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/grammar/antlr4/examples/camera.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/grammar/antlr4/examples/toaster-system.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/grammar/antlr4/examples/vehicle-model.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/grammar/antlr4/pom.xml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/grammar/classes.py +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/LICENSE +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/README.md +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/__init__.py +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/domain/Analysis/AnalysisTooling.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/domain/Analysis/SampledFunctions.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/domain/Analysis/StateSpaceRepresentation.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/domain/Analysis/TradeStudies.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/domain/Cause and Effect/CausationConnections.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/domain/Cause and Effect/CauseAndEffect.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/domain/Geometry/ShapeItems.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/domain/Geometry/SpatialItems.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/domain/Metadata/ImageMetadata.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/domain/Metadata/ModelingMetadata.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/domain/Metadata/ParametersOfInterestMetadata.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/domain/Metadata/RiskMetadata.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/domain/Quantities and Units/ISQ.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/domain/Quantities and Units/ISQAcoustics.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/domain/Quantities and Units/ISQAtomicNuclear.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/domain/Quantities and Units/ISQBase.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/domain/Quantities and Units/ISQCharacteristicNumbers.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/domain/Quantities and Units/ISQChemistryMolecular.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/domain/Quantities and Units/ISQCondensedMatter.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/domain/Quantities and Units/ISQElectromagnetism.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/domain/Quantities and Units/ISQInformation.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/domain/Quantities and Units/ISQLight.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/domain/Quantities and Units/ISQMechanics.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/domain/Quantities and Units/ISQSpaceTime.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/domain/Quantities and Units/ISQThermodynamics.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/domain/Quantities and Units/MeasurementRefCalculations.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/domain/Quantities and Units/MeasurementReferences.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/domain/Quantities and Units/Quantities.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/domain/Quantities and Units/QuantityCalculations.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/domain/Quantities and Units/SI.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/domain/Quantities and Units/SIPrefixes.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/domain/Quantities and Units/TensorCalculations.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/domain/Quantities and Units/Time.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/domain/Quantities and Units/USCustomaryUnits.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/domain/Quantities and Units/VectorCalculations.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/domain/Requirement Derivation/DerivationConnections.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/domain/Requirement Derivation/RequirementDerivation.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/kernel/Base.kerml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/kernel/BaseFunctions.kerml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/kernel/BooleanFunctions.kerml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/kernel/Clocks.kerml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/kernel/CollectionFunctions.kerml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/kernel/Collections.kerml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/kernel/ComplexFunctions.kerml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/kernel/ControlFunctions.kerml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/kernel/ControlPerformances.kerml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/kernel/DataFunctions.kerml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/kernel/FeatureReferencingPerformances.kerml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/kernel/IntegerFunctions.kerml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/kernel/KerML.kerml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/kernel/Links.kerml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/kernel/Metaobjects.kerml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/kernel/NaturalFunctions.kerml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/kernel/NumericalFunctions.kerml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/kernel/Objects.kerml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/kernel/Observation.kerml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/kernel/OccurrenceFunctions.kerml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/kernel/Occurrences.kerml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/kernel/Performances.kerml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/kernel/RationalFunctions.kerml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/kernel/RealFunctions.kerml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/kernel/ScalarFunctions.kerml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/kernel/ScalarValues.kerml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/kernel/SequenceFunctions.kerml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/kernel/SpatialFrames.kerml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/kernel/StatePerformances.kerml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/kernel/StringFunctions.kerml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/kernel/Transfers.kerml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/kernel/TransitionPerformances.kerml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/kernel/TrigFunctions.kerml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/kernel/Triggers.kerml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/kernel/VectorFunctions.kerml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/kernel/VectorValues.kerml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/systems/Actions.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/systems/Allocations.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/systems/AnalysisCases.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/systems/Attributes.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/systems/Calculations.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/systems/Cases.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/systems/Connections.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/systems/Constraints.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/systems/Flows.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/systems/Interfaces.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/systems/Items.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/systems/Metadata.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/systems/Parts.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/systems/Ports.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/systems/Requirements.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/systems/StandardViewDefinitions.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/systems/States.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/systems/SysML.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/systems/UseCases.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/systems/VerificationCases.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/library/systems/Views.sysml +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/navigate.py +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/plantuml.py +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/project.py +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/semantic.py +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/store.py +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/traceability.py +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/us_customary_units.txt +0 -0
- {sysmlpy-0.62.0 → sysmlpy-0.64.0}/src/sysmlpy/validator.py +0 -0
|
@@ -19,6 +19,9 @@ __all__ = [
|
|
|
19
19
|
"as_traceability_matrix_view",
|
|
20
20
|
"as_sequence_view", "as_case_view", "as_browser_view",
|
|
21
21
|
"extract_traceability", "TraceabilityReport", "RequirementTrace",
|
|
22
|
+
"to_interchange", "from_interchange", "interchange_to_json_text",
|
|
23
|
+
"evaluate_expression", "evaluate_calculation", "collect_values",
|
|
24
|
+
"check_constraints", "ConstraintReport", "ConstraintResult",
|
|
22
25
|
"analyze", "AnalysisResult", "SemanticIssue", "SemanticAnalyzer",
|
|
23
26
|
"SysMLSyntaxError", "PartialParseError",
|
|
24
27
|
"loads_partial", "load_partial",
|
|
@@ -27,7 +30,7 @@ __all__ = [
|
|
|
27
30
|
"render_state_transition_view_svg", "boxes_view",
|
|
28
31
|
]
|
|
29
32
|
__author__ = "Jon Fox"
|
|
30
|
-
__version__ = "0.
|
|
33
|
+
__version__ = "0.64.0"
|
|
31
34
|
|
|
32
35
|
from sysmlpy.usage import (
|
|
33
36
|
Item, Attribute, Part, Port, Action, Reference, UseCase, Requirement, Interface, Message,
|
|
@@ -47,6 +50,13 @@ from sysmlpy.traceability import (
|
|
|
47
50
|
extract_traceability, TraceabilityReport, RequirementTrace,
|
|
48
51
|
as_traceability_matrix_view,
|
|
49
52
|
)
|
|
53
|
+
from sysmlpy.interchange import (
|
|
54
|
+
to_interchange, from_interchange, interchange_to_json_text,
|
|
55
|
+
)
|
|
56
|
+
from sysmlpy.evaluator import (
|
|
57
|
+
evaluate_expression, evaluate_calculation, collect_values,
|
|
58
|
+
check_constraints, ConstraintReport, ConstraintResult,
|
|
59
|
+
)
|
|
50
60
|
|
|
51
61
|
|
|
52
62
|
class PartialParseError(Exception):
|
|
@@ -31,7 +31,7 @@ import sysmlpy
|
|
|
31
31
|
from sysmlpy import loads
|
|
32
32
|
|
|
33
33
|
# Subcommand table, also used to detect the legacy flat invocation form.
|
|
34
|
-
SUBCOMMANDS = ("parse", "analyze", "view", "trace", "format", "fmt")
|
|
34
|
+
SUBCOMMANDS = ("parse", "analyze", "view", "trace", "export", "import", "eval", "format", "fmt")
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
# ---------------------------------------------------------------------------
|
|
@@ -317,6 +317,167 @@ def cmd_trace(args) -> int:
|
|
|
317
317
|
return 0
|
|
318
318
|
|
|
319
319
|
|
|
320
|
+
def cmd_export(args) -> int:
|
|
321
|
+
"""SysML text → JSON interchange document (v0.63.0, Goal 3)."""
|
|
322
|
+
from sysmlpy.interchange import to_interchange, interchange_to_json_text
|
|
323
|
+
|
|
324
|
+
paths = [Path(f) for f in args.files]
|
|
325
|
+
for p in _missing_files(paths):
|
|
326
|
+
print(f"Error: File '{p}' not found.", file=sys.stderr)
|
|
327
|
+
return 2
|
|
328
|
+
|
|
329
|
+
try:
|
|
330
|
+
model = sysmlpy.load_files(paths, library=args.library)
|
|
331
|
+
except Exception as e:
|
|
332
|
+
print(f"Parse error: {e}", file=sys.stderr)
|
|
333
|
+
return 2
|
|
334
|
+
|
|
335
|
+
try:
|
|
336
|
+
document = to_interchange(model)
|
|
337
|
+
except Exception as e:
|
|
338
|
+
print(f"Error: export failed on this model: {e}", file=sys.stderr)
|
|
339
|
+
return 1
|
|
340
|
+
|
|
341
|
+
output = interchange_to_json_text(document, indent=None if args.compact else 2)
|
|
342
|
+
if args.output:
|
|
343
|
+
Path(args.output).write_text(output + "\n", encoding="utf-8")
|
|
344
|
+
print(f"Wrote {args.output}")
|
|
345
|
+
else:
|
|
346
|
+
print(output)
|
|
347
|
+
return 0
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
def cmd_import(args) -> int:
|
|
351
|
+
"""JSON interchange document → SysML text (v0.63.0, Goal 3)."""
|
|
352
|
+
from sysmlpy.interchange import from_interchange
|
|
353
|
+
|
|
354
|
+
path = Path(args.file)
|
|
355
|
+
if not path.exists():
|
|
356
|
+
print(f"Error: File '{path}' not found.", file=sys.stderr)
|
|
357
|
+
return 2
|
|
358
|
+
|
|
359
|
+
try:
|
|
360
|
+
content = path.read_text(encoding="utf-8")
|
|
361
|
+
except OSError as e:
|
|
362
|
+
print(f"Error reading file: {e}", file=sys.stderr)
|
|
363
|
+
return 2
|
|
364
|
+
|
|
365
|
+
try:
|
|
366
|
+
model = from_interchange(content)
|
|
367
|
+
except ValueError as e:
|
|
368
|
+
print(f"Error: invalid interchange document: {e}", file=sys.stderr)
|
|
369
|
+
return 2
|
|
370
|
+
except json.JSONDecodeError as e:
|
|
371
|
+
print(f"Error: not valid JSON: {e}", file=sys.stderr)
|
|
372
|
+
return 2
|
|
373
|
+
|
|
374
|
+
output = model.dump()
|
|
375
|
+
if args.output:
|
|
376
|
+
if not output.endswith("\n"):
|
|
377
|
+
output += "\n"
|
|
378
|
+
Path(args.output).write_text(output, encoding="utf-8")
|
|
379
|
+
print(f"Wrote {args.output}")
|
|
380
|
+
else:
|
|
381
|
+
print(output)
|
|
382
|
+
return 0
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
def _parse_eval_value(text):
|
|
386
|
+
"""Parse a --set NAME=VALUE literal (number / bool / string / unit)."""
|
|
387
|
+
from sysmlpy.usage import ureg
|
|
388
|
+
raw = text
|
|
389
|
+
low = raw.strip().lower()
|
|
390
|
+
if low == "true":
|
|
391
|
+
return True
|
|
392
|
+
if low == "false":
|
|
393
|
+
return False
|
|
394
|
+
try:
|
|
395
|
+
return int(raw)
|
|
396
|
+
except ValueError:
|
|
397
|
+
pass
|
|
398
|
+
try:
|
|
399
|
+
return float(raw)
|
|
400
|
+
except ValueError:
|
|
401
|
+
pass
|
|
402
|
+
try:
|
|
403
|
+
return ureg(raw)
|
|
404
|
+
except Exception:
|
|
405
|
+
pass
|
|
406
|
+
return raw
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
def cmd_eval(args) -> int:
|
|
410
|
+
"""Expression evaluation / constraint checking (v0.64.0, Goal 4)."""
|
|
411
|
+
from sysmlpy.evaluator import (
|
|
412
|
+
evaluate_expression, collect_values, check_constraints,
|
|
413
|
+
EvaluationError,
|
|
414
|
+
)
|
|
415
|
+
|
|
416
|
+
paths = [Path(f) for f in args.files]
|
|
417
|
+
for p in _missing_files(paths):
|
|
418
|
+
print(f"Error: File '{p}' not found.", file=sys.stderr)
|
|
419
|
+
return 2
|
|
420
|
+
|
|
421
|
+
try:
|
|
422
|
+
model = sysmlpy.load_files(paths, library=args.library)
|
|
423
|
+
except Exception as e:
|
|
424
|
+
print(f"Parse error: {e}", file=sys.stderr)
|
|
425
|
+
return 2
|
|
426
|
+
|
|
427
|
+
bindings = {}
|
|
428
|
+
for spec in args.set or []:
|
|
429
|
+
if "=" not in spec:
|
|
430
|
+
print(f"Error: --set expects NAME=VALUE, got {spec!r}",
|
|
431
|
+
file=sys.stderr)
|
|
432
|
+
return 2
|
|
433
|
+
name, _, raw = spec.partition("=")
|
|
434
|
+
bindings[name.strip()] = _parse_eval_value(raw)
|
|
435
|
+
|
|
436
|
+
if args.expr is not None:
|
|
437
|
+
try:
|
|
438
|
+
value = evaluate_expression(
|
|
439
|
+
args.expr, model=model, element=args.element,
|
|
440
|
+
bindings=bindings,
|
|
441
|
+
)
|
|
442
|
+
except EvaluationError as e:
|
|
443
|
+
print(f"Error: {e}", file=sys.stderr)
|
|
444
|
+
return 1
|
|
445
|
+
print(_format_value(value))
|
|
446
|
+
return 0
|
|
447
|
+
|
|
448
|
+
if args.constraints:
|
|
449
|
+
report = check_constraints(model, bindings=bindings)
|
|
450
|
+
output = report.to_text()
|
|
451
|
+
if args.output:
|
|
452
|
+
Path(args.output).write_text(output + "\n", encoding="utf-8")
|
|
453
|
+
print(f"Wrote {args.output}")
|
|
454
|
+
else:
|
|
455
|
+
print(output)
|
|
456
|
+
if report.failed or report.errored:
|
|
457
|
+
return 1
|
|
458
|
+
return 0
|
|
459
|
+
|
|
460
|
+
# default: dump all attribute values
|
|
461
|
+
values = collect_values(model, bindings=bindings)
|
|
462
|
+
lines = [f"{name} = {_format_value(value)}"
|
|
463
|
+
for name, value in sorted(values.items())]
|
|
464
|
+
output = "\n".join(lines) if lines else "(no attribute values)"
|
|
465
|
+
if args.output:
|
|
466
|
+
Path(args.output).write_text(output + "\n", encoding="utf-8")
|
|
467
|
+
print(f"Wrote {args.output}")
|
|
468
|
+
else:
|
|
469
|
+
print(output)
|
|
470
|
+
return 0
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
def _format_value(value):
|
|
474
|
+
if isinstance(value, bool):
|
|
475
|
+
return str(value)
|
|
476
|
+
if value is None:
|
|
477
|
+
return "null"
|
|
478
|
+
return str(value)
|
|
479
|
+
|
|
480
|
+
|
|
320
481
|
# ---------------------------------------------------------------------------
|
|
321
482
|
# legacy flat invocation (kept for backward compatibility)
|
|
322
483
|
# ---------------------------------------------------------------------------
|
|
@@ -541,6 +702,79 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
541
702
|
)
|
|
542
703
|
p_trace.set_defaults(func=cmd_trace)
|
|
543
704
|
|
|
705
|
+
p_export = sub.add_parser(
|
|
706
|
+
"export",
|
|
707
|
+
help="Export SysML to the JSON interchange format",
|
|
708
|
+
description="Load the files as one merged model and emit a "
|
|
709
|
+
"JSON-LD-style partition interchange document "
|
|
710
|
+
"(flat @graph of elements with @id/@type). Exit 2 "
|
|
711
|
+
"on parse failure.",
|
|
712
|
+
)
|
|
713
|
+
p_export.add_argument("files", nargs="+", help="SysML v2 file(s)")
|
|
714
|
+
p_export.add_argument(
|
|
715
|
+
"-o", "--output",
|
|
716
|
+
help="Write the JSON document to a file instead of stdout",
|
|
717
|
+
)
|
|
718
|
+
p_export.add_argument(
|
|
719
|
+
"--compact", action="store_true",
|
|
720
|
+
help="Emit compact JSON (no indentation)",
|
|
721
|
+
)
|
|
722
|
+
p_export.add_argument(
|
|
723
|
+
"-l", "--library",
|
|
724
|
+
help="Path to SysML v2 library files to use for parsing",
|
|
725
|
+
)
|
|
726
|
+
p_export.set_defaults(func=cmd_export)
|
|
727
|
+
|
|
728
|
+
p_import = sub.add_parser(
|
|
729
|
+
"import",
|
|
730
|
+
help="Import a JSON interchange document as SysML text",
|
|
731
|
+
description="Rebuild a model from a JSON interchange document "
|
|
732
|
+
"(sysmlpy export format) and print or write the "
|
|
733
|
+
"equivalent SysML v2 text. Exit 2 on invalid input.",
|
|
734
|
+
)
|
|
735
|
+
p_import.add_argument("file", help="Interchange JSON file")
|
|
736
|
+
p_import.add_argument(
|
|
737
|
+
"-o", "--output",
|
|
738
|
+
help="Write the SysML text to a file instead of stdout",
|
|
739
|
+
)
|
|
740
|
+
p_import.set_defaults(func=cmd_import)
|
|
741
|
+
|
|
742
|
+
p_eval = sub.add_parser(
|
|
743
|
+
"eval",
|
|
744
|
+
help="Evaluate expressions, attribute values and constraints",
|
|
745
|
+
description="Bind pint attribute values and evaluate SysML "
|
|
746
|
+
"expressions, calc results, or constraint bodies. "
|
|
747
|
+
"Exit codes: 0 clean, 1 constraint failed / "
|
|
748
|
+
"evaluation error, 2 parse error.",
|
|
749
|
+
)
|
|
750
|
+
p_eval.add_argument("files", nargs="+", help="SysML v2 file(s)")
|
|
751
|
+
p_eval.add_argument(
|
|
752
|
+
"--expr",
|
|
753
|
+
help="Evaluate this expression against the model scope",
|
|
754
|
+
)
|
|
755
|
+
p_eval.add_argument(
|
|
756
|
+
"--set", action="append", metavar="NAME=VALUE",
|
|
757
|
+
help="Override a name for this evaluation (repeatable; values "
|
|
758
|
+
"may be numbers, true/false, or unit strings like '80 km/h')",
|
|
759
|
+
)
|
|
760
|
+
p_eval.add_argument(
|
|
761
|
+
"--element",
|
|
762
|
+
help="Qualified element name whose scope to evaluate in",
|
|
763
|
+
)
|
|
764
|
+
p_eval.add_argument(
|
|
765
|
+
"--constraints", action="store_true",
|
|
766
|
+
help="Evaluate all constraint bodies; exit 1 on any failure",
|
|
767
|
+
)
|
|
768
|
+
p_eval.add_argument(
|
|
769
|
+
"-o", "--output",
|
|
770
|
+
help="Write the report/value to a file instead of stdout",
|
|
771
|
+
)
|
|
772
|
+
p_eval.add_argument(
|
|
773
|
+
"-l", "--library",
|
|
774
|
+
help="Path to SysML v2 library files to use for parsing",
|
|
775
|
+
)
|
|
776
|
+
p_eval.set_defaults(func=cmd_eval)
|
|
777
|
+
|
|
544
778
|
return parser
|
|
545
779
|
|
|
546
780
|
|
|
@@ -12732,6 +12732,17 @@ def _visit_nested_definition_element(def_elem):
|
|
|
12732
12732
|
return _make_port_definition_dict(def_elem.portDefinition(), None)
|
|
12733
12733
|
elif hasattr(def_elem, 'interfaceDefinition') and def_elem.interfaceDefinition():
|
|
12734
12734
|
return _make_interface_definition_dict(def_elem.interfaceDefinition(), None)
|
|
12735
|
+
elif hasattr(def_elem, 'calculationDefinition') and def_elem.calculationDefinition():
|
|
12736
|
+
# v0.64.0 (Goal 4): calc defs inside part/item/etc. bodies were
|
|
12737
|
+
# silently dropped (returned None), losing the result expression
|
|
12738
|
+
# the evaluator needs.
|
|
12739
|
+
return _make_calculation_definition_dict(
|
|
12740
|
+
def_elem.calculationDefinition(), None
|
|
12741
|
+
)
|
|
12742
|
+
elif hasattr(def_elem, 'constraintDefinition') and def_elem.constraintDefinition():
|
|
12743
|
+
return _make_constraint_definition_dict(
|
|
12744
|
+
def_elem.constraintDefinition(), None
|
|
12745
|
+
)
|
|
12735
12746
|
elif hasattr(def_elem, 'annotatingElement') and def_elem.annotatingElement():
|
|
12736
12747
|
ann_ctx = def_elem.annotatingElement()
|
|
12737
12748
|
ann_dict = _visit_annotating_element_dict(ann_ctx)
|
|
@@ -93,7 +93,15 @@ class Model(Searchable):
|
|
|
93
93
|
raise ValueError("Base Model must be encapsulated by a package.")
|
|
94
94
|
|
|
95
95
|
definition = load_grammar_antlr(s, library=library)["ownedRelationship"]
|
|
96
|
+
return self._load_definition(definition)
|
|
96
97
|
|
|
98
|
+
def _load_definition(self: type[ModelType], definition) -> ModelType:
|
|
99
|
+
"""Build the model from a parsed definition-dict member list.
|
|
100
|
+
|
|
101
|
+
Shared by :meth:`load` (fresh parse) and the JSON interchange
|
|
102
|
+
importer (v0.63.0 — ``from_interchange`` feeds the rebuilt dict
|
|
103
|
+
straight into this path).
|
|
104
|
+
"""
|
|
97
105
|
member_grammar = []
|
|
98
106
|
found_package = False
|
|
99
107
|
for member in definition:
|