aas-core-codegen 0.0.16__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.
- aas_core_codegen/__init__.py +6 -0
- aas_core_codegen/__main__.py +8 -0
- aas_core_codegen/common.py +500 -0
- aas_core_codegen/cpp/__init__.py +1 -0
- aas_core_codegen/cpp/aas_common/__init__.py +6 -0
- aas_core_codegen/cpp/aas_common/_generate.py +713 -0
- aas_core_codegen/cpp/common.py +681 -0
- aas_core_codegen/cpp/constants/__init__.py +6 -0
- aas_core_codegen/cpp/constants/_generate.py +568 -0
- aas_core_codegen/cpp/description.py +654 -0
- aas_core_codegen/cpp/enhancing/__init__.py +4 -0
- aas_core_codegen/cpp/enhancing/_generate.py +993 -0
- aas_core_codegen/cpp/iteration/__init__.py +6 -0
- aas_core_codegen/cpp/iteration/_generate.py +2332 -0
- aas_core_codegen/cpp/jsonization/__init__.py +6 -0
- aas_core_codegen/cpp/jsonization/_generate.py +2619 -0
- aas_core_codegen/cpp/main.py +694 -0
- aas_core_codegen/cpp/naming.py +170 -0
- aas_core_codegen/cpp/optionaling.py +557 -0
- aas_core_codegen/cpp/pattern/__init__.py +6 -0
- aas_core_codegen/cpp/pattern/_generate.py +508 -0
- aas_core_codegen/cpp/revm/__init__.py +6 -0
- aas_core_codegen/cpp/revm/_generate.py +1149 -0
- aas_core_codegen/cpp/stringification/__init__.py +5 -0
- aas_core_codegen/cpp/stringification/_generate.py +955 -0
- aas_core_codegen/cpp/structure/__init__.py +7 -0
- aas_core_codegen/cpp/structure/_generate.py +1503 -0
- aas_core_codegen/cpp/transpilation.py +1383 -0
- aas_core_codegen/cpp/unrolling.py +159 -0
- aas_core_codegen/cpp/verification/__init__.py +6 -0
- aas_core_codegen/cpp/verification/_generate.py +3073 -0
- aas_core_codegen/cpp/visitation/__init__.py +6 -0
- aas_core_codegen/cpp/visitation/_generate.py +521 -0
- aas_core_codegen/cpp/wstringification/__init__.py +5 -0
- aas_core_codegen/cpp/wstringification/_generate.py +586 -0
- aas_core_codegen/cpp/xmlization/__init__.py +6 -0
- aas_core_codegen/cpp/xmlization/_generate.py +5373 -0
- aas_core_codegen/cpp/yielding.py +201 -0
- aas_core_codegen/csharp/__init__.py +1 -0
- aas_core_codegen/csharp/common.py +224 -0
- aas_core_codegen/csharp/constants/__init__.py +5 -0
- aas_core_codegen/csharp/constants/_generate.py +409 -0
- aas_core_codegen/csharp/copying/__init__.py +4 -0
- aas_core_codegen/csharp/copying/_generate.py +498 -0
- aas_core_codegen/csharp/description.py +1103 -0
- aas_core_codegen/csharp/enhancing/__init__.py +4 -0
- aas_core_codegen/csharp/enhancing/_generate.py +667 -0
- aas_core_codegen/csharp/jsonization/__init__.py +4 -0
- aas_core_codegen/csharp/jsonization/_generate.py +1630 -0
- aas_core_codegen/csharp/main.py +421 -0
- aas_core_codegen/csharp/naming.py +157 -0
- aas_core_codegen/csharp/reporting/__init__.py +4 -0
- aas_core_codegen/csharp/reporting/_generate.py +266 -0
- aas_core_codegen/csharp/stringification/__init__.py +4 -0
- aas_core_codegen/csharp/stringification/_generate.py +243 -0
- aas_core_codegen/csharp/structure/__init__.py +6 -0
- aas_core_codegen/csharp/structure/_generate.py +1341 -0
- aas_core_codegen/csharp/transpilation.py +990 -0
- aas_core_codegen/csharp/unrolling.py +211 -0
- aas_core_codegen/csharp/verification/__init__.py +6 -0
- aas_core_codegen/csharp/verification/_generate.py +1457 -0
- aas_core_codegen/csharp/visitation/__init__.py +5 -0
- aas_core_codegen/csharp/visitation/_generate.py +579 -0
- aas_core_codegen/csharp/xmlization/__init__.py +4 -0
- aas_core_codegen/csharp/xmlization/_generate.py +1980 -0
- aas_core_codegen/golang/__init__.py +1 -0
- aas_core_codegen/golang/aas_common/__init__.py +4 -0
- aas_core_codegen/golang/aas_common/_generate.py +152 -0
- aas_core_codegen/golang/common.py +303 -0
- aas_core_codegen/golang/constants/__init__.py +5 -0
- aas_core_codegen/golang/constants/_generate.py +339 -0
- aas_core_codegen/golang/description.py +501 -0
- aas_core_codegen/golang/enhancing/__init__.py +4 -0
- aas_core_codegen/golang/enhancing/_generate.py +527 -0
- aas_core_codegen/golang/jsonization/__init__.py +4 -0
- aas_core_codegen/golang/jsonization/_generate.py +1740 -0
- aas_core_codegen/golang/main.py +368 -0
- aas_core_codegen/golang/naming.py +412 -0
- aas_core_codegen/golang/pointering.py +631 -0
- aas_core_codegen/golang/reporting/__init__.py +4 -0
- aas_core_codegen/golang/reporting/_generate.py +218 -0
- aas_core_codegen/golang/stringification/__init__.py +4 -0
- aas_core_codegen/golang/stringification/_generate.py +394 -0
- aas_core_codegen/golang/structure/__init__.py +6 -0
- aas_core_codegen/golang/structure/_generate.py +1493 -0
- aas_core_codegen/golang/transpilation.py +1191 -0
- aas_core_codegen/golang/unrolling.py +159 -0
- aas_core_codegen/golang/verification/__init__.py +6 -0
- aas_core_codegen/golang/verification/_generate.py +1513 -0
- aas_core_codegen/golang/xmlization/__init__.py +4 -0
- aas_core_codegen/golang/xmlization/_generate.py +2507 -0
- aas_core_codegen/infer_for_schema/__init__.py +21 -0
- aas_core_codegen/infer_for_schema/_inline.py +693 -0
- aas_core_codegen/infer_for_schema/_len.py +527 -0
- aas_core_codegen/infer_for_schema/_pattern.py +311 -0
- aas_core_codegen/infer_for_schema/_set.py +394 -0
- aas_core_codegen/infer_for_schema/_stringify.py +201 -0
- aas_core_codegen/infer_for_schema/_types.py +135 -0
- aas_core_codegen/infer_for_schema/match.py +122 -0
- aas_core_codegen/intermediate/__init__.py +78 -0
- aas_core_codegen/intermediate/_hierarchy.py +397 -0
- aas_core_codegen/intermediate/_stringify.py +989 -0
- aas_core_codegen/intermediate/_translate.py +5128 -0
- aas_core_codegen/intermediate/_types.py +2901 -0
- aas_core_codegen/intermediate/construction.py +750 -0
- aas_core_codegen/intermediate/doc.py +344 -0
- aas_core_codegen/intermediate/pattern_verification.py +428 -0
- aas_core_codegen/intermediate/revm.py +985 -0
- aas_core_codegen/intermediate/type_inference.py +2266 -0
- aas_core_codegen/java/__init__.py +1 -0
- aas_core_codegen/java/common.py +197 -0
- aas_core_codegen/java/constants/__init__.py +5 -0
- aas_core_codegen/java/constants/_generate.py +334 -0
- aas_core_codegen/java/copying/__init__.py +4 -0
- aas_core_codegen/java/copying/_generate.py +502 -0
- aas_core_codegen/java/description.py +774 -0
- aas_core_codegen/java/enhancing/__init__.py +4 -0
- aas_core_codegen/java/enhancing/_generate.py +820 -0
- aas_core_codegen/java/generation/__init__.py +5 -0
- aas_core_codegen/java/generation/_generate.py +285 -0
- aas_core_codegen/java/jsonization/__init__.py +4 -0
- aas_core_codegen/java/jsonization/_generate.py +1472 -0
- aas_core_codegen/java/main.py +438 -0
- aas_core_codegen/java/naming.py +187 -0
- aas_core_codegen/java/optional.py +514 -0
- aas_core_codegen/java/reporting/__init__.py +4 -0
- aas_core_codegen/java/reporting/_generate.py +248 -0
- aas_core_codegen/java/stringification/__init__.py +4 -0
- aas_core_codegen/java/stringification/_generate.py +212 -0
- aas_core_codegen/java/structure/__init__.py +6 -0
- aas_core_codegen/java/structure/_generate.py +1767 -0
- aas_core_codegen/java/transpilation.py +1111 -0
- aas_core_codegen/java/verification/__init__.py +6 -0
- aas_core_codegen/java/verification/_generate.py +1536 -0
- aas_core_codegen/java/visitation/__init__.py +5 -0
- aas_core_codegen/java/visitation/_generate.py +689 -0
- aas_core_codegen/java/xmlization/__init__.py +4 -0
- aas_core_codegen/java/xmlization/_generate.py +2274 -0
- aas_core_codegen/jsonld/__init__.py +1 -0
- aas_core_codegen/jsonld/main.py +455 -0
- aas_core_codegen/jsonschema/__init__.py +1 -0
- aas_core_codegen/jsonschema/main.py +982 -0
- aas_core_codegen/main.py +245 -0
- aas_core_codegen/naming.py +133 -0
- aas_core_codegen/opcua/__init__.py +1 -0
- aas_core_codegen/opcua/main.py +1525 -0
- aas_core_codegen/opcua/naming.py +126 -0
- aas_core_codegen/parse/__init__.py +46 -0
- aas_core_codegen/parse/_rules.py +796 -0
- aas_core_codegen/parse/_stringify.py +532 -0
- aas_core_codegen/parse/_translate.py +3940 -0
- aas_core_codegen/parse/_types.py +973 -0
- aas_core_codegen/parse/retree/__init__.py +46 -0
- aas_core_codegen/parse/retree/_fix.py +434 -0
- aas_core_codegen/parse/retree/_parse.py +1143 -0
- aas_core_codegen/parse/retree/_render.py +298 -0
- aas_core_codegen/parse/retree/_stringify.py +199 -0
- aas_core_codegen/parse/retree/_types.py +362 -0
- aas_core_codegen/parse/retree/_visitor.py +70 -0
- aas_core_codegen/parse/tree.py +1303 -0
- aas_core_codegen/protobuf/__init__.py +1 -0
- aas_core_codegen/protobuf/common.py +225 -0
- aas_core_codegen/protobuf/description.py +1102 -0
- aas_core_codegen/protobuf/main.py +115 -0
- aas_core_codegen/protobuf/naming.py +143 -0
- aas_core_codegen/protobuf/structure/__init__.py +6 -0
- aas_core_codegen/protobuf/structure/_generate.py +502 -0
- aas_core_codegen/py.typed +1 -0
- aas_core_codegen/python/__init__.py +1 -0
- aas_core_codegen/python/aas_common/__init__.py +4 -0
- aas_core_codegen/python/aas_common/_generate.py +63 -0
- aas_core_codegen/python/common.py +406 -0
- aas_core_codegen/python/constants/__init__.py +5 -0
- aas_core_codegen/python/constants/_generate.py +377 -0
- aas_core_codegen/python/description.py +508 -0
- aas_core_codegen/python/jsonization/__init__.py +4 -0
- aas_core_codegen/python/jsonization/_generate.py +1391 -0
- aas_core_codegen/python/main.py +323 -0
- aas_core_codegen/python/naming.py +255 -0
- aas_core_codegen/python/stringification/__init__.py +4 -0
- aas_core_codegen/python/stringification/_generate.py +129 -0
- aas_core_codegen/python/structure/__init__.py +6 -0
- aas_core_codegen/python/structure/_generate.py +1801 -0
- aas_core_codegen/python/transpilation.py +958 -0
- aas_core_codegen/python/unrolling.py +156 -0
- aas_core_codegen/python/verification/__init__.py +6 -0
- aas_core_codegen/python/verification/_generate.py +1471 -0
- aas_core_codegen/python/xmlization/__init__.py +4 -0
- aas_core_codegen/python/xmlization/_generate.py +3003 -0
- aas_core_codegen/python_protobuf/__init__.py +1 -0
- aas_core_codegen/python_protobuf/main.py +1424 -0
- aas_core_codegen/python_protobuf/naming.py +85 -0
- aas_core_codegen/rdf_shacl/__init__.py +1 -0
- aas_core_codegen/rdf_shacl/_description.py +351 -0
- aas_core_codegen/rdf_shacl/common.py +206 -0
- aas_core_codegen/rdf_shacl/main.py +114 -0
- aas_core_codegen/rdf_shacl/naming.py +145 -0
- aas_core_codegen/rdf_shacl/rdf.py +435 -0
- aas_core_codegen/rdf_shacl/shacl.py +453 -0
- aas_core_codegen/run.py +124 -0
- aas_core_codegen/smoke/__init__.py +1 -0
- aas_core_codegen/smoke/main.py +219 -0
- aas_core_codegen/specific_implementations.py +72 -0
- aas_core_codegen/stringify.py +333 -0
- aas_core_codegen/typescript/__init__.py +1 -0
- aas_core_codegen/typescript/aas_common/__init__.py +4 -0
- aas_core_codegen/typescript/aas_common/_generate.py +472 -0
- aas_core_codegen/typescript/common.py +340 -0
- aas_core_codegen/typescript/constants/__init__.py +5 -0
- aas_core_codegen/typescript/constants/_generate.py +347 -0
- aas_core_codegen/typescript/description.py +530 -0
- aas_core_codegen/typescript/jsonization/__init__.py +4 -0
- aas_core_codegen/typescript/jsonization/_generate.py +1510 -0
- aas_core_codegen/typescript/main.py +258 -0
- aas_core_codegen/typescript/naming.py +189 -0
- aas_core_codegen/typescript/stringification/__init__.py +4 -0
- aas_core_codegen/typescript/stringification/_generate.py +367 -0
- aas_core_codegen/typescript/structure/__init__.py +6 -0
- aas_core_codegen/typescript/structure/_generate.py +2500 -0
- aas_core_codegen/typescript/transpilation.py +1051 -0
- aas_core_codegen/typescript/unrolling.py +159 -0
- aas_core_codegen/typescript/verification/__init__.py +6 -0
- aas_core_codegen/typescript/verification/_generate.py +1578 -0
- aas_core_codegen/xsd/__init__.py +1 -0
- aas_core_codegen/xsd/main.py +1187 -0
- aas_core_codegen/xsd/naming.py +83 -0
- aas_core_codegen/yielding/__init__.py +1 -0
- aas_core_codegen/yielding/flow.py +139 -0
- aas_core_codegen/yielding/linear.py +754 -0
- aas_core_codegen-0.0.16.dist-info/METADATA +211 -0
- aas_core_codegen-0.0.16.dist-info/RECORD +604 -0
- aas_core_codegen-0.0.16.dist-info/WHEEL +5 -0
- aas_core_codegen-0.0.16.dist-info/entry_points.txt +3 -0
- aas_core_codegen-0.0.16.dist-info/licenses/AUTHORS +9 -0
- aas_core_codegen-0.0.16.dist-info/licenses/LICENSE +23 -0
- aas_core_codegen-0.0.16.dist-info/top_level.txt +2 -0
- dev/continuous_integration/__init__.py +1 -0
- dev/continuous_integration/check_help_in_readme.py +208 -0
- dev/continuous_integration/check_init_and_pyproject_consistent.py +154 -0
- dev/continuous_integration/precommit.py +400 -0
- dev/dev_scripts/__init__.py +1 -0
- dev/dev_scripts/compare_rendered_regexes_against_source_py.py +42 -0
- dev/dev_scripts/copy_to_aas_core3_cpp.py +100 -0
- dev/dev_scripts/copy_to_aas_core3_java.py +90 -0
- dev/dev_scripts/download_latest_aas_core_meta_v3.py +114 -0
- dev/dev_scripts/draw_bipartite_graph_based_on_lines.py +37 -0
- dev/dev_scripts/run_tests_with_rerecord.py +69 -0
- dev/dev_scripts/update_to_aas_core_meta.py +174 -0
- dev/integration_tests/input/jsonschema/boilerplate/main.py +55 -0
- dev/integration_tests/input/meta_model.py +38 -0
- dev/integration_tests/input/python/boilerplate/main.py +153 -0
- dev/integration_tests/main.py +258 -0
- dev/test_data/csharp/test_structure/concrete_class_with_descendants/meta_model.py +15 -0
- dev/test_data/csharp/test_structure/constructor_without_arguments/all_properties_optional/meta_model.py +9 -0
- dev/test_data/csharp/test_structure/constructor_without_arguments/no_properties/meta_model.py +6 -0
- dev/test_data/csharp/test_verification/builtin_functions/len/on_list/meta_model.py +20 -0
- dev/test_data/csharp/test_verification/builtin_functions/len/on_str/meta_model.py +16 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_as_literal/as_prefix/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_as_literal/as_suffix/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_as_literal/in_group_with_quantifier/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_as_literal/in_the_middle/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_as_literal/in_union/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_as_literal/single_utf32_literal/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_as_literal/with_quantifier_within_group/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_as_literal/with_quantifier_without_group/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_in_character_set/literal/at_the_beginning/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_in_character_set/literal/at_the_end/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_in_character_set/literal/in_the_middle/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_in_character_set/literal/multiple/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_in_character_set/literal/single/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_in_character_set/literal/single_with_quantifier/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_in_character_set/range/mixed_with_non_utf32/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_in_character_set/range/more_than_two_high_surrogates/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_in_character_set/range/multiple_utf32_ranges/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_in_character_set/range/multiple_utf32_ranges_mixed_with_non_utf32/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_in_character_set/range/same_high_surrogate/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_in_character_set/range/same_high_surrogate_with_quantifier/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_in_character_set/range/two_high_surrogates/meta_model.py +8 -0
- dev/test_data/intermediate/expected/class/empty/meta_model.py +6 -0
- dev/test_data/intermediate/expected/class/implementation_specific_method/meta_model.py +8 -0
- dev/test_data/intermediate/expected/class/inheritance/meta_model.py +41 -0
- dev/test_data/intermediate/expected/class/methods_with_contracts/meta_model.py +15 -0
- dev/test_data/intermediate/expected/class/only_method_no_property/meta_model.py +7 -0
- dev/test_data/intermediate/expected/class/only_property_no_method/meta_model.py +9 -0
- dev/test_data/intermediate/expected/constant/constant_set/of_enum/meta_model.py +12 -0
- dev/test_data/intermediate/expected/constant/constant_set/of_str/meta_model.py +4 -0
- dev/test_data/intermediate/expected/constant/constant_set/with_description/meta_model.py +6 -0
- dev/test_data/intermediate/expected/constant/constant_set/with_superset_of/meta_model.py +14 -0
- dev/test_data/intermediate/expected/constant/constant_str/only_value/meta_model.py +7 -0
- dev/test_data/intermediate/expected/constant/constant_str/with_description/meta_model.py +5 -0
- dev/test_data/intermediate/expected/documentation/docstring_with_special_characters_in_literal/meta_model.py +20 -0
- dev/test_data/intermediate/expected/documentation/docstring_with_special_characters_outside_literal/meta_model.py +20 -0
- dev/test_data/intermediate/expected/empty/meta_model.py +2 -0
- dev/test_data/intermediate/expected/enumeration/meta_model.py +9 -0
- dev/test_data/intermediate/expected/interface/basic/meta_model.py +14 -0
- dev/test_data/intermediate/expected/interface/empty/meta_model.py +7 -0
- dev/test_data/intermediate/expected/interface/inheritance/meta_model.py +27 -0
- dev/test_data/intermediate/expected/interface/method_signature/meta_model.py +10 -0
- dev/test_data/intermediate/expected/interface/only_constructor/meta_model.py +11 -0
- dev/test_data/intermediate/expected/method/non_mutating/implementation_specific/meta_model.py +12 -0
- dev/test_data/intermediate/expected/method/non_mutating/understood/meta_model.py +11 -0
- dev/test_data/intermediate/expected/type_annotation/atomic/meta_model.py +9 -0
- dev/test_data/intermediate/expected/type_annotation/subscripted/class/meta_model.py +13 -0
- dev/test_data/intermediate/expected/type_annotation/subscripted/primitive/meta_model.py +9 -0
- dev/test_data/intermediate/unexpected/constant_set/of_enum/enumeration_literals_in_subset_outside_of_superset/meta_model.py +20 -0
- dev/test_data/intermediate/unexpected/constant_set/of_enum/invalid_literal/meta_model.py +11 -0
- dev/test_data/intermediate/unexpected/constant_set/of_enum/mismatch_between_enumeration_and_literal/meta_model.py +30 -0
- dev/test_data/intermediate/unexpected/constant_set/of_enum/mismatch_in_enumerations_between_subset_and_superset/meta_model.py +21 -0
- dev/test_data/intermediate/unexpected/constant_set/of_str/literals_in_subset_outside_of_superset/meta_model.py +18 -0
- dev/test_data/intermediate/unexpected/constant_set/of_str/mismatch_between_type_annotation_and_literals/meta_model.py +10 -0
- dev/test_data/intermediate/unexpected/constant_set/of_str/superset_and_subset_mismatch_in_type/meta_model.py +12 -0
- dev/test_data/intermediate/unexpected/constraints/dangling_constraintref/meta_model.py +18 -0
- dev/test_data/intermediate/unexpected/constraints/duplicate_constraints/meta_model.py +20 -0
- dev/test_data/intermediate/unexpected/documentation/unexpected_documentation_elements/meta_model.py +34 -0
- dev/test_data/intermediate/unexpected/invariant/class_invariant_uses_re/meta_model.py +10 -0
- dev/test_data/intermediate/unexpected/invariant/invariant_of_constrained_primitive_uses_re/meta_model.py +7 -0
- dev/test_data/intermediate/unexpected/invariant/unexpected_argument_count_to_len/meta_model.py +20 -0
- dev/test_data/intermediate/unexpected/invariant/unhandled_built_in_function/meta_model.py +16 -0
- dev/test_data/intermediate/unexpected/method_definitions/non_constant_default/meta_model.py +7 -0
- dev/test_data/intermediate/unexpected/optional_constructor_arguments_wo_default/default_non_none/meta_model.py +16 -0
- dev/test_data/intermediate/unexpected/optional_constructor_arguments_wo_default/no_default/meta_model.py +16 -0
- dev/test_data/intermediate/unexpected/properties_and_constructor_arguments_do_not_match/after_inheritance/meta_model.py +58 -0
- dev/test_data/intermediate/unexpected/properties_and_constructor_arguments_do_not_match/type_missmatch/meta_model.py +9 -0
- dev/test_data/intermediate/unexpected/properties_and_constructor_arguments_do_not_match/within_class/meta_model.py +22 -0
- dev/test_data/jsonschema/test_main/regression_when_len_constraints_on_inherited_property/meta_model.py +28 -0
- dev/test_data/opcua/test_main/abstract_and_concrete_classes/meta_model.py +37 -0
- dev/test_data/opcua/test_main/classes_with_invariants/meta_model.py +21 -0
- dev/test_data/opcua/test_main/concrete_class_with_descendant/meta_model.py +27 -0
- dev/test_data/opcua/test_main/concrete_class_with_enum/meta_model.py +21 -0
- dev/test_data/opcua/test_main/concrete_class_with_list_of_instances/meta_model.py +21 -0
- dev/test_data/opcua/test_main/concrete_class_with_primitive_attributes/meta_model.py +41 -0
- dev/test_data/opcua/test_main/concrete_class_with_string/meta_model.py +13 -0
- dev/test_data/opcua/test_main/constrained_primitive/meta_model.py +20 -0
- dev/test_data/opcua/test_main/multiple_inheritance/meta_model.py +25 -0
- dev/test_data/parse/expected/constant/constant_set/of_enum/meta_model.py +12 -0
- dev/test_data/parse/expected/constant/constant_set/of_str/meta_model.py +4 -0
- dev/test_data/parse/expected/constant/constant_set/with_description/meta_model.py +6 -0
- dev/test_data/parse/expected/constant/constant_set/with_superset_of/meta_model.py +14 -0
- dev/test_data/parse/expected/constant/constant_str/only_value/meta_model.py +7 -0
- dev/test_data/parse/expected/constant/constant_str/with_description/meta_model.py +5 -0
- dev/test_data/parse/expected/enum/ok/meta_model.py +15 -0
- dev/test_data/parse/expected/implementation_specific_class/properties_and_methods_in_implementation_specific_class/meta_model.py +17 -0
- dev/test_data/parse/expected/inheritance/basic/meta_model.py +11 -0
- dev/test_data/parse/expected/inheritance/diamond/meta_model.py +26 -0
- dev/test_data/parse/expected/inheritance/inheritance_from_concrete_class/meta_model.py +10 -0
- dev/test_data/parse/expected/invariants/in_relation/meta_model.py +16 -0
- dev/test_data/parse/expected/method/arguments/meta_model.py +7 -0
- dev/test_data/parse/expected/method/basic/meta_model.py +7 -0
- dev/test_data/parse/expected/method/contracts/condition_as_keyword_argument/meta_model.py +8 -0
- dev/test_data/parse/expected/method/contracts/condition_as_positional_argument/meta_model.py +8 -0
- dev/test_data/parse/expected/method/contracts/description_as_keyword_argument/meta_model.py +8 -0
- dev/test_data/parse/expected/method/contracts/description_as_positional_argument/meta_model.py +8 -0
- dev/test_data/parse/expected/method/contracts/multiple_contracts_in_order/meta_model.py +17 -0
- dev/test_data/parse/expected/method/contracts/postcondition/basic/meta_model.py +10 -0
- dev/test_data/parse/expected/method/contracts/postcondition/snapshot/with_keyword_arguments/meta_model.py +9 -0
- dev/test_data/parse/expected/method/contracts/postcondition/snapshot/with_positional_arguments/meta_model.py +9 -0
- dev/test_data/parse/expected/method/default/meta_model.py +9 -0
- dev/test_data/parse/expected/method/description/meta_model.py +8 -0
- dev/test_data/parse/expected/method/is_implementation_specific/meta_model.py +8 -0
- dev/test_data/parse/expected/method/non_mutating/meta_model.py +11 -0
- dev/test_data/parse/expected/method/returns_none/meta_model.py +7 -0
- dev/test_data/parse/expected/method/returns_something/meta_model.py +7 -0
- dev/test_data/parse/expected/single_class/description/meta_model.py +12 -0
- dev/test_data/parse/expected/single_class/empty/meta_model.py +6 -0
- dev/test_data/parse/expected/single_class/property/description/meta_model.py +14 -0
- dev/test_data/parse/expected/single_class/property/mandatory/meta_model.py +6 -0
- dev/test_data/parse/expected/single_class/property/optional/meta_model.py +6 -0
- dev/test_data/parse/expected/single_class/property/recursion_to_entity/meta_model.py +6 -0
- dev/test_data/parse/unexpected/class_decorators/non_name_decorator/meta_model.py +7 -0
- dev/test_data/parse/unexpected/class_decorators/unknown_decorator/meta_model.py +7 -0
- dev/test_data/parse/unexpected/class_definitions/is_abstract_and_implementation_specific/meta_model.py +8 -0
- dev/test_data/parse/unexpected/class_definitions/unexpected_docstring_before_a_method/meta_model.py +11 -0
- dev/test_data/parse/unexpected/class_definitions/unexpected_docstring_for_a_pass/meta_model.py +9 -0
- dev/test_data/parse/unexpected/class_definitions/unexpected_double_description_for_a_property/meta_model.py +10 -0
- dev/test_data/parse/unexpected/class_inheritances/inheriting_from_implementation_specific_parent/meta_model.py +20 -0
- dev/test_data/parse/unexpected/class_inheritances/non_name_super_class/meta_model.py +6 -0
- dev/test_data/parse/unexpected/enum/expression_as_assignment_value/meta_model.py +6 -0
- dev/test_data/parse/unexpected/enum/non_assignment/meta_model.py +8 -0
- dev/test_data/parse/unexpected/enum/non_string_literal/meta_model.py +6 -0
- dev/test_data/parse/unexpected/enum/unexpected_inheritance/meta_model.py +6 -0
- dev/test_data/parse/unexpected/method_contracts/contract/non_lambda_condition/meta_model.py +8 -0
- dev/test_data/parse/unexpected/method_contracts/contract/non_string_literal_description/meta_model.py +8 -0
- dev/test_data/parse/unexpected/method_contracts/contract/without_any_arguments/meta_model.py +8 -0
- dev/test_data/parse/unexpected/method_contracts/contract/without_condition/meta_model.py +8 -0
- dev/test_data/parse/unexpected/method_contracts/postcondition/OLD_in_postcondition_without_snapshot/meta_model.py +8 -0
- dev/test_data/parse/unexpected/method_contracts/postcondition/argument_missing_in_function/meta_model.py +8 -0
- dev/test_data/parse/unexpected/method_contracts/precondition/argument_missing_in_function/meta_model.py +8 -0
- dev/test_data/parse/unexpected/method_contracts/snapshot/argument_missing_in_function/meta_model.py +8 -0
- dev/test_data/parse/unexpected/method_contracts/snapshot/capture_not_a_lambda/meta_model.py +8 -0
- dev/test_data/parse/unexpected/method_contracts/snapshot/invalid_name/meta_model.py +8 -0
- dev/test_data/parse/unexpected/method_contracts/snapshot/name_not_a_string_literal/meta_model.py +8 -0
- dev/test_data/parse/unexpected/method_contracts/snapshot/without_a_capture/meta_model.py +8 -0
- dev/test_data/parse/unexpected/method_contracts/snapshot/without_a_name/meta_model.py +8 -0
- dev/test_data/parse/unexpected/method_decorators/non_mutating/non_mutating_constructor/meta_model.py +8 -0
- dev/test_data/parse/unexpected/method_decorators/non_mutating/non_mutating_verification_function/meta_model.py +8 -0
- dev/test_data/parse/unexpected/method_decorators/non_name_decorator/meta_model.py +8 -0
- dev/test_data/parse/unexpected/method_decorators/unknown_call_decorator/meta_model.py +8 -0
- dev/test_data/parse/unexpected/method_decorators/unknown_name_decorator/meta_model.py +8 -0
- dev/test_data/parse/unexpected/method_definitions/argument_with_final/meta_model.py +7 -0
- dev/test_data/parse/unexpected/method_definitions/argument_without_a_type_annotation/meta_model.py +7 -0
- dev/test_data/parse/unexpected/method_definitions/default_for_self/meta_model.py +7 -0
- dev/test_data/parse/unexpected/method_definitions/dunder/meta_model.py +7 -0
- dev/test_data/parse/unexpected/method_definitions/init_with_return_type/meta_model.py +7 -0
- dev/test_data/parse/unexpected/method_definitions/with_keyword_only_arguments/meta_model.py +7 -0
- dev/test_data/parse/unexpected/method_definitions/with_positional_arguments/meta_model.py +7 -0
- dev/test_data/parse/unexpected/method_definitions/with_type_annotation_for_self/meta_model.py +7 -0
- dev/test_data/parse/unexpected/method_definitions/with_variable_arguments/meta_model.py +7 -0
- dev/test_data/parse/unexpected/method_definitions/with_variable_keyword_arguments/meta_model.py +7 -0
- dev/test_data/parse/unexpected/method_definitions/without_arguments/meta_model.py +7 -0
- dev/test_data/parse/unexpected/method_definitions/without_self/meta_model.py +7 -0
- dev/test_data/parse/unexpected/method_definitions/without_type_annotation_for_result/meta_model.py +7 -0
- dev/test_data/parse/unexpected/property_definitions/final_without_subscript/meta_model.py +6 -0
- dev/test_data/parse/unexpected/property_definitions/nested_final/meta_model.py +6 -0
- dev/test_data/parse/unexpected/property_definitions/non_simple/meta_model.py +6 -0
- dev/test_data/parse/unexpected/property_definitions/unexpected_assignment/meta_model.py +6 -0
- dev/test_data/parse/unexpected/property_definitions/unexpected_non_name_property/meta_model.py +6 -0
- dev/test_data/parse/unexpected/property_definitions/without_type_annotation/meta_model.py +6 -0
- dev/test_data/parse/unexpected/symbol_table/constant_set_with_a_non_set_subset/meta_model.py +6 -0
- dev/test_data/parse/unexpected/symbol_table/dangling_inheritance/meta_model.py +6 -0
- dev/test_data/parse/unexpected/symbol_table/dangling_reference_in_type_annotation_of_a_property/meta_model.py +6 -0
- dev/test_data/parse/unexpected/symbol_table/dangling_reference_in_type_annotation_of_an_argument/meta_model.py +7 -0
- dev/test_data/parse/unexpected/symbol_table/dangling_reference_in_type_annotation_of_constant_set/meta_model.py +6 -0
- dev/test_data/parse/unexpected/symbol_table/dangling_subset_in_constant_set/meta_model.py +4 -0
- dev/test_data/parse/unexpected/symbol_table/inheritance_from_non_class/meta_model.py +10 -0
- dev/test_data/parse_retree/expected/character_set/common_escaping/source.py +1 -0
- dev/test_data/parse_retree/expected/character_set/complementing/double_caret/source.py +1 -0
- dev/test_data/parse_retree/expected/character_set/complementing/multiple_ranges/source.py +1 -0
- dev/test_data/parse_retree/expected/character_set/complementing/suffix_dash/source.py +1 -0
- dev/test_data/parse_retree/expected/character_set/escape_first_caret/source.py +1 -0
- dev/test_data/parse_retree/expected/character_set/literals_which_need_no_escaping_in_characters_set_but_need_escaping_outside/source.py +1 -0
- dev/test_data/parse_retree/expected/character_set/multiple_ranges/source.py +1 -0
- dev/test_data/parse_retree/expected/character_set/single_literal/source.py +1 -0
- dev/test_data/parse_retree/expected/character_set/single_range/source.py +1 -0
- dev/test_data/parse_retree/expected/character_set/unescaped_dash/only_dash/source.py +1 -0
- dev/test_data/parse_retree/expected/character_set/unescaped_dash/prefix_dash/source.py +1 -0
- dev/test_data/parse_retree/expected/character_set/unescaped_dash/suffix_dash/source.py +1 -0
- dev/test_data/parse_retree/expected/dot/source.py +1 -0
- dev/test_data/parse_retree/expected/empty/group/source.py +1 -0
- dev/test_data/parse_retree/expected/empty/group_in_a_group/source.py +1 -0
- dev/test_data/parse_retree/expected/empty/group_of_union_of_empty_concatenations/source.py +1 -0
- dev/test_data/parse_retree/expected/empty/regex/source.py +1 -0
- dev/test_data/parse_retree/expected/empty/union_of_empty_concatenations/source.py +1 -0
- dev/test_data/parse_retree/expected/escaped_literals/source.py +1 -0
- dev/test_data/parse_retree/expected/formatted_value/at_the_beginning/source.py +1 -0
- dev/test_data/parse_retree/expected/formatted_value/at_the_end/source.py +1 -0
- dev/test_data/parse_retree/expected/formatted_value/in_the_middle/source.py +1 -0
- dev/test_data/parse_retree/expected/formatted_value/single_formatted_value/source.py +1 -0
- dev/test_data/parse_retree/expected/literal/source.py +1 -0
- dev/test_data/parse_retree/expected/quantifier/greedy/at_least_3/source.py +1 -0
- dev/test_data/parse_retree/expected/quantifier/greedy/at_least_one/source.py +1 -0
- dev/test_data/parse_retree/expected/quantifier/greedy/at_most_3/source.py +1 -0
- dev/test_data/parse_retree/expected/quantifier/greedy/exactly_3/source.py +1 -0
- dev/test_data/parse_retree/expected/quantifier/greedy/maybe/source.py +1 -0
- dev/test_data/parse_retree/expected/quantifier/greedy/zero_or_more/source.py +1 -0
- dev/test_data/parse_retree/expected/quantifier/non_greedy/at_least_3/source.py +1 -0
- dev/test_data/parse_retree/expected/quantifier/non_greedy/at_least_one/source.py +1 -0
- dev/test_data/parse_retree/expected/quantifier/non_greedy/at_most_3/source.py +1 -0
- dev/test_data/parse_retree/expected/quantifier/non_greedy/exactly_3/source.py +1 -0
- dev/test_data/parse_retree/expected/quantifier/non_greedy/maybe/source.py +1 -0
- dev/test_data/parse_retree/expected/quantifier/non_greedy/zero_or_more/source.py +1 -0
- dev/test_data/parse_retree/expected/quantifier/on_a_character_set/source.py +1 -0
- dev/test_data/parse_retree/expected/quantifier/on_a_formatted_value/source.py +1 -0
- dev/test_data/parse_retree/expected/quantifier/on_a_group/source.py +1 -0
- dev/test_data/parse_retree/expected/quantifier/on_a_literal/source.py +1 -0
- dev/test_data/parse_retree/expected/start_and_stop_symbols/double_end_symbol/source.py +1 -0
- dev/test_data/parse_retree/expected/start_and_stop_symbols/double_start_symbol/source.py +1 -0
- dev/test_data/parse_retree/expected/start_and_stop_symbols/end_symbol_in_the_middle/source.py +1 -0
- dev/test_data/parse_retree/expected/start_and_stop_symbols/only_start_symbol/source.py +1 -0
- dev/test_data/parse_retree/expected/start_and_stop_symbols/only_stop_symbol/source.py +1 -0
- dev/test_data/parse_retree/expected/start_and_stop_symbols/start_symbol_at_the_beginning/source.py +1 -0
- dev/test_data/parse_retree/expected/start_and_stop_symbols/start_symbol_in_the_middle/source.py +1 -0
- dev/test_data/parse_retree/expected/start_and_stop_symbols/stop_symbol_at_the_end/source.py +1 -0
- dev/test_data/parse_retree/expected/union/of_character_sets/source.py +1 -0
- dev/test_data/parse_retree/expected/union/of_groups/source.py +1 -0
- dev/test_data/parse_retree/expected/union/of_string_literals/source.py +1 -0
- dev/test_data/parse_retree/expected/union/within_group/source.py +1 -0
- dev/test_data/parse_retree/expected/whitespace/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/character_literal/Uxxxxxxxx_out_of_range/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/character_literal/only_backslash/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/character_literal/short_Uxxxxxxxx/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/character_literal/short_uxxxx/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/character_literal/short_x/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/character_literal/unexpected_escaping/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/character_literal/unhandled/digit/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/character_literal/unhandled/not_digit/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/character_literal/unhandled/not_whitespace/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/character_literal/unhandled/not_word/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/character_literal/unhandled/whitespace/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/character_literal/unhandled/word/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/range_character/Uxxxxxxxx_out_of_range/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/range_character/only_backslash/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/range_character/short_Uxxxxxxxx/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/range_character/short_uxxxx/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/range_character/short_x/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/range_character/unexpected_escaping/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/range_character/unhandled/digit/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/range_character/unhandled/not_digit/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/range_character/unhandled/not_whitespace/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/range_character/unhandled/not_word/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/range_character/unhandled/whitespace/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/range_character/unhandled/word/source.py +1 -0
- dev/test_data/parse_retree/unexpected/invalid_character_range/source.py +1 -0
- dev/test_data/parse_retree/unexpected/invalid_quantifier/at_least_x/source.py +1 -0
- dev/test_data/parse_retree/unexpected/invalid_quantifier/between_3_and_x/source.py +1 -0
- dev/test_data/parse_retree/unexpected/invalid_quantifier/exactly_x/source.py +1 -0
- dev/test_data/parse_retree/unexpected/unhandled_group_directives/source.py +1 -0
- dev/test_data/parse_retree/unexpected/unterminated/character_set/source.py +1 -0
- dev/test_data/parse_retree/unexpected/unterminated/group/source.py +1 -0
- dev/test_data/parse_retree/unexpected/unterminated/group_of_union_of_empty_concatenations/source.py +1 -0
- dev/test_data/parse_retree/unexpected/unterminated/quantifier/source.py +1 -0
- dev/test_data/parse_retree/unexpected/unterminated/quantifier_with_comma/source.py +1 -0
- dev/test_data/parse_retree/unexpected/unterminated/quantifier_with_number_and_comma/source.py +1 -0
- dev/test_data/proto/test_main/expected/abstract_and_concrete_classes/meta_model.py +37 -0
- dev/test_data/proto/test_main/expected/concrete_class_with_descendants/meta_model.py +30 -0
- dev/test_data/proto/test_main/expected/concrete_class_with_enum/meta_model.py +21 -0
- dev/test_data/proto/test_main/expected/concrete_class_with_list_of_instances/meta_model.py +21 -0
- dev/test_data/proto/test_main/expected/concrete_class_with_primitive_attributes/meta_model.py +41 -0
- dev/test_data/python_protobuf/test_main/abstract_and_concrete_classes/expected_output/pbization.py +532 -0
- dev/test_data/python_protobuf/test_main/abstract_and_concrete_classes/meta_model.py +37 -0
- dev/test_data/python_protobuf/test_main/concrete_class_with_descendant/expected_output/pbization.py +527 -0
- dev/test_data/python_protobuf/test_main/concrete_class_with_descendant/meta_model.py +27 -0
- dev/test_data/python_protobuf/test_main/concrete_class_with_enum/expected_output/pbization.py +290 -0
- dev/test_data/python_protobuf/test_main/concrete_class_with_enum/meta_model.py +21 -0
- dev/test_data/python_protobuf/test_main/concrete_class_with_list_of_instances/expected_output/pbization.py +328 -0
- dev/test_data/python_protobuf/test_main/concrete_class_with_list_of_instances/meta_model.py +23 -0
- dev/test_data/python_protobuf/test_main/concrete_class_with_primitive_attributes/expected_output/pbization.py +274 -0
- dev/test_data/python_protobuf/test_main/concrete_class_with_primitive_attributes/meta_model.py +41 -0
- dev/test_data/rdf_shacl/test_main/expected/regression_when_lang_string_class_is_missing/meta_model.py +29 -0
- dev/test_data/rdf_shacl/test_main/expected/regression_when_len_constraints_on_inherited_property/meta_model.py +27 -0
- dev/test_data/rdf_shacl/test_main/unexpected/regression_len_constraint_on_class_property/meta_model.py +61 -0
- dev/test_data/real_meta_models/aas_core_meta.v3.py +5721 -0
- dev/test_data/smoke/test_main/unexpected/infer_for_schema_error/meta_model.py +12 -0
- dev/test_data/smoke/test_main/unexpected/intermediate_error/meta_model.py +18 -0
- dev/test_data/smoke/test_main/unexpected/parse_error/meta_model.py +5 -0
- dev/test_data/smoke/test_main/unexpected/pattern_verification_unparsable_regex/direct_match/meta_model.py +8 -0
- dev/test_data/smoke/test_main/unexpected/type_error/meta_model.py +18 -0
- dev/tests/__init__.py +1 -0
- dev/tests/common.py +197 -0
- dev/tests/cpp/__init__.py +0 -0
- dev/tests/cpp/test_common.py +32 -0
- dev/tests/cpp/test_main.py +144 -0
- dev/tests/cpp/test_pattern.py +188 -0
- dev/tests/cpp/test_verification.py +189 -0
- dev/tests/cpp/test_yielding.py +225 -0
- dev/tests/csharp/__init__.py +0 -0
- dev/tests/csharp/live_test_main.py +109 -0
- dev/tests/csharp/test_common.py +28 -0
- dev/tests/csharp/test_description.py +684 -0
- dev/tests/csharp/test_main.py +129 -0
- dev/tests/csharp/test_structure.py +93 -0
- dev/tests/csharp/test_verification.py +82 -0
- dev/tests/description.py +29 -0
- dev/tests/golang/__init__.py +0 -0
- dev/tests/golang/test_common.py +78 -0
- dev/tests/golang/test_main.py +128 -0
- dev/tests/infer_for_schema/__init__.py +0 -0
- dev/tests/infer_for_schema/common.py +47 -0
- dev/tests/infer_for_schema/test_len_on_properties.py +955 -0
- dev/tests/infer_for_schema/test_len_on_self.py +580 -0
- dev/tests/infer_for_schema/test_patterns_on_properties.py +686 -0
- dev/tests/infer_for_schema/test_patterns_on_self.py +258 -0
- dev/tests/infer_for_schema/test_property_in_set_of_enumeration_literals.py +600 -0
- dev/tests/infer_for_schema/test_property_in_set_of_primitives.py +549 -0
- dev/tests/intermediate/__init__.py +0 -0
- dev/tests/intermediate/test_constructor.py +719 -0
- dev/tests/intermediate/test_hierarchy.py +221 -0
- dev/tests/intermediate/test_revm.py +134 -0
- dev/tests/intermediate/test_translate.py +337 -0
- dev/tests/intermediate/test_type_inference.py +333 -0
- dev/tests/intermediate/test_types.py +169 -0
- dev/tests/java/__init__.py +0 -0
- dev/tests/java/test_common.py +20 -0
- dev/tests/java/test_description.py +128 -0
- dev/tests/java/test_main.py +234 -0
- dev/tests/jsonld_context/test_main.py +79 -0
- dev/tests/opcua/__init__.py +3 -0
- dev/tests/opcua/test_main.py +110 -0
- dev/tests/our_jsonschema/__init__.py +3 -0
- dev/tests/our_jsonschema/test_main.py +232 -0
- dev/tests/parse/__init__.py +0 -0
- dev/tests/parse/test_parse.py +503 -0
- dev/tests/parse/test_retree.py +272 -0
- dev/tests/proto/__init__.py +0 -0
- dev/tests/proto/test_main.py +112 -0
- dev/tests/python/__init__.py +0 -0
- dev/tests/python/test_common.py +124 -0
- dev/tests/python/test_main.py +126 -0
- dev/tests/python/test_xml_playground.py +254 -0
- dev/tests/python_protobuf/__init__.py +0 -0
- dev/tests/python_protobuf/test_main.py +111 -0
- dev/tests/rdf_shacl/__init__.py +0 -0
- dev/tests/rdf_shacl/test_common.py +32 -0
- dev/tests/rdf_shacl/test_description.py +223 -0
- dev/tests/rdf_shacl/test_main.py +194 -0
- dev/tests/smoke/__init__.py +0 -0
- dev/tests/smoke/test_main.py +83 -0
- dev/tests/test_common.py +94 -0
- dev/tests/typescript/__init__.py +0 -0
- dev/tests/typescript/test_common.py +108 -0
- dev/tests/typescript/test_main.py +125 -0
- dev/tests/xsd/__init__.py +0 -0
- dev/tests/xsd/test_main.py +227 -0
- dev/tests/yielding/__init__.py +0 -0
- dev/tests/yielding/test_linear.py +558 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"""Download the latest meta-model for V3.0 to the test data."""
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
import os
|
|
5
|
+
import pathlib
|
|
6
|
+
import sys
|
|
7
|
+
from typing import Final, Mapping, Union
|
|
8
|
+
|
|
9
|
+
import black
|
|
10
|
+
import requests
|
|
11
|
+
|
|
12
|
+
OWNER: Final[str] = "aas-core-works"
|
|
13
|
+
REPO: Final[str] = "aas-core-meta"
|
|
14
|
+
REF: Final[str] = "main"
|
|
15
|
+
REMOTE_PATH: Final[str] = "aas_core_meta/v3.py"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _latest_commit_sha(timeout: float = 15.0) -> str:
|
|
19
|
+
"""Resolve the latest commit SHA on the ``REF`` for a specific path."""
|
|
20
|
+
params: Mapping[str, Union[str, int]] = {
|
|
21
|
+
"path": REMOTE_PATH,
|
|
22
|
+
"sha": REF,
|
|
23
|
+
"per_page": 1,
|
|
24
|
+
}
|
|
25
|
+
resp = requests.get(
|
|
26
|
+
f"https://api.github.com/repos/{OWNER}/{REPO}/commits",
|
|
27
|
+
params=params,
|
|
28
|
+
timeout=timeout,
|
|
29
|
+
)
|
|
30
|
+
try:
|
|
31
|
+
resp.raise_for_status()
|
|
32
|
+
except requests.HTTPError as ex:
|
|
33
|
+
raise RuntimeError(
|
|
34
|
+
f"Failed to resolve latest commit for "
|
|
35
|
+
f"{OWNER}/{REPO}:{REF} path={REMOTE_PATH} "
|
|
36
|
+
f"({resp.status_code}): {resp.text}"
|
|
37
|
+
) from ex
|
|
38
|
+
|
|
39
|
+
commits = resp.json()
|
|
40
|
+
if not commits or not isinstance(commits, list):
|
|
41
|
+
raise RuntimeError(
|
|
42
|
+
"Could not determine latest commit SHA (empty API response)."
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
sha = commits[0].get("sha")
|
|
46
|
+
if not isinstance(sha, str):
|
|
47
|
+
raise RuntimeError("API did not return a valid commit SHA.")
|
|
48
|
+
|
|
49
|
+
if len(sha) == 0:
|
|
50
|
+
raise RuntimeError("API returned an empty commit SHA.")
|
|
51
|
+
|
|
52
|
+
return sha
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def _raw_url(sha: str) -> str:
|
|
56
|
+
"""Get the URL of the raw file on GitHub."""
|
|
57
|
+
return f"https://raw.githubusercontent.com/{OWNER}/{REPO}/{sha}/{REMOTE_PATH}"
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def _download(url: str, timeout: float = 30.0) -> str:
|
|
61
|
+
"""Download the raw file contents."""
|
|
62
|
+
resp = requests.get(url, timeout=timeout)
|
|
63
|
+
try:
|
|
64
|
+
resp.raise_for_status()
|
|
65
|
+
except requests.HTTPError as ex:
|
|
66
|
+
raise RuntimeError(
|
|
67
|
+
f"Failed to download file from {url} ({resp.status_code}): {resp.text}"
|
|
68
|
+
) from ex
|
|
69
|
+
|
|
70
|
+
return resp.text
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def retrieve_sha_and_download() -> str:
|
|
74
|
+
"""
|
|
75
|
+
Get the latest SHA revision of the meta-model and download it to test data.
|
|
76
|
+
|
|
77
|
+
Return the SHA of the downloaded meta-model.
|
|
78
|
+
"""
|
|
79
|
+
sha = _latest_commit_sha()
|
|
80
|
+
|
|
81
|
+
raw_url = _raw_url(sha)
|
|
82
|
+
|
|
83
|
+
content = _download(url=raw_url)
|
|
84
|
+
|
|
85
|
+
banner = f"# Downloaded from: {raw_url}\n# Do NOT edit or append!"
|
|
86
|
+
|
|
87
|
+
repo_root = pathlib.Path(os.path.realpath(__file__)).parent.parent.parent
|
|
88
|
+
|
|
89
|
+
out_path = repo_root / "dev/test_data/real_meta_models/aas_core_meta.v3.py"
|
|
90
|
+
out_path.parent.mkdir(exist_ok=True)
|
|
91
|
+
|
|
92
|
+
out_path.write_text(f"{banner}\n\n{content.rstrip()}\n\n{banner}", encoding="utf-8")
|
|
93
|
+
|
|
94
|
+
black.format_file_in_place(
|
|
95
|
+
src=out_path, fast=False, mode=black.FileMode(), write_back=black.WriteBack.YES
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
print(f"Wrote and reformatted to: {out_path} (from commit {sha[:8]}).")
|
|
99
|
+
|
|
100
|
+
return sha
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def main() -> int:
|
|
104
|
+
"""Execute the main routine."""
|
|
105
|
+
parser = argparse.ArgumentParser(description=__doc__)
|
|
106
|
+
_ = parser.parse_args()
|
|
107
|
+
|
|
108
|
+
retrieve_sha_and_download()
|
|
109
|
+
|
|
110
|
+
return 0
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
if __name__ == "__main__":
|
|
114
|
+
sys.exit(main())
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Draw a bipartite graph on matching lines in two files.
|
|
3
|
+
|
|
4
|
+
This is helpful when you want to minimize the diffs. Unfortunately, ``diff`` is not
|
|
5
|
+
really a good tool when it comes to re-shuffling of the blocks.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import argparse
|
|
9
|
+
import pathlib
|
|
10
|
+
import sys
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def main() -> int:
|
|
14
|
+
"""Execute the main routine."""
|
|
15
|
+
parser = argparse.ArgumentParser(description=__doc__)
|
|
16
|
+
parser.add_argument("--ours", help="path to the first file", required=True)
|
|
17
|
+
parser.add_argument("--theirs", help="path to the second file", required=True)
|
|
18
|
+
args = parser.parse_args()
|
|
19
|
+
|
|
20
|
+
ours_pth = pathlib.Path(args.ours)
|
|
21
|
+
theirs_pth = pathlib.Path(args.theirs)
|
|
22
|
+
|
|
23
|
+
our_lines = ours_pth.read_text(encoding="utf-8").splitlines()
|
|
24
|
+
their_lines = theirs_pth.read_text(encoding="utf-8").splitlines()
|
|
25
|
+
|
|
26
|
+
their_lines_by_index = {line: i for i, line in enumerate(their_lines)}
|
|
27
|
+
|
|
28
|
+
for i, line in enumerate(our_lines):
|
|
29
|
+
their_i = their_lines_by_index.get(line, None)
|
|
30
|
+
if their_i is not None:
|
|
31
|
+
print(f"Ours {i+1:4d} to theirs {their_i:4d}")
|
|
32
|
+
|
|
33
|
+
return 0
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
if __name__ == "__main__":
|
|
37
|
+
sys.exit(main())
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"""Run all the tests with the environment variable ``AAS_CORE_CODEGEN_RERECORD`` set."""
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
import os
|
|
5
|
+
import pathlib
|
|
6
|
+
import subprocess
|
|
7
|
+
import sys
|
|
8
|
+
import shlex
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def main() -> int:
|
|
12
|
+
"""Execute the main routine."""
|
|
13
|
+
available_tests = [
|
|
14
|
+
"tests.csharp.test_main.Test_against_recorded",
|
|
15
|
+
"tests.csharp.test_verification.Test_against_recorded",
|
|
16
|
+
"tests.csharp.test_structure.Test_generation_against_recorded",
|
|
17
|
+
"tests.intermediate.test_translate.Test_against_recorded",
|
|
18
|
+
"tests.java.test_main.Test_against_recorded",
|
|
19
|
+
"tests.our_jsonschema.test_main.Test_against_recorded",
|
|
20
|
+
"tests.rdf_shacl.test_main.Test_against_recorded",
|
|
21
|
+
"tests.parse.test_parse.Test_against_recorded",
|
|
22
|
+
"tests.parse.test_retree.Test_against_recorded",
|
|
23
|
+
"tests.python.test_main.Test_against_recorded",
|
|
24
|
+
"tests.smoke.test_main.Test_against_recorded",
|
|
25
|
+
"tests.typescript.test_main.Test_against_recorded",
|
|
26
|
+
"tests.xsd.test_main.Test_against_recorded",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
parser = argparse.ArgumentParser(description=__doc__)
|
|
30
|
+
parser.add_argument(
|
|
31
|
+
"--select",
|
|
32
|
+
help=(
|
|
33
|
+
"If set, only the selected tests are executed. "
|
|
34
|
+
"This is practical if some of the tests failed and you want to "
|
|
35
|
+
"fix them in isolation. "
|
|
36
|
+
"The tests are given as a space-separated list of: "
|
|
37
|
+
+ " ".join(available_tests)
|
|
38
|
+
),
|
|
39
|
+
metavar="",
|
|
40
|
+
nargs="+",
|
|
41
|
+
choices=available_tests,
|
|
42
|
+
)
|
|
43
|
+
args = parser.parse_args()
|
|
44
|
+
|
|
45
|
+
repo_root = pathlib.Path(os.path.realpath(__file__)).parent.parent.parent
|
|
46
|
+
|
|
47
|
+
env = os.environ.copy()
|
|
48
|
+
env["AAS_CORE_CODEGEN_RERECORD"] = "1"
|
|
49
|
+
|
|
50
|
+
if args.select is not None:
|
|
51
|
+
tests_to_run = list(args.select)
|
|
52
|
+
else:
|
|
53
|
+
tests_to_run = available_tests
|
|
54
|
+
|
|
55
|
+
for qualified_test_name in tests_to_run:
|
|
56
|
+
cmd = [sys.executable, "-m", "unittest", "-v", qualified_test_name]
|
|
57
|
+
|
|
58
|
+
print(f"Executing {qualified_test_name}...")
|
|
59
|
+
exit_code = subprocess.call(cmd, cwd=str(repo_root), env=env)
|
|
60
|
+
if exit_code != 0:
|
|
61
|
+
cmd_str = " ".join(shlex.quote(part) for part in cmd)
|
|
62
|
+
print(f"Failed to execute the test: {cmd_str}")
|
|
63
|
+
return 1
|
|
64
|
+
|
|
65
|
+
return 0
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
if __name__ == "__main__":
|
|
69
|
+
sys.exit(main())
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Update everything in this project to the latest aas-core-meta.
|
|
3
|
+
|
|
4
|
+
Git is expected to be installed.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import argparse
|
|
8
|
+
import os
|
|
9
|
+
import pathlib
|
|
10
|
+
import subprocess
|
|
11
|
+
import sys
|
|
12
|
+
import tempfile
|
|
13
|
+
import time
|
|
14
|
+
from typing import Optional
|
|
15
|
+
|
|
16
|
+
import dev_scripts.download_latest_aas_core_meta_v3
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def _make_sure_no_changed_files(
|
|
20
|
+
repo_dir: pathlib.Path, expected_our_branch: str
|
|
21
|
+
) -> Optional[int]:
|
|
22
|
+
"""
|
|
23
|
+
Make sure that no files are modified in our repository.
|
|
24
|
+
|
|
25
|
+
Return exit code if something is unexpected.
|
|
26
|
+
"""
|
|
27
|
+
diff_name_status = subprocess.check_output(
|
|
28
|
+
["git", "diff", "--name-status", expected_our_branch],
|
|
29
|
+
cwd=str(repo_dir),
|
|
30
|
+
encoding="utf-8",
|
|
31
|
+
).strip()
|
|
32
|
+
|
|
33
|
+
if len(diff_name_status.splitlines()) > 0:
|
|
34
|
+
print(
|
|
35
|
+
f"The following files are modified "
|
|
36
|
+
f"compared to branch {expected_our_branch!r} in {repo_dir}:\n"
|
|
37
|
+
f"{diff_name_status}\n"
|
|
38
|
+
f"\n"
|
|
39
|
+
f"Please stash the changes first before you update to aas-core-meta.",
|
|
40
|
+
file=sys.stderr,
|
|
41
|
+
)
|
|
42
|
+
return 1
|
|
43
|
+
|
|
44
|
+
return None
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def _rerecord_everything(repo_dir: pathlib.Path) -> Optional[int]:
|
|
48
|
+
"""
|
|
49
|
+
Run all unit tests with re-record environment variable set.
|
|
50
|
+
|
|
51
|
+
Return an error code, if any.
|
|
52
|
+
"""
|
|
53
|
+
env = os.environ.copy()
|
|
54
|
+
env["AAS_CORE_CODEGEN_RERECORD"] = "1"
|
|
55
|
+
|
|
56
|
+
starting_points = [
|
|
57
|
+
pth
|
|
58
|
+
for pth in (repo_dir / "tests").glob("*")
|
|
59
|
+
if (
|
|
60
|
+
pth.is_dir()
|
|
61
|
+
and not pth.name.startswith("__")
|
|
62
|
+
and not pth.name.startswith(".")
|
|
63
|
+
)
|
|
64
|
+
]
|
|
65
|
+
|
|
66
|
+
start = time.perf_counter()
|
|
67
|
+
|
|
68
|
+
for starting_point in starting_points:
|
|
69
|
+
print(f"Starting to run tests in: {starting_point} ...")
|
|
70
|
+
|
|
71
|
+
subprocess.check_call(
|
|
72
|
+
[
|
|
73
|
+
sys.executable,
|
|
74
|
+
"-m",
|
|
75
|
+
"unittest",
|
|
76
|
+
"discover",
|
|
77
|
+
"--start-directory",
|
|
78
|
+
str(starting_point),
|
|
79
|
+
],
|
|
80
|
+
env=env,
|
|
81
|
+
cwd=str(repo_dir),
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
duration = time.perf_counter() - start
|
|
85
|
+
print(f"Re-recording took: {duration:.2f} seconds.")
|
|
86
|
+
return None
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def _create_branch_commit_and_push(
|
|
90
|
+
repo_dir: pathlib.Path, aas_core_meta_revision: str
|
|
91
|
+
) -> None:
|
|
92
|
+
"""Create a feature branch, commit the changes and push it."""
|
|
93
|
+
branch = f"Update-test-data-to-aas-core-meta-{aas_core_meta_revision}"
|
|
94
|
+
print(f"Creating the branch {branch!r}...")
|
|
95
|
+
subprocess.check_call(["git", "checkout", "-b", branch], cwd=repo_dir)
|
|
96
|
+
|
|
97
|
+
print("Adding files...")
|
|
98
|
+
subprocess.check_call(["git", "add", "."], cwd=repo_dir)
|
|
99
|
+
|
|
100
|
+
# pylint: disable=line-too-long
|
|
101
|
+
message = f"""\
|
|
102
|
+
Update test data to aas-core-meta {aas_core_meta_revision}
|
|
103
|
+
|
|
104
|
+
We update the development requirements to and re-record the test data
|
|
105
|
+
for [aas-core-meta {aas_core_meta_revision}].
|
|
106
|
+
|
|
107
|
+
[aas-core-meta {aas_core_meta_revision}]: https://github.com/aas-core-works/aas-core-meta/commit/{aas_core_meta_revision}"""
|
|
108
|
+
# pylint: enable=line-too-long
|
|
109
|
+
|
|
110
|
+
print("Committing...")
|
|
111
|
+
with tempfile.TemporaryDirectory() as tmp_dir:
|
|
112
|
+
tmp_file = pathlib.Path(tmp_dir) / "commit-message.txt"
|
|
113
|
+
tmp_file.write_text(message, encoding="utf-8")
|
|
114
|
+
|
|
115
|
+
subprocess.check_call(["git", "commit", "--file", str(tmp_file)], cwd=repo_dir)
|
|
116
|
+
|
|
117
|
+
print(f"Pushing to remote {branch}...")
|
|
118
|
+
subprocess.check_call(["git", "push", "-u"], cwd=repo_dir)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def main() -> int:
|
|
122
|
+
"""Execute the main routine."""
|
|
123
|
+
repo_dir = pathlib.Path(os.path.realpath(__file__)).parent.parent.parent
|
|
124
|
+
|
|
125
|
+
parser = argparse.ArgumentParser(description=__doc__)
|
|
126
|
+
parser.add_argument(
|
|
127
|
+
"--expected_our_branch",
|
|
128
|
+
help="Git branch expected in this repository",
|
|
129
|
+
default="main",
|
|
130
|
+
)
|
|
131
|
+
args = parser.parse_args()
|
|
132
|
+
|
|
133
|
+
expected_our_branch = str(args.expected_our_branch)
|
|
134
|
+
|
|
135
|
+
our_branch = subprocess.check_output(
|
|
136
|
+
["git", "rev-parse", "--abbrev-ref", "HEAD"],
|
|
137
|
+
cwd=str(repo_dir),
|
|
138
|
+
encoding="utf-8",
|
|
139
|
+
).strip()
|
|
140
|
+
if our_branch != expected_our_branch:
|
|
141
|
+
print(
|
|
142
|
+
f"--expected_our_branch is {expected_our_branch}, "
|
|
143
|
+
f"but got {our_branch} in: {repo_dir}",
|
|
144
|
+
file=sys.stderr,
|
|
145
|
+
)
|
|
146
|
+
return 1
|
|
147
|
+
|
|
148
|
+
exit_code = _make_sure_no_changed_files(
|
|
149
|
+
repo_dir=repo_dir, expected_our_branch=expected_our_branch
|
|
150
|
+
)
|
|
151
|
+
if exit_code is not None:
|
|
152
|
+
return exit_code
|
|
153
|
+
|
|
154
|
+
# fmt: off
|
|
155
|
+
aas_core_meta_revision = (
|
|
156
|
+
dev_scripts.download_latest_aas_core_meta_v3.retrieve_sha_and_download()
|
|
157
|
+
)[:8]
|
|
158
|
+
# fmt: on
|
|
159
|
+
|
|
160
|
+
print(f"The aas-core-meta revision is: {aas_core_meta_revision}")
|
|
161
|
+
|
|
162
|
+
exit_code = _rerecord_everything(repo_dir=repo_dir)
|
|
163
|
+
if exit_code is not None:
|
|
164
|
+
return exit_code
|
|
165
|
+
|
|
166
|
+
_create_branch_commit_and_push(
|
|
167
|
+
repo_dir=repo_dir, aas_core_meta_revision=aas_core_meta_revision
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
return 0
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
if __name__ == "__main__":
|
|
174
|
+
sys.exit(main())
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"""Check the JSON schema against the given JSON file."""
|
|
2
|
+
import argparse
|
|
3
|
+
import json
|
|
4
|
+
import pathlib
|
|
5
|
+
import sys
|
|
6
|
+
import warnings
|
|
7
|
+
|
|
8
|
+
with warnings.catch_warnings():
|
|
9
|
+
warnings.filterwarnings("ignore", category=DeprecationWarning)
|
|
10
|
+
# NOTE (mristin):
|
|
11
|
+
# We need to disable warnings. Jsonschema package at the latest version (4.4.0) has
|
|
12
|
+
# a problem with JSON schema draft 2019-09 and crashes with a recursion error,
|
|
13
|
+
# see: https://github.com/python-jsonschema/jsonschema/issues/847.
|
|
14
|
+
#
|
|
15
|
+
# We revert to jsonschema 3.2.0, which can not handle 2019-09, but still seems
|
|
16
|
+
# to validate correctly our examples.
|
|
17
|
+
import jsonschema
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def main() -> None:
|
|
21
|
+
parser = argparse.ArgumentParser(description=__doc__)
|
|
22
|
+
parser.add_argument(
|
|
23
|
+
"--model_path",
|
|
24
|
+
help="Path to a model to be validated against the generated JSON schema",
|
|
25
|
+
required=True,
|
|
26
|
+
)
|
|
27
|
+
parser.add_argument("--schema_path", help="Path to the JSON schema", required=True)
|
|
28
|
+
args = parser.parse_args()
|
|
29
|
+
model_path = pathlib.Path(args.model_path)
|
|
30
|
+
schema_path = pathlib.Path(args.schema_path)
|
|
31
|
+
|
|
32
|
+
if not model_path.exists():
|
|
33
|
+
print(f"--model_path does not exist: {model_path}", file=sys.stderr)
|
|
34
|
+
sys.exit(1)
|
|
35
|
+
|
|
36
|
+
if not schema_path.exists():
|
|
37
|
+
print(f"--schema_path does not exist: {schema_path}", file=sys.stderr)
|
|
38
|
+
sys.exit(1)
|
|
39
|
+
|
|
40
|
+
with schema_path.open("rt") as fid:
|
|
41
|
+
schema = json.load(fid)
|
|
42
|
+
|
|
43
|
+
with model_path.open("rt") as fid:
|
|
44
|
+
instance = json.load(fid)
|
|
45
|
+
|
|
46
|
+
try:
|
|
47
|
+
jsonschema.validate(instance=instance, schema=schema)
|
|
48
|
+
except jsonschema.ValidationError as err:
|
|
49
|
+
raise AssertionError(
|
|
50
|
+
f"Failed to validate {model_path} against {schema_path}"
|
|
51
|
+
) from err
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
if __name__ == "__main__":
|
|
55
|
+
main()
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
from typing import List
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class My_Class:
|
|
5
|
+
string_prop: str
|
|
6
|
+
int_prop: int
|
|
7
|
+
bool_prop: bool
|
|
8
|
+
|
|
9
|
+
def __init__(self, string_prop: str, int_prop: int, bool_prop: bool) -> None:
|
|
10
|
+
self.string_prop = string_prop
|
|
11
|
+
self.int_prop = int_prop
|
|
12
|
+
self.bool_prop = bool_prop
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class Root:
|
|
16
|
+
foo: My_Class
|
|
17
|
+
foos: List[My_Class]
|
|
18
|
+
strings: List[str]
|
|
19
|
+
integers: List[int]
|
|
20
|
+
booleans: List[bool]
|
|
21
|
+
|
|
22
|
+
def __init__(
|
|
23
|
+
self,
|
|
24
|
+
foo: My_Class,
|
|
25
|
+
foos: List[My_Class],
|
|
26
|
+
strings: List[str],
|
|
27
|
+
integers: List[int],
|
|
28
|
+
booleans: List[bool],
|
|
29
|
+
) -> None:
|
|
30
|
+
self.foo = foo
|
|
31
|
+
self.foos = foos
|
|
32
|
+
self.strings = strings
|
|
33
|
+
self.integers = integers
|
|
34
|
+
self.booleans = booleans
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
__version__ = "dummy"
|
|
38
|
+
__xml_namespace__ = "https://dummy.com"
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"""De-serialize the model, validate it and serialize it back."""
|
|
2
|
+
import argparse
|
|
3
|
+
import difflib
|
|
4
|
+
import json
|
|
5
|
+
import pathlib
|
|
6
|
+
import sys
|
|
7
|
+
from xml.dom import minidom
|
|
8
|
+
|
|
9
|
+
if sys.version_info >= (3, 9):
|
|
10
|
+
from typing import Literal, Optional, Any
|
|
11
|
+
else:
|
|
12
|
+
from typing_extensions import Literal
|
|
13
|
+
|
|
14
|
+
if sys.version_info >= (3, 11):
|
|
15
|
+
from typing import assert_never
|
|
16
|
+
else:
|
|
17
|
+
from typing_extensions import assert_never
|
|
18
|
+
|
|
19
|
+
# The module aas_core is expected to be generated by the integration test.
|
|
20
|
+
from sdk import types, jsonization, xmlization, verification
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def normalize_xml(xml_text: str) -> str:
|
|
24
|
+
"""Normalize XML for comparison."""
|
|
25
|
+
normalized = minidom.parseString(xml_text).toprettyxml(indent=" ")
|
|
26
|
+
# Remove blank lines
|
|
27
|
+
return "\n".join([line for line in normalized.splitlines() if line.strip()])
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def main() -> None:
|
|
31
|
+
parser = argparse.ArgumentParser()
|
|
32
|
+
parser.add_argument(
|
|
33
|
+
"--model_path", help="Path to the model in JSON or XML", required=True
|
|
34
|
+
)
|
|
35
|
+
args = parser.parse_args()
|
|
36
|
+
|
|
37
|
+
model_path = pathlib.Path(args.model_path)
|
|
38
|
+
|
|
39
|
+
if not model_path.exists():
|
|
40
|
+
print(f"--model_path does not exist: {model_path}", file=sys.stderr)
|
|
41
|
+
sys.exit(1)
|
|
42
|
+
|
|
43
|
+
text = model_path.read_text(encoding="utf-8")
|
|
44
|
+
stripped_text = text.strip()
|
|
45
|
+
|
|
46
|
+
if len(stripped_text) == 0:
|
|
47
|
+
print(f"Model {model_path} is empty.", file=sys.stderr)
|
|
48
|
+
sys.exit(1)
|
|
49
|
+
|
|
50
|
+
# NOTE (mristin):
|
|
51
|
+
# We assume by convention that the main object in the integration test is defined as
|
|
52
|
+
# the class ``Root``.
|
|
53
|
+
root: types.Root
|
|
54
|
+
|
|
55
|
+
first_character = stripped_text[0]
|
|
56
|
+
|
|
57
|
+
jsonable = None # type: Optional[Any]
|
|
58
|
+
|
|
59
|
+
source_format: Literal["json", "xml"]
|
|
60
|
+
|
|
61
|
+
if first_character == "{":
|
|
62
|
+
try:
|
|
63
|
+
jsonable = json.loads(text)
|
|
64
|
+
except json.JSONDecodeError as exception:
|
|
65
|
+
print(
|
|
66
|
+
f"Failed to parse JSON from {model_path}: {exception}", file=sys.stderr
|
|
67
|
+
)
|
|
68
|
+
sys.exit(1)
|
|
69
|
+
|
|
70
|
+
try:
|
|
71
|
+
root = jsonization.root_from_jsonable(jsonable)
|
|
72
|
+
except jsonization.DeserializationException as exception:
|
|
73
|
+
print(f"Failed to parse {model_path}: {exception}", file=sys.stderr)
|
|
74
|
+
sys.exit(1)
|
|
75
|
+
|
|
76
|
+
source_format = "json"
|
|
77
|
+
|
|
78
|
+
elif first_character == "<":
|
|
79
|
+
try:
|
|
80
|
+
root = xmlization.root_from_str(text)
|
|
81
|
+
except xmlization.DeserializationException as exception:
|
|
82
|
+
print(f"Failed to parse {model_path}: {exception}", file=sys.stderr)
|
|
83
|
+
sys.exit(1)
|
|
84
|
+
|
|
85
|
+
source_format = "xml"
|
|
86
|
+
|
|
87
|
+
else:
|
|
88
|
+
print(
|
|
89
|
+
f"Unrecognized first non-whitespace character in {model_path}, "
|
|
90
|
+
f"so we do not know how to parse the file: {first_character!r}",
|
|
91
|
+
file=sys.stderr,
|
|
92
|
+
)
|
|
93
|
+
sys.exit(1)
|
|
94
|
+
|
|
95
|
+
for error in verification.verify(root):
|
|
96
|
+
print(
|
|
97
|
+
f"The model from {model_path} failed to pass verification "
|
|
98
|
+
f"at {error.path}: {error.cause}",
|
|
99
|
+
file=sys.stderr,
|
|
100
|
+
)
|
|
101
|
+
sys.exit(1)
|
|
102
|
+
|
|
103
|
+
if source_format == "json":
|
|
104
|
+
another_jsonable = jsonization.to_jsonable(root)
|
|
105
|
+
|
|
106
|
+
assert jsonable is not None
|
|
107
|
+
|
|
108
|
+
original_pretty = json.dumps(jsonable, indent=2, ensure_ascii=False)
|
|
109
|
+
another_pretty = json.dumps(another_jsonable, indent=2, ensure_ascii=False)
|
|
110
|
+
|
|
111
|
+
if original_pretty != another_pretty:
|
|
112
|
+
diff = "\n".join(
|
|
113
|
+
difflib.unified_diff(
|
|
114
|
+
original_pretty.splitlines(),
|
|
115
|
+
another_pretty.splitlines(),
|
|
116
|
+
fromfile="original",
|
|
117
|
+
tofile="roundtrip",
|
|
118
|
+
lineterm="",
|
|
119
|
+
)
|
|
120
|
+
)
|
|
121
|
+
print(
|
|
122
|
+
f"JSON round-trip mismatch for {model_path}:\n{diff}",
|
|
123
|
+
file=sys.stderr,
|
|
124
|
+
)
|
|
125
|
+
sys.exit(1)
|
|
126
|
+
|
|
127
|
+
elif source_format == "xml":
|
|
128
|
+
assert isinstance(root, types.Root)
|
|
129
|
+
|
|
130
|
+
another_text = xmlization.to_str(root)
|
|
131
|
+
|
|
132
|
+
if normalize_xml(text) != normalize_xml(another_text):
|
|
133
|
+
diff = "\n".join(
|
|
134
|
+
difflib.unified_diff(
|
|
135
|
+
normalize_xml(text).splitlines(),
|
|
136
|
+
normalize_xml(another_text).splitlines(),
|
|
137
|
+
fromfile="original",
|
|
138
|
+
tofile="roundtrip",
|
|
139
|
+
lineterm="",
|
|
140
|
+
)
|
|
141
|
+
)
|
|
142
|
+
print(
|
|
143
|
+
f"XML round-trip mismatch for {model_path}:\n{diff}",
|
|
144
|
+
file=sys.stderr,
|
|
145
|
+
)
|
|
146
|
+
sys.exit(1)
|
|
147
|
+
|
|
148
|
+
else:
|
|
149
|
+
assert_never(source_format)
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
if __name__ == "__main__":
|
|
153
|
+
main()
|