diff --git a/skema/gromet/fn/__init__.py b/skema/gromet/fn/__init__.py index 725be8a61af..41c5fa4961a 100644 --- a/skema/gromet/fn/__init__.py +++ b/skema/gromet/fn/__init__.py @@ -4,9 +4,9 @@ """ Grounded Model Exchange (GroMEt) schema for Function Networks - This document defines the GroMEt Function Network data model. Note that Metadata is defined in separate spec. __Using Swagger to Generate Class Structure__ To automatically generate Python or Java models corresponding to this document, you can use [swagger-codegen](https://swagger.io/tools/swagger-codegen/). This can be used to generate the client code based off of this spec, and in the process this will generate the data model class structure. 1. Install via the method described for your operating system [here](https://github.com/swagger-api/swagger-codegen#Prerequisites). Make sure to install a version after 3.0 that will support openapi 3. 2. Run swagger-codegen with the options in the example below. The URL references where the yaml for this documentation is stored on github. Make sure to replace CURRENT_VERSION with the correct version. (The current version is `0.1.7`.) To generate Java classes rather, change the `-l python` to `-l java`. Change the value to the `-o` option to the desired output location. ``` swagger-codegen generate -l python -o ./client -i https://raw.githubusercontent.com/ml4ai/automates-v2/master/docs/source/gromet_FN_v{CURRENT_VERSION}.yaml ``` 3. Once it executes, the client code will be generated at your specified location. For python, the classes will be located in `$OUTPUT_PATH/swagger_client/models/`. For java, they will be located in `$OUTPUT_PATH/src/main/java/io/swagger/client/model/` If generating GroMEt schema data model classes in SKEMA (AutoMATES), then after generating the above, follow the instructions here: ``` /automates/model_assembly/gromet/model/README.md ``` # noqa: E501 + This document defines the GroMEt Function Network data model. Note that Metadata is defined in separate spec. __Using Swagger to Generate Class Structure__ To automatically generate Python or Java models corresponding to this document, you can use [swagger-codegen](https://swagger.io/tools/swagger-codegen/). This can be used to generate the client code based off of this spec, and in the process this will generate the data model class structure. 1. Install via the method described for your operating system [here](https://github.com/swagger-api/swagger-codegen#Prerequisites). Make sure to install a version after 3.0 that will support openapi 3. 2. Run swagger-codegen with the options in the example below. The URL references where the yaml for this documentation is stored on github. Make sure to replace CURRENT_VERSION with the correct version. (The current version is `0.1.7`.) To generate Java classes rather, change the `-l python` to `-l java`. Change the value to the `-o` option to the desired output location. ``` swagger-codegen generate -l python -o ./client -i https://raw.githubusercontent.com/ml4ai/automates-v2/master/docs/source/gromet_FN_v{CURRENT_VERSION}.yaml ``` 3. Once it executes, the client code will be generated at your specified location. For python, the classes will be located in `$OUTPUT_PATH/skema.gromet.fn.`. For java, they will be located in `$OUTPUT_PATH/src/main/java/io/swagger/client/model/` If generating GroMEt schema data model classes in SKEMA (AutoMATES), then after generating the above, follow the instructions here: ``` /automates/model_assembly/gromet/model/README.md ``` # noqa: E501 - OpenAPI spec version: 0.1.9 + OpenAPI spec version: 0.1.10 Contact: claytonm@arizona.edu Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -22,11 +22,12 @@ from skema.gromet.fn.gromet_fn import GrometFN from skema.gromet.fn.gromet_fn_module import GrometFNModule from skema.gromet.fn.gromet_fn_module_collection import GrometFNModuleCollection +from skema.gromet.fn.gromet_fn_module_dependency_reference import GrometFNModuleDependencyReference from skema.gromet.fn.gromet_object import GrometObject from skema.gromet.fn.gromet_port import GrometPort from skema.gromet.fn.gromet_wire import GrometWire from skema.gromet.fn.import_source_type import ImportSourceType from skema.gromet.fn.import_type import ImportType from skema.gromet.fn.literal_value import LiteralValue -# from skema.gromet.fn.metadata import Metadata +from skema.gromet.fn.metadata import Metadata from skema.gromet.fn.typed_value import TypedValue diff --git a/skema/gromet/fn/function_type.py b/skema/gromet/fn/function_type.py index e01a9cd3b12..769bdb3baa9 100644 --- a/skema/gromet/fn/function_type.py +++ b/skema/gromet/fn/function_type.py @@ -3,9 +3,9 @@ """ Grounded Model Exchange (GroMEt) schema for Function Networks - This document defines the GroMEt Function Network data model. Note that Metadata is defined in separate spec. __Using Swagger to Generate Class Structure__ To automatically generate Python or Java models corresponding to this document, you can use [swagger-codegen](https://swagger.io/tools/swagger-codegen/). This can be used to generate the client code based off of this spec, and in the process this will generate the data model class structure. 1. Install via the method described for your operating system [here](https://github.com/swagger-api/swagger-codegen#Prerequisites). Make sure to install a version after 3.0 that will support openapi 3. 2. Run swagger-codegen with the options in the example below. The URL references where the yaml for this documentation is stored on github. Make sure to replace CURRENT_VERSION with the correct version. (The current version is `0.1.7`.) To generate Java classes rather, change the `-l python` to `-l java`. Change the value to the `-o` option to the desired output location. ``` swagger-codegen generate -l python -o ./client -i https://raw.githubusercontent.com/ml4ai/automates-v2/master/docs/source/gromet_FN_v{CURRENT_VERSION}.yaml ``` 3. Once it executes, the client code will be generated at your specified location. For python, the classes will be located in `$OUTPUT_PATH/swagger_client/models/`. For java, they will be located in `$OUTPUT_PATH/src/main/java/io/swagger/client/model/` If generating GroMEt schema data model classes in SKEMA (AutoMATES), then after generating the above, follow the instructions here: ``` /automates/model_assembly/gromet/model/README.md ``` # noqa: E501 + This document defines the GroMEt Function Network data model. Note that Metadata is defined in separate spec. __Using Swagger to Generate Class Structure__ To automatically generate Python or Java models corresponding to this document, you can use [swagger-codegen](https://swagger.io/tools/swagger-codegen/). This can be used to generate the client code based off of this spec, and in the process this will generate the data model class structure. 1. Install via the method described for your operating system [here](https://github.com/swagger-api/swagger-codegen#Prerequisites). Make sure to install a version after 3.0 that will support openapi 3. 2. Run swagger-codegen with the options in the example below. The URL references where the yaml for this documentation is stored on github. Make sure to replace CURRENT_VERSION with the correct version. (The current version is `0.1.7`.) To generate Java classes rather, change the `-l python` to `-l java`. Change the value to the `-o` option to the desired output location. ``` swagger-codegen generate -l python -o ./client -i https://raw.githubusercontent.com/ml4ai/automates-v2/master/docs/source/gromet_FN_v{CURRENT_VERSION}.yaml ``` 3. Once it executes, the client code will be generated at your specified location. For python, the classes will be located in `$OUTPUT_PATH/skema.gromet.fn.`. For java, they will be located in `$OUTPUT_PATH/src/main/java/io/swagger/client/model/` If generating GroMEt schema data model classes in SKEMA (AutoMATES), then after generating the above, follow the instructions here: ``` /automates/model_assembly/gromet/model/README.md ``` # noqa: E501 - OpenAPI spec version: 0.1.9 + OpenAPI spec version: 0.1.10 Contact: claytonm@arizona.edu Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/skema/gromet/fn/gromet_box.py b/skema/gromet/fn/gromet_box.py index 8258444cf29..cddb8fd1d95 100644 --- a/skema/gromet/fn/gromet_box.py +++ b/skema/gromet/fn/gromet_box.py @@ -3,9 +3,9 @@ """ Grounded Model Exchange (GroMEt) schema for Function Networks - This document defines the GroMEt Function Network data model. Note that Metadata is defined in separate spec. __Using Swagger to Generate Class Structure__ To automatically generate Python or Java models corresponding to this document, you can use [swagger-codegen](https://swagger.io/tools/swagger-codegen/). This can be used to generate the client code based off of this spec, and in the process this will generate the data model class structure. 1. Install via the method described for your operating system [here](https://github.com/swagger-api/swagger-codegen#Prerequisites). Make sure to install a version after 3.0 that will support openapi 3. 2. Run swagger-codegen with the options in the example below. The URL references where the yaml for this documentation is stored on github. Make sure to replace CURRENT_VERSION with the correct version. (The current version is `0.1.7`.) To generate Java classes rather, change the `-l python` to `-l java`. Change the value to the `-o` option to the desired output location. ``` swagger-codegen generate -l python -o ./client -i https://raw.githubusercontent.com/ml4ai/automates-v2/master/docs/source/gromet_FN_v{CURRENT_VERSION}.yaml ``` 3. Once it executes, the client code will be generated at your specified location. For python, the classes will be located in `$OUTPUT_PATH/swagger_client/models/`. For java, they will be located in `$OUTPUT_PATH/src/main/java/io/swagger/client/model/` If generating GroMEt schema data model classes in SKEMA (AutoMATES), then after generating the above, follow the instructions here: ``` /automates/model_assembly/gromet/model/README.md ``` # noqa: E501 + This document defines the GroMEt Function Network data model. Note that Metadata is defined in separate spec. __Using Swagger to Generate Class Structure__ To automatically generate Python or Java models corresponding to this document, you can use [swagger-codegen](https://swagger.io/tools/swagger-codegen/). This can be used to generate the client code based off of this spec, and in the process this will generate the data model class structure. 1. Install via the method described for your operating system [here](https://github.com/swagger-api/swagger-codegen#Prerequisites). Make sure to install a version after 3.0 that will support openapi 3. 2. Run swagger-codegen with the options in the example below. The URL references where the yaml for this documentation is stored on github. Make sure to replace CURRENT_VERSION with the correct version. (The current version is `0.1.7`.) To generate Java classes rather, change the `-l python` to `-l java`. Change the value to the `-o` option to the desired output location. ``` swagger-codegen generate -l python -o ./client -i https://raw.githubusercontent.com/ml4ai/automates-v2/master/docs/source/gromet_FN_v{CURRENT_VERSION}.yaml ``` 3. Once it executes, the client code will be generated at your specified location. For python, the classes will be located in `$OUTPUT_PATH/skema.gromet.fn.`. For java, they will be located in `$OUTPUT_PATH/src/main/java/io/swagger/client/model/` If generating GroMEt schema data model classes in SKEMA (AutoMATES), then after generating the above, follow the instructions here: ``` /automates/model_assembly/gromet/model/README.md ``` # noqa: E501 - OpenAPI spec version: 0.1.9 + OpenAPI spec version: 0.1.10 Contact: claytonm@arizona.edu Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/skema/gromet/fn/gromet_box_conditional.py b/skema/gromet/fn/gromet_box_conditional.py index e681904fb8b..0dce5ea9637 100644 --- a/skema/gromet/fn/gromet_box_conditional.py +++ b/skema/gromet/fn/gromet_box_conditional.py @@ -3,9 +3,9 @@ """ Grounded Model Exchange (GroMEt) schema for Function Networks - This document defines the GroMEt Function Network data model. Note that Metadata is defined in separate spec. __Using Swagger to Generate Class Structure__ To automatically generate Python or Java models corresponding to this document, you can use [swagger-codegen](https://swagger.io/tools/swagger-codegen/). This can be used to generate the client code based off of this spec, and in the process this will generate the data model class structure. 1. Install via the method described for your operating system [here](https://github.com/swagger-api/swagger-codegen#Prerequisites). Make sure to install a version after 3.0 that will support openapi 3. 2. Run swagger-codegen with the options in the example below. The URL references where the yaml for this documentation is stored on github. Make sure to replace CURRENT_VERSION with the correct version. (The current version is `0.1.7`.) To generate Java classes rather, change the `-l python` to `-l java`. Change the value to the `-o` option to the desired output location. ``` swagger-codegen generate -l python -o ./client -i https://raw.githubusercontent.com/ml4ai/automates-v2/master/docs/source/gromet_FN_v{CURRENT_VERSION}.yaml ``` 3. Once it executes, the client code will be generated at your specified location. For python, the classes will be located in `$OUTPUT_PATH/swagger_client/models/`. For java, they will be located in `$OUTPUT_PATH/src/main/java/io/swagger/client/model/` If generating GroMEt schema data model classes in SKEMA (AutoMATES), then after generating the above, follow the instructions here: ``` /automates/model_assembly/gromet/model/README.md ``` # noqa: E501 + This document defines the GroMEt Function Network data model. Note that Metadata is defined in separate spec. __Using Swagger to Generate Class Structure__ To automatically generate Python or Java models corresponding to this document, you can use [swagger-codegen](https://swagger.io/tools/swagger-codegen/). This can be used to generate the client code based off of this spec, and in the process this will generate the data model class structure. 1. Install via the method described for your operating system [here](https://github.com/swagger-api/swagger-codegen#Prerequisites). Make sure to install a version after 3.0 that will support openapi 3. 2. Run swagger-codegen with the options in the example below. The URL references where the yaml for this documentation is stored on github. Make sure to replace CURRENT_VERSION with the correct version. (The current version is `0.1.7`.) To generate Java classes rather, change the `-l python` to `-l java`. Change the value to the `-o` option to the desired output location. ``` swagger-codegen generate -l python -o ./client -i https://raw.githubusercontent.com/ml4ai/automates-v2/master/docs/source/gromet_FN_v{CURRENT_VERSION}.yaml ``` 3. Once it executes, the client code will be generated at your specified location. For python, the classes will be located in `$OUTPUT_PATH/skema.gromet.fn.`. For java, they will be located in `$OUTPUT_PATH/src/main/java/io/swagger/client/model/` If generating GroMEt schema data model classes in SKEMA (AutoMATES), then after generating the above, follow the instructions here: ``` /automates/model_assembly/gromet/model/README.md ``` # noqa: E501 - OpenAPI spec version: 0.1.9 + OpenAPI spec version: 0.1.10 Contact: claytonm@arizona.edu Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/skema/gromet/fn/gromet_box_function.py b/skema/gromet/fn/gromet_box_function.py index f4c2fe40491..eec50f6b747 100644 --- a/skema/gromet/fn/gromet_box_function.py +++ b/skema/gromet/fn/gromet_box_function.py @@ -3,9 +3,9 @@ """ Grounded Model Exchange (GroMEt) schema for Function Networks - This document defines the GroMEt Function Network data model. Note that Metadata is defined in separate spec. __Using Swagger to Generate Class Structure__ To automatically generate Python or Java models corresponding to this document, you can use [swagger-codegen](https://swagger.io/tools/swagger-codegen/). This can be used to generate the client code based off of this spec, and in the process this will generate the data model class structure. 1. Install via the method described for your operating system [here](https://github.com/swagger-api/swagger-codegen#Prerequisites). Make sure to install a version after 3.0 that will support openapi 3. 2. Run swagger-codegen with the options in the example below. The URL references where the yaml for this documentation is stored on github. Make sure to replace CURRENT_VERSION with the correct version. (The current version is `0.1.7`.) To generate Java classes rather, change the `-l python` to `-l java`. Change the value to the `-o` option to the desired output location. ``` swagger-codegen generate -l python -o ./client -i https://raw.githubusercontent.com/ml4ai/automates-v2/master/docs/source/gromet_FN_v{CURRENT_VERSION}.yaml ``` 3. Once it executes, the client code will be generated at your specified location. For python, the classes will be located in `$OUTPUT_PATH/swagger_client/models/`. For java, they will be located in `$OUTPUT_PATH/src/main/java/io/swagger/client/model/` If generating GroMEt schema data model classes in SKEMA (AutoMATES), then after generating the above, follow the instructions here: ``` /automates/model_assembly/gromet/model/README.md ``` # noqa: E501 + This document defines the GroMEt Function Network data model. Note that Metadata is defined in separate spec. __Using Swagger to Generate Class Structure__ To automatically generate Python or Java models corresponding to this document, you can use [swagger-codegen](https://swagger.io/tools/swagger-codegen/). This can be used to generate the client code based off of this spec, and in the process this will generate the data model class structure. 1. Install via the method described for your operating system [here](https://github.com/swagger-api/swagger-codegen#Prerequisites). Make sure to install a version after 3.0 that will support openapi 3. 2. Run swagger-codegen with the options in the example below. The URL references where the yaml for this documentation is stored on github. Make sure to replace CURRENT_VERSION with the correct version. (The current version is `0.1.7`.) To generate Java classes rather, change the `-l python` to `-l java`. Change the value to the `-o` option to the desired output location. ``` swagger-codegen generate -l python -o ./client -i https://raw.githubusercontent.com/ml4ai/automates-v2/master/docs/source/gromet_FN_v{CURRENT_VERSION}.yaml ``` 3. Once it executes, the client code will be generated at your specified location. For python, the classes will be located in `$OUTPUT_PATH/skema.gromet.fn.`. For java, they will be located in `$OUTPUT_PATH/src/main/java/io/swagger/client/model/` If generating GroMEt schema data model classes in SKEMA (AutoMATES), then after generating the above, follow the instructions here: ``` /automates/model_assembly/gromet/model/README.md ``` # noqa: E501 - OpenAPI spec version: 0.1.9 + OpenAPI spec version: 0.1.10 Contact: claytonm@arizona.edu Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/skema/gromet/fn/gromet_box_loop.py b/skema/gromet/fn/gromet_box_loop.py index e550be7adca..af8be5e9c27 100644 --- a/skema/gromet/fn/gromet_box_loop.py +++ b/skema/gromet/fn/gromet_box_loop.py @@ -3,9 +3,9 @@ """ Grounded Model Exchange (GroMEt) schema for Function Networks - This document defines the GroMEt Function Network data model. Note that Metadata is defined in separate spec. __Using Swagger to Generate Class Structure__ To automatically generate Python or Java models corresponding to this document, you can use [swagger-codegen](https://swagger.io/tools/swagger-codegen/). This can be used to generate the client code based off of this spec, and in the process this will generate the data model class structure. 1. Install via the method described for your operating system [here](https://github.com/swagger-api/swagger-codegen#Prerequisites). Make sure to install a version after 3.0 that will support openapi 3. 2. Run swagger-codegen with the options in the example below. The URL references where the yaml for this documentation is stored on github. Make sure to replace CURRENT_VERSION with the correct version. (The current version is `0.1.7`.) To generate Java classes rather, change the `-l python` to `-l java`. Change the value to the `-o` option to the desired output location. ``` swagger-codegen generate -l python -o ./client -i https://raw.githubusercontent.com/ml4ai/automates-v2/master/docs/source/gromet_FN_v{CURRENT_VERSION}.yaml ``` 3. Once it executes, the client code will be generated at your specified location. For python, the classes will be located in `$OUTPUT_PATH/swagger_client/models/`. For java, they will be located in `$OUTPUT_PATH/src/main/java/io/swagger/client/model/` If generating GroMEt schema data model classes in SKEMA (AutoMATES), then after generating the above, follow the instructions here: ``` /automates/model_assembly/gromet/model/README.md ``` # noqa: E501 + This document defines the GroMEt Function Network data model. Note that Metadata is defined in separate spec. __Using Swagger to Generate Class Structure__ To automatically generate Python or Java models corresponding to this document, you can use [swagger-codegen](https://swagger.io/tools/swagger-codegen/). This can be used to generate the client code based off of this spec, and in the process this will generate the data model class structure. 1. Install via the method described for your operating system [here](https://github.com/swagger-api/swagger-codegen#Prerequisites). Make sure to install a version after 3.0 that will support openapi 3. 2. Run swagger-codegen with the options in the example below. The URL references where the yaml for this documentation is stored on github. Make sure to replace CURRENT_VERSION with the correct version. (The current version is `0.1.7`.) To generate Java classes rather, change the `-l python` to `-l java`. Change the value to the `-o` option to the desired output location. ``` swagger-codegen generate -l python -o ./client -i https://raw.githubusercontent.com/ml4ai/automates-v2/master/docs/source/gromet_FN_v{CURRENT_VERSION}.yaml ``` 3. Once it executes, the client code will be generated at your specified location. For python, the classes will be located in `$OUTPUT_PATH/skema.gromet.fn.`. For java, they will be located in `$OUTPUT_PATH/src/main/java/io/swagger/client/model/` If generating GroMEt schema data model classes in SKEMA (AutoMATES), then after generating the above, follow the instructions here: ``` /automates/model_assembly/gromet/model/README.md ``` # noqa: E501 - OpenAPI spec version: 0.1.9 + OpenAPI spec version: 0.1.10 Contact: claytonm@arizona.edu Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/skema/gromet/fn/gromet_fn.py b/skema/gromet/fn/gromet_fn.py index 8a1a217c626..369167f6663 100644 --- a/skema/gromet/fn/gromet_fn.py +++ b/skema/gromet/fn/gromet_fn.py @@ -3,9 +3,9 @@ """ Grounded Model Exchange (GroMEt) schema for Function Networks - This document defines the GroMEt Function Network data model. Note that Metadata is defined in separate spec. __Using Swagger to Generate Class Structure__ To automatically generate Python or Java models corresponding to this document, you can use [swagger-codegen](https://swagger.io/tools/swagger-codegen/). This can be used to generate the client code based off of this spec, and in the process this will generate the data model class structure. 1. Install via the method described for your operating system [here](https://github.com/swagger-api/swagger-codegen#Prerequisites). Make sure to install a version after 3.0 that will support openapi 3. 2. Run swagger-codegen with the options in the example below. The URL references where the yaml for this documentation is stored on github. Make sure to replace CURRENT_VERSION with the correct version. (The current version is `0.1.7`.) To generate Java classes rather, change the `-l python` to `-l java`. Change the value to the `-o` option to the desired output location. ``` swagger-codegen generate -l python -o ./client -i https://raw.githubusercontent.com/ml4ai/automates-v2/master/docs/source/gromet_FN_v{CURRENT_VERSION}.yaml ``` 3. Once it executes, the client code will be generated at your specified location. For python, the classes will be located in `$OUTPUT_PATH/swagger_client/models/`. For java, they will be located in `$OUTPUT_PATH/src/main/java/io/swagger/client/model/` If generating GroMEt schema data model classes in SKEMA (AutoMATES), then after generating the above, follow the instructions here: ``` /automates/model_assembly/gromet/model/README.md ``` # noqa: E501 + This document defines the GroMEt Function Network data model. Note that Metadata is defined in separate spec. __Using Swagger to Generate Class Structure__ To automatically generate Python or Java models corresponding to this document, you can use [swagger-codegen](https://swagger.io/tools/swagger-codegen/). This can be used to generate the client code based off of this spec, and in the process this will generate the data model class structure. 1. Install via the method described for your operating system [here](https://github.com/swagger-api/swagger-codegen#Prerequisites). Make sure to install a version after 3.0 that will support openapi 3. 2. Run swagger-codegen with the options in the example below. The URL references where the yaml for this documentation is stored on github. Make sure to replace CURRENT_VERSION with the correct version. (The current version is `0.1.7`.) To generate Java classes rather, change the `-l python` to `-l java`. Change the value to the `-o` option to the desired output location. ``` swagger-codegen generate -l python -o ./client -i https://raw.githubusercontent.com/ml4ai/automates-v2/master/docs/source/gromet_FN_v{CURRENT_VERSION}.yaml ``` 3. Once it executes, the client code will be generated at your specified location. For python, the classes will be located in `$OUTPUT_PATH/skema.gromet.fn.`. For java, they will be located in `$OUTPUT_PATH/src/main/java/io/swagger/client/model/` If generating GroMEt schema data model classes in SKEMA (AutoMATES), then after generating the above, follow the instructions here: ``` /automates/model_assembly/gromet/model/README.md ``` # noqa: E501 - OpenAPI spec version: 0.1.9 + OpenAPI spec version: 0.1.10 Contact: claytonm@arizona.edu Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/skema/gromet/fn/gromet_fn_module.py b/skema/gromet/fn/gromet_fn_module.py index 8b27077c051..a232f804f5c 100644 --- a/skema/gromet/fn/gromet_fn_module.py +++ b/skema/gromet/fn/gromet_fn_module.py @@ -3,9 +3,9 @@ """ Grounded Model Exchange (GroMEt) schema for Function Networks - This document defines the GroMEt Function Network data model. Note that Metadata is defined in separate spec. __Using Swagger to Generate Class Structure__ To automatically generate Python or Java models corresponding to this document, you can use [swagger-codegen](https://swagger.io/tools/swagger-codegen/). This can be used to generate the client code based off of this spec, and in the process this will generate the data model class structure. 1. Install via the method described for your operating system [here](https://github.com/swagger-api/swagger-codegen#Prerequisites). Make sure to install a version after 3.0 that will support openapi 3. 2. Run swagger-codegen with the options in the example below. The URL references where the yaml for this documentation is stored on github. Make sure to replace CURRENT_VERSION with the correct version. (The current version is `0.1.7`.) To generate Java classes rather, change the `-l python` to `-l java`. Change the value to the `-o` option to the desired output location. ``` swagger-codegen generate -l python -o ./client -i https://raw.githubusercontent.com/ml4ai/automates-v2/master/docs/source/gromet_FN_v{CURRENT_VERSION}.yaml ``` 3. Once it executes, the client code will be generated at your specified location. For python, the classes will be located in `$OUTPUT_PATH/swagger_client/models/`. For java, they will be located in `$OUTPUT_PATH/src/main/java/io/swagger/client/model/` If generating GroMEt schema data model classes in SKEMA (AutoMATES), then after generating the above, follow the instructions here: ``` /automates/model_assembly/gromet/model/README.md ``` # noqa: E501 + This document defines the GroMEt Function Network data model. Note that Metadata is defined in separate spec. __Using Swagger to Generate Class Structure__ To automatically generate Python or Java models corresponding to this document, you can use [swagger-codegen](https://swagger.io/tools/swagger-codegen/). This can be used to generate the client code based off of this spec, and in the process this will generate the data model class structure. 1. Install via the method described for your operating system [here](https://github.com/swagger-api/swagger-codegen#Prerequisites). Make sure to install a version after 3.0 that will support openapi 3. 2. Run swagger-codegen with the options in the example below. The URL references where the yaml for this documentation is stored on github. Make sure to replace CURRENT_VERSION with the correct version. (The current version is `0.1.7`.) To generate Java classes rather, change the `-l python` to `-l java`. Change the value to the `-o` option to the desired output location. ``` swagger-codegen generate -l python -o ./client -i https://raw.githubusercontent.com/ml4ai/automates-v2/master/docs/source/gromet_FN_v{CURRENT_VERSION}.yaml ``` 3. Once it executes, the client code will be generated at your specified location. For python, the classes will be located in `$OUTPUT_PATH/skema.gromet.fn.`. For java, they will be located in `$OUTPUT_PATH/src/main/java/io/swagger/client/model/` If generating GroMEt schema data model classes in SKEMA (AutoMATES), then after generating the above, follow the instructions here: ``` /automates/model_assembly/gromet/model/README.md ``` # noqa: E501 - OpenAPI spec version: 0.1.9 + OpenAPI spec version: 0.1.10 Contact: claytonm@arizona.edu Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/skema/gromet/fn/gromet_fn_module_collection.py b/skema/gromet/fn/gromet_fn_module_collection.py index 57bbde8e5a3..1da4d3f3c80 100644 --- a/skema/gromet/fn/gromet_fn_module_collection.py +++ b/skema/gromet/fn/gromet_fn_module_collection.py @@ -3,9 +3,9 @@ """ Grounded Model Exchange (GroMEt) schema for Function Networks - This document defines the GroMEt Function Network data model. Note that Metadata is defined in separate spec. __Using Swagger to Generate Class Structure__ To automatically generate Python or Java models corresponding to this document, you can use [swagger-codegen](https://swagger.io/tools/swagger-codegen/). This can be used to generate the client code based off of this spec, and in the process this will generate the data model class structure. 1. Install via the method described for your operating system [here](https://github.com/swagger-api/swagger-codegen#Prerequisites). Make sure to install a version after 3.0 that will support openapi 3. 2. Run swagger-codegen with the options in the example below. The URL references where the yaml for this documentation is stored on github. Make sure to replace CURRENT_VERSION with the correct version. (The current version is `0.1.7`.) To generate Java classes rather, change the `-l python` to `-l java`. Change the value to the `-o` option to the desired output location. ``` swagger-codegen generate -l python -o ./client -i https://raw.githubusercontent.com/ml4ai/automates-v2/master/docs/source/gromet_FN_v{CURRENT_VERSION}.yaml ``` 3. Once it executes, the client code will be generated at your specified location. For python, the classes will be located in `$OUTPUT_PATH/swagger_client/models/`. For java, they will be located in `$OUTPUT_PATH/src/main/java/io/swagger/client/model/` If generating GroMEt schema data model classes in SKEMA (AutoMATES), then after generating the above, follow the instructions here: ``` /automates/model_assembly/gromet/model/README.md ``` # noqa: E501 + This document defines the GroMEt Function Network data model. Note that Metadata is defined in separate spec. __Using Swagger to Generate Class Structure__ To automatically generate Python or Java models corresponding to this document, you can use [swagger-codegen](https://swagger.io/tools/swagger-codegen/). This can be used to generate the client code based off of this spec, and in the process this will generate the data model class structure. 1. Install via the method described for your operating system [here](https://github.com/swagger-api/swagger-codegen#Prerequisites). Make sure to install a version after 3.0 that will support openapi 3. 2. Run swagger-codegen with the options in the example below. The URL references where the yaml for this documentation is stored on github. Make sure to replace CURRENT_VERSION with the correct version. (The current version is `0.1.7`.) To generate Java classes rather, change the `-l python` to `-l java`. Change the value to the `-o` option to the desired output location. ``` swagger-codegen generate -l python -o ./client -i https://raw.githubusercontent.com/ml4ai/automates-v2/master/docs/source/gromet_FN_v{CURRENT_VERSION}.yaml ``` 3. Once it executes, the client code will be generated at your specified location. For python, the classes will be located in `$OUTPUT_PATH/skema.gromet.fn.`. For java, they will be located in `$OUTPUT_PATH/src/main/java/io/swagger/client/model/` If generating GroMEt schema data model classes in SKEMA (AutoMATES), then after generating the above, follow the instructions here: ``` /automates/model_assembly/gromet/model/README.md ``` # noqa: E501 - OpenAPI spec version: 0.1.9 + OpenAPI spec version: 0.1.10 Contact: claytonm@arizona.edu Generated by: https://github.com/swagger-api/swagger-codegen.git """ @@ -34,6 +34,7 @@ class GrometFNModuleCollection(GrometObject): 'name': 'str', 'modules': 'list[GrometFNModule]', 'module_index': 'list[str]', + 'module_dependencies': 'list[GrometFNModuleDependencyReference]', 'executables': 'list[int]', 'metadata_collection': 'list[list[Metadata]]', 'gromet_type': 'str' @@ -47,6 +48,7 @@ class GrometFNModuleCollection(GrometObject): 'name': 'name', 'modules': 'modules', 'module_index': 'module_index', + 'module_dependencies': 'module_dependencies', 'executables': 'executables', 'metadata_collection': 'metadata_collection', 'gromet_type': 'gromet_type' @@ -54,13 +56,14 @@ class GrometFNModuleCollection(GrometObject): if hasattr(GrometObject, "attribute_map"): attribute_map.update(GrometObject.attribute_map) - def __init__(self, schema='FN', schema_version=None, name=None, modules=None, module_index=None, executables=None, metadata_collection=None, gromet_type='GrometFNModuleCollection', *args, **kwargs): # noqa: E501 + def __init__(self, schema='FN', schema_version=None, name=None, modules=None, module_index=None, module_dependencies=None, executables=None, metadata_collection=None, gromet_type='GrometFNModuleCollection', *args, **kwargs): # noqa: E501 """GrometFNModuleCollection - a model defined in Swagger""" # noqa: E501 self._schema = None self._schema_version = None self._name = None self._modules = None self._module_index = None + self._module_dependencies = None self._executables = None self._metadata_collection = None self._gromet_type = None @@ -75,6 +78,8 @@ def __init__(self, schema='FN', schema_version=None, name=None, modules=None, mo self.modules = modules if module_index is not None: self.module_index = module_index + if module_dependencies is not None: + self.module_dependencies = module_dependencies if executables is not None: self.executables = executables if metadata_collection is not None: @@ -192,6 +197,29 @@ def module_index(self, module_index): self._module_index = module_index + @property + def module_dependencies(self): + """Gets the module_dependencies of this GrometFNModuleCollection. # noqa: E501 + + Collection of references to modules that have contents that are imported and / referred to by modules in this ModuleCollection. # noqa: E501 + + :return: The module_dependencies of this GrometFNModuleCollection. # noqa: E501 + :rtype: list[GrometFNModuleDependencyReference] + """ + return self._module_dependencies + + @module_dependencies.setter + def module_dependencies(self, module_dependencies): + """Sets the module_dependencies of this GrometFNModuleCollection. + + Collection of references to modules that have contents that are imported and / referred to by modules in this ModuleCollection. # noqa: E501 + + :param module_dependencies: The module_dependencies of this GrometFNModuleCollection. # noqa: E501 + :type: list[GrometFNModuleDependencyReference] + """ + + self._module_dependencies = module_dependencies + @property def executables(self): """Gets the executables of this GrometFNModuleCollection. # noqa: E501 diff --git a/skema/gromet/fn/gromet_fn_module_dependency_reference.py b/skema/gromet/fn/gromet_fn_module_dependency_reference.py new file mode 100644 index 00000000000..49b03f0db64 --- /dev/null +++ b/skema/gromet/fn/gromet_fn_module_dependency_reference.py @@ -0,0 +1,144 @@ +# coding: utf-8 + +""" + Grounded Model Exchange (GroMEt) schema for Function Networks + + This document defines the GroMEt Function Network data model. Note that Metadata is defined in separate spec. __Using Swagger to Generate Class Structure__ To automatically generate Python or Java models corresponding to this document, you can use [swagger-codegen](https://swagger.io/tools/swagger-codegen/). This can be used to generate the client code based off of this spec, and in the process this will generate the data model class structure. 1. Install via the method described for your operating system [here](https://github.com/swagger-api/swagger-codegen#Prerequisites). Make sure to install a version after 3.0 that will support openapi 3. 2. Run swagger-codegen with the options in the example below. The URL references where the yaml for this documentation is stored on github. Make sure to replace CURRENT_VERSION with the correct version. (The current version is `0.1.7`.) To generate Java classes rather, change the `-l python` to `-l java`. Change the value to the `-o` option to the desired output location. ``` swagger-codegen generate -l python -o ./client -i https://raw.githubusercontent.com/ml4ai/automates-v2/master/docs/source/gromet_FN_v{CURRENT_VERSION}.yaml ``` 3. Once it executes, the client code will be generated at your specified location. For python, the classes will be located in `$OUTPUT_PATH/skema.gromet.fn.`. For java, they will be located in `$OUTPUT_PATH/src/main/java/io/swagger/client/model/` If generating GroMEt schema data model classes in SKEMA (AutoMATES), then after generating the above, follow the instructions here: ``` /automates/model_assembly/gromet/model/README.md ``` # noqa: E501 + + OpenAPI spec version: 0.1.10 + Contact: claytonm@arizona.edu + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six +from skema.gromet.fn.gromet_object import GrometObject # noqa: F401,E501 + +class GrometFNModuleDependencyReference(GrometObject): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'name': 'str', + 'source_reference': 'TypedValue' + } + if hasattr(GrometObject, "swagger_types"): + swagger_types.update(GrometObject.swagger_types) + + attribute_map = { + 'name': 'name', + 'source_reference': 'source_reference' + } + if hasattr(GrometObject, "attribute_map"): + attribute_map.update(GrometObject.attribute_map) + + def __init__(self, name=None, source_reference=None, *args, **kwargs): # noqa: E501 + """GrometFNModuleDependencyReference - a model defined in Swagger""" # noqa: E501 + self._name = None + self._source_reference = None + self.discriminator = None + if name is not None: + self.name = name + if source_reference is not None: + self.source_reference = source_reference + GrometObject.__init__(self, *args, **kwargs) + + @property + def name(self): + """Gets the name of this GrometFNModuleDependencyReference. # noqa: E501 + + The name of the Module dependency # noqa: E501 + + :return: The name of this GrometFNModuleDependencyReference. # noqa: E501 + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """Sets the name of this GrometFNModuleDependencyReference. + + The name of the Module dependency # noqa: E501 + + :param name: The name of this GrometFNModuleDependencyReference. # noqa: E501 + :type: str + """ + + self._name = name + + @property + def source_reference(self): + """Gets the source_reference of this GrometFNModuleDependencyReference. # noqa: E501 + + + :return: The source_reference of this GrometFNModuleDependencyReference. # noqa: E501 + :rtype: TypedValue + """ + return self._source_reference + + @source_reference.setter + def source_reference(self, source_reference): + """Sets the source_reference of this GrometFNModuleDependencyReference. + + + :param source_reference: The source_reference of this GrometFNModuleDependencyReference. # noqa: E501 + :type: TypedValue + """ + + self._source_reference = source_reference + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(GrometFNModuleDependencyReference, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, GrometFNModuleDependencyReference): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/skema/gromet/fn/gromet_object.py b/skema/gromet/fn/gromet_object.py index a5da7f80ba7..149c224bc6b 100644 --- a/skema/gromet/fn/gromet_object.py +++ b/skema/gromet/fn/gromet_object.py @@ -3,9 +3,9 @@ """ Grounded Model Exchange (GroMEt) schema for Function Networks - This document defines the GroMEt Function Network data model. Note that Metadata is defined in separate spec. __Using Swagger to Generate Class Structure__ To automatically generate Python or Java models corresponding to this document, you can use [swagger-codegen](https://swagger.io/tools/swagger-codegen/). This can be used to generate the client code based off of this spec, and in the process this will generate the data model class structure. 1. Install via the method described for your operating system [here](https://github.com/swagger-api/swagger-codegen#Prerequisites). Make sure to install a version after 3.0 that will support openapi 3. 2. Run swagger-codegen with the options in the example below. The URL references where the yaml for this documentation is stored on github. Make sure to replace CURRENT_VERSION with the correct version. (The current version is `0.1.7`.) To generate Java classes rather, change the `-l python` to `-l java`. Change the value to the `-o` option to the desired output location. ``` swagger-codegen generate -l python -o ./client -i https://raw.githubusercontent.com/ml4ai/automates-v2/master/docs/source/gromet_FN_v{CURRENT_VERSION}.yaml ``` 3. Once it executes, the client code will be generated at your specified location. For python, the classes will be located in `$OUTPUT_PATH/swagger_client/models/`. For java, they will be located in `$OUTPUT_PATH/src/main/java/io/swagger/client/model/` If generating GroMEt schema data model classes in SKEMA (AutoMATES), then after generating the above, follow the instructions here: ``` /automates/model_assembly/gromet/model/README.md ``` # noqa: E501 + This document defines the GroMEt Function Network data model. Note that Metadata is defined in separate spec. __Using Swagger to Generate Class Structure__ To automatically generate Python or Java models corresponding to this document, you can use [swagger-codegen](https://swagger.io/tools/swagger-codegen/). This can be used to generate the client code based off of this spec, and in the process this will generate the data model class structure. 1. Install via the method described for your operating system [here](https://github.com/swagger-api/swagger-codegen#Prerequisites). Make sure to install a version after 3.0 that will support openapi 3. 2. Run swagger-codegen with the options in the example below. The URL references where the yaml for this documentation is stored on github. Make sure to replace CURRENT_VERSION with the correct version. (The current version is `0.1.7`.) To generate Java classes rather, change the `-l python` to `-l java`. Change the value to the `-o` option to the desired output location. ``` swagger-codegen generate -l python -o ./client -i https://raw.githubusercontent.com/ml4ai/automates-v2/master/docs/source/gromet_FN_v{CURRENT_VERSION}.yaml ``` 3. Once it executes, the client code will be generated at your specified location. For python, the classes will be located in `$OUTPUT_PATH/skema.gromet.fn.`. For java, they will be located in `$OUTPUT_PATH/src/main/java/io/swagger/client/model/` If generating GroMEt schema data model classes in SKEMA (AutoMATES), then after generating the above, follow the instructions here: ``` /automates/model_assembly/gromet/model/README.md ``` # noqa: E501 - OpenAPI spec version: 0.1.9 + OpenAPI spec version: 0.1.10 Contact: claytonm@arizona.edu Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/skema/gromet/fn/gromet_port.py b/skema/gromet/fn/gromet_port.py index 00d5ae5be17..bf121c047d1 100644 --- a/skema/gromet/fn/gromet_port.py +++ b/skema/gromet/fn/gromet_port.py @@ -3,9 +3,9 @@ """ Grounded Model Exchange (GroMEt) schema for Function Networks - This document defines the GroMEt Function Network data model. Note that Metadata is defined in separate spec. __Using Swagger to Generate Class Structure__ To automatically generate Python or Java models corresponding to this document, you can use [swagger-codegen](https://swagger.io/tools/swagger-codegen/). This can be used to generate the client code based off of this spec, and in the process this will generate the data model class structure. 1. Install via the method described for your operating system [here](https://github.com/swagger-api/swagger-codegen#Prerequisites). Make sure to install a version after 3.0 that will support openapi 3. 2. Run swagger-codegen with the options in the example below. The URL references where the yaml for this documentation is stored on github. Make sure to replace CURRENT_VERSION with the correct version. (The current version is `0.1.7`.) To generate Java classes rather, change the `-l python` to `-l java`. Change the value to the `-o` option to the desired output location. ``` swagger-codegen generate -l python -o ./client -i https://raw.githubusercontent.com/ml4ai/automates-v2/master/docs/source/gromet_FN_v{CURRENT_VERSION}.yaml ``` 3. Once it executes, the client code will be generated at your specified location. For python, the classes will be located in `$OUTPUT_PATH/swagger_client/models/`. For java, they will be located in `$OUTPUT_PATH/src/main/java/io/swagger/client/model/` If generating GroMEt schema data model classes in SKEMA (AutoMATES), then after generating the above, follow the instructions here: ``` /automates/model_assembly/gromet/model/README.md ``` # noqa: E501 + This document defines the GroMEt Function Network data model. Note that Metadata is defined in separate spec. __Using Swagger to Generate Class Structure__ To automatically generate Python or Java models corresponding to this document, you can use [swagger-codegen](https://swagger.io/tools/swagger-codegen/). This can be used to generate the client code based off of this spec, and in the process this will generate the data model class structure. 1. Install via the method described for your operating system [here](https://github.com/swagger-api/swagger-codegen#Prerequisites). Make sure to install a version after 3.0 that will support openapi 3. 2. Run swagger-codegen with the options in the example below. The URL references where the yaml for this documentation is stored on github. Make sure to replace CURRENT_VERSION with the correct version. (The current version is `0.1.7`.) To generate Java classes rather, change the `-l python` to `-l java`. Change the value to the `-o` option to the desired output location. ``` swagger-codegen generate -l python -o ./client -i https://raw.githubusercontent.com/ml4ai/automates-v2/master/docs/source/gromet_FN_v{CURRENT_VERSION}.yaml ``` 3. Once it executes, the client code will be generated at your specified location. For python, the classes will be located in `$OUTPUT_PATH/skema.gromet.fn.`. For java, they will be located in `$OUTPUT_PATH/src/main/java/io/swagger/client/model/` If generating GroMEt schema data model classes in SKEMA (AutoMATES), then after generating the above, follow the instructions here: ``` /automates/model_assembly/gromet/model/README.md ``` # noqa: E501 - OpenAPI spec version: 0.1.9 + OpenAPI spec version: 0.1.10 Contact: claytonm@arizona.edu Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/skema/gromet/fn/gromet_wire.py b/skema/gromet/fn/gromet_wire.py index 0d5f6ebef6a..ac1a00966de 100644 --- a/skema/gromet/fn/gromet_wire.py +++ b/skema/gromet/fn/gromet_wire.py @@ -3,9 +3,9 @@ """ Grounded Model Exchange (GroMEt) schema for Function Networks - This document defines the GroMEt Function Network data model. Note that Metadata is defined in separate spec. __Using Swagger to Generate Class Structure__ To automatically generate Python or Java models corresponding to this document, you can use [swagger-codegen](https://swagger.io/tools/swagger-codegen/). This can be used to generate the client code based off of this spec, and in the process this will generate the data model class structure. 1. Install via the method described for your operating system [here](https://github.com/swagger-api/swagger-codegen#Prerequisites). Make sure to install a version after 3.0 that will support openapi 3. 2. Run swagger-codegen with the options in the example below. The URL references where the yaml for this documentation is stored on github. Make sure to replace CURRENT_VERSION with the correct version. (The current version is `0.1.7`.) To generate Java classes rather, change the `-l python` to `-l java`. Change the value to the `-o` option to the desired output location. ``` swagger-codegen generate -l python -o ./client -i https://raw.githubusercontent.com/ml4ai/automates-v2/master/docs/source/gromet_FN_v{CURRENT_VERSION}.yaml ``` 3. Once it executes, the client code will be generated at your specified location. For python, the classes will be located in `$OUTPUT_PATH/swagger_client/models/`. For java, they will be located in `$OUTPUT_PATH/src/main/java/io/swagger/client/model/` If generating GroMEt schema data model classes in SKEMA (AutoMATES), then after generating the above, follow the instructions here: ``` /automates/model_assembly/gromet/model/README.md ``` # noqa: E501 + This document defines the GroMEt Function Network data model. Note that Metadata is defined in separate spec. __Using Swagger to Generate Class Structure__ To automatically generate Python or Java models corresponding to this document, you can use [swagger-codegen](https://swagger.io/tools/swagger-codegen/). This can be used to generate the client code based off of this spec, and in the process this will generate the data model class structure. 1. Install via the method described for your operating system [here](https://github.com/swagger-api/swagger-codegen#Prerequisites). Make sure to install a version after 3.0 that will support openapi 3. 2. Run swagger-codegen with the options in the example below. The URL references where the yaml for this documentation is stored on github. Make sure to replace CURRENT_VERSION with the correct version. (The current version is `0.1.7`.) To generate Java classes rather, change the `-l python` to `-l java`. Change the value to the `-o` option to the desired output location. ``` swagger-codegen generate -l python -o ./client -i https://raw.githubusercontent.com/ml4ai/automates-v2/master/docs/source/gromet_FN_v{CURRENT_VERSION}.yaml ``` 3. Once it executes, the client code will be generated at your specified location. For python, the classes will be located in `$OUTPUT_PATH/skema.gromet.fn.`. For java, they will be located in `$OUTPUT_PATH/src/main/java/io/swagger/client/model/` If generating GroMEt schema data model classes in SKEMA (AutoMATES), then after generating the above, follow the instructions here: ``` /automates/model_assembly/gromet/model/README.md ``` # noqa: E501 - OpenAPI spec version: 0.1.9 + OpenAPI spec version: 0.1.10 Contact: claytonm@arizona.edu Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/skema/gromet/fn/import_source_type.py b/skema/gromet/fn/import_source_type.py index 9074f46776c..aebae47f594 100644 --- a/skema/gromet/fn/import_source_type.py +++ b/skema/gromet/fn/import_source_type.py @@ -3,9 +3,9 @@ """ Grounded Model Exchange (GroMEt) schema for Function Networks - This document defines the GroMEt Function Network data model. Note that Metadata is defined in separate spec. __Using Swagger to Generate Class Structure__ To automatically generate Python or Java models corresponding to this document, you can use [swagger-codegen](https://swagger.io/tools/swagger-codegen/). This can be used to generate the client code based off of this spec, and in the process this will generate the data model class structure. 1. Install via the method described for your operating system [here](https://github.com/swagger-api/swagger-codegen#Prerequisites). Make sure to install a version after 3.0 that will support openapi 3. 2. Run swagger-codegen with the options in the example below. The URL references where the yaml for this documentation is stored on github. Make sure to replace CURRENT_VERSION with the correct version. (The current version is `0.1.7`.) To generate Java classes rather, change the `-l python` to `-l java`. Change the value to the `-o` option to the desired output location. ``` swagger-codegen generate -l python -o ./client -i https://raw.githubusercontent.com/ml4ai/automates-v2/master/docs/source/gromet_FN_v{CURRENT_VERSION}.yaml ``` 3. Once it executes, the client code will be generated at your specified location. For python, the classes will be located in `$OUTPUT_PATH/swagger_client/models/`. For java, they will be located in `$OUTPUT_PATH/src/main/java/io/swagger/client/model/` If generating GroMEt schema data model classes in SKEMA (AutoMATES), then after generating the above, follow the instructions here: ``` /automates/model_assembly/gromet/model/README.md ``` # noqa: E501 + This document defines the GroMEt Function Network data model. Note that Metadata is defined in separate spec. __Using Swagger to Generate Class Structure__ To automatically generate Python or Java models corresponding to this document, you can use [swagger-codegen](https://swagger.io/tools/swagger-codegen/). This can be used to generate the client code based off of this spec, and in the process this will generate the data model class structure. 1. Install via the method described for your operating system [here](https://github.com/swagger-api/swagger-codegen#Prerequisites). Make sure to install a version after 3.0 that will support openapi 3. 2. Run swagger-codegen with the options in the example below. The URL references where the yaml for this documentation is stored on github. Make sure to replace CURRENT_VERSION with the correct version. (The current version is `0.1.7`.) To generate Java classes rather, change the `-l python` to `-l java`. Change the value to the `-o` option to the desired output location. ``` swagger-codegen generate -l python -o ./client -i https://raw.githubusercontent.com/ml4ai/automates-v2/master/docs/source/gromet_FN_v{CURRENT_VERSION}.yaml ``` 3. Once it executes, the client code will be generated at your specified location. For python, the classes will be located in `$OUTPUT_PATH/skema.gromet.fn.`. For java, they will be located in `$OUTPUT_PATH/src/main/java/io/swagger/client/model/` If generating GroMEt schema data model classes in SKEMA (AutoMATES), then after generating the above, follow the instructions here: ``` /automates/model_assembly/gromet/model/README.md ``` # noqa: E501 - OpenAPI spec version: 0.1.9 + OpenAPI spec version: 0.1.10 Contact: claytonm@arizona.edu Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/skema/gromet/fn/import_type.py b/skema/gromet/fn/import_type.py index a22e05a8de0..78d05b36e0e 100644 --- a/skema/gromet/fn/import_type.py +++ b/skema/gromet/fn/import_type.py @@ -3,9 +3,9 @@ """ Grounded Model Exchange (GroMEt) schema for Function Networks - This document defines the GroMEt Function Network data model. Note that Metadata is defined in separate spec. __Using Swagger to Generate Class Structure__ To automatically generate Python or Java models corresponding to this document, you can use [swagger-codegen](https://swagger.io/tools/swagger-codegen/). This can be used to generate the client code based off of this spec, and in the process this will generate the data model class structure. 1. Install via the method described for your operating system [here](https://github.com/swagger-api/swagger-codegen#Prerequisites). Make sure to install a version after 3.0 that will support openapi 3. 2. Run swagger-codegen with the options in the example below. The URL references where the yaml for this documentation is stored on github. Make sure to replace CURRENT_VERSION with the correct version. (The current version is `0.1.7`.) To generate Java classes rather, change the `-l python` to `-l java`. Change the value to the `-o` option to the desired output location. ``` swagger-codegen generate -l python -o ./client -i https://raw.githubusercontent.com/ml4ai/automates-v2/master/docs/source/gromet_FN_v{CURRENT_VERSION}.yaml ``` 3. Once it executes, the client code will be generated at your specified location. For python, the classes will be located in `$OUTPUT_PATH/swagger_client/models/`. For java, they will be located in `$OUTPUT_PATH/src/main/java/io/swagger/client/model/` If generating GroMEt schema data model classes in SKEMA (AutoMATES), then after generating the above, follow the instructions here: ``` /automates/model_assembly/gromet/model/README.md ``` # noqa: E501 + This document defines the GroMEt Function Network data model. Note that Metadata is defined in separate spec. __Using Swagger to Generate Class Structure__ To automatically generate Python or Java models corresponding to this document, you can use [swagger-codegen](https://swagger.io/tools/swagger-codegen/). This can be used to generate the client code based off of this spec, and in the process this will generate the data model class structure. 1. Install via the method described for your operating system [here](https://github.com/swagger-api/swagger-codegen#Prerequisites). Make sure to install a version after 3.0 that will support openapi 3. 2. Run swagger-codegen with the options in the example below. The URL references where the yaml for this documentation is stored on github. Make sure to replace CURRENT_VERSION with the correct version. (The current version is `0.1.7`.) To generate Java classes rather, change the `-l python` to `-l java`. Change the value to the `-o` option to the desired output location. ``` swagger-codegen generate -l python -o ./client -i https://raw.githubusercontent.com/ml4ai/automates-v2/master/docs/source/gromet_FN_v{CURRENT_VERSION}.yaml ``` 3. Once it executes, the client code will be generated at your specified location. For python, the classes will be located in `$OUTPUT_PATH/skema.gromet.fn.`. For java, they will be located in `$OUTPUT_PATH/src/main/java/io/swagger/client/model/` If generating GroMEt schema data model classes in SKEMA (AutoMATES), then after generating the above, follow the instructions here: ``` /automates/model_assembly/gromet/model/README.md ``` # noqa: E501 - OpenAPI spec version: 0.1.9 + OpenAPI spec version: 0.1.10 Contact: claytonm@arizona.edu Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/skema/gromet/fn/literal_value.py b/skema/gromet/fn/literal_value.py index af29e3556e2..402e652d2a6 100644 --- a/skema/gromet/fn/literal_value.py +++ b/skema/gromet/fn/literal_value.py @@ -3,9 +3,9 @@ """ Grounded Model Exchange (GroMEt) schema for Function Networks - This document defines the GroMEt Function Network data model. Note that Metadata is defined in separate spec. __Using Swagger to Generate Class Structure__ To automatically generate Python or Java models corresponding to this document, you can use [swagger-codegen](https://swagger.io/tools/swagger-codegen/). This can be used to generate the client code based off of this spec, and in the process this will generate the data model class structure. 1. Install via the method described for your operating system [here](https://github.com/swagger-api/swagger-codegen#Prerequisites). Make sure to install a version after 3.0 that will support openapi 3. 2. Run swagger-codegen with the options in the example below. The URL references where the yaml for this documentation is stored on github. Make sure to replace CURRENT_VERSION with the correct version. (The current version is `0.1.7`.) To generate Java classes rather, change the `-l python` to `-l java`. Change the value to the `-o` option to the desired output location. ``` swagger-codegen generate -l python -o ./client -i https://raw.githubusercontent.com/ml4ai/automates-v2/master/docs/source/gromet_FN_v{CURRENT_VERSION}.yaml ``` 3. Once it executes, the client code will be generated at your specified location. For python, the classes will be located in `$OUTPUT_PATH/swagger_client/models/`. For java, they will be located in `$OUTPUT_PATH/src/main/java/io/swagger/client/model/` If generating GroMEt schema data model classes in SKEMA (AutoMATES), then after generating the above, follow the instructions here: ``` /automates/model_assembly/gromet/model/README.md ``` # noqa: E501 + This document defines the GroMEt Function Network data model. Note that Metadata is defined in separate spec. __Using Swagger to Generate Class Structure__ To automatically generate Python or Java models corresponding to this document, you can use [swagger-codegen](https://swagger.io/tools/swagger-codegen/). This can be used to generate the client code based off of this spec, and in the process this will generate the data model class structure. 1. Install via the method described for your operating system [here](https://github.com/swagger-api/swagger-codegen#Prerequisites). Make sure to install a version after 3.0 that will support openapi 3. 2. Run swagger-codegen with the options in the example below. The URL references where the yaml for this documentation is stored on github. Make sure to replace CURRENT_VERSION with the correct version. (The current version is `0.1.7`.) To generate Java classes rather, change the `-l python` to `-l java`. Change the value to the `-o` option to the desired output location. ``` swagger-codegen generate -l python -o ./client -i https://raw.githubusercontent.com/ml4ai/automates-v2/master/docs/source/gromet_FN_v{CURRENT_VERSION}.yaml ``` 3. Once it executes, the client code will be generated at your specified location. For python, the classes will be located in `$OUTPUT_PATH/skema.gromet.fn.`. For java, they will be located in `$OUTPUT_PATH/src/main/java/io/swagger/client/model/` If generating GroMEt schema data model classes in SKEMA (AutoMATES), then after generating the above, follow the instructions here: ``` /automates/model_assembly/gromet/model/README.md ``` # noqa: E501 - OpenAPI spec version: 0.1.9 + OpenAPI spec version: 0.1.10 Contact: claytonm@arizona.edu Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/skema/gromet/fn/metadata.py b/skema/gromet/fn/metadata.py new file mode 100644 index 00000000000..477a5157664 --- /dev/null +++ b/skema/gromet/fn/metadata.py @@ -0,0 +1,84 @@ +# coding: utf-8 + +""" + Grounded Model Exchange (GroMEt) schema for Function Networks + + This document defines the GroMEt Function Network data model. Note that Metadata is defined in separate spec. __Using Swagger to Generate Class Structure__ To automatically generate Python or Java models corresponding to this document, you can use [swagger-codegen](https://swagger.io/tools/swagger-codegen/). This can be used to generate the client code based off of this spec, and in the process this will generate the data model class structure. 1. Install via the method described for your operating system [here](https://github.com/swagger-api/swagger-codegen#Prerequisites). Make sure to install a version after 3.0 that will support openapi 3. 2. Run swagger-codegen with the options in the example below. The URL references where the yaml for this documentation is stored on github. Make sure to replace CURRENT_VERSION with the correct version. (The current version is `0.1.7`.) To generate Java classes rather, change the `-l python` to `-l java`. Change the value to the `-o` option to the desired output location. ``` swagger-codegen generate -l python -o ./client -i https://raw.githubusercontent.com/ml4ai/automates-v2/master/docs/source/gromet_FN_v{CURRENT_VERSION}.yaml ``` 3. Once it executes, the client code will be generated at your specified location. For python, the classes will be located in `$OUTPUT_PATH/skema.gromet.fn.`. For java, they will be located in `$OUTPUT_PATH/src/main/java/io/swagger/client/model/` If generating GroMEt schema data model classes in SKEMA (AutoMATES), then after generating the above, follow the instructions here: ``` /automates/model_assembly/gromet/model/README.md ``` # noqa: E501 + + OpenAPI spec version: 0.1.10 + Contact: claytonm@arizona.edu + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class Metadata(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + } + + attribute_map = { + } + + def __init__(self): # noqa: E501 + """Metadata - a model defined in Swagger""" # noqa: E501 + self.discriminator = None + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(Metadata, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Metadata): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/skema/gromet/fn/typed_value.py b/skema/gromet/fn/typed_value.py index edf23e5e878..9132dfa14bb 100644 --- a/skema/gromet/fn/typed_value.py +++ b/skema/gromet/fn/typed_value.py @@ -3,9 +3,9 @@ """ Grounded Model Exchange (GroMEt) schema for Function Networks - This document defines the GroMEt Function Network data model. Note that Metadata is defined in separate spec. __Using Swagger to Generate Class Structure__ To automatically generate Python or Java models corresponding to this document, you can use [swagger-codegen](https://swagger.io/tools/swagger-codegen/). This can be used to generate the client code based off of this spec, and in the process this will generate the data model class structure. 1. Install via the method described for your operating system [here](https://github.com/swagger-api/swagger-codegen#Prerequisites). Make sure to install a version after 3.0 that will support openapi 3. 2. Run swagger-codegen with the options in the example below. The URL references where the yaml for this documentation is stored on github. Make sure to replace CURRENT_VERSION with the correct version. (The current version is `0.1.7`.) To generate Java classes rather, change the `-l python` to `-l java`. Change the value to the `-o` option to the desired output location. ``` swagger-codegen generate -l python -o ./client -i https://raw.githubusercontent.com/ml4ai/automates-v2/master/docs/source/gromet_FN_v{CURRENT_VERSION}.yaml ``` 3. Once it executes, the client code will be generated at your specified location. For python, the classes will be located in `$OUTPUT_PATH/swagger_client/models/`. For java, they will be located in `$OUTPUT_PATH/src/main/java/io/swagger/client/model/` If generating GroMEt schema data model classes in SKEMA (AutoMATES), then after generating the above, follow the instructions here: ``` /automates/model_assembly/gromet/model/README.md ``` # noqa: E501 + This document defines the GroMEt Function Network data model. Note that Metadata is defined in separate spec. __Using Swagger to Generate Class Structure__ To automatically generate Python or Java models corresponding to this document, you can use [swagger-codegen](https://swagger.io/tools/swagger-codegen/). This can be used to generate the client code based off of this spec, and in the process this will generate the data model class structure. 1. Install via the method described for your operating system [here](https://github.com/swagger-api/swagger-codegen#Prerequisites). Make sure to install a version after 3.0 that will support openapi 3. 2. Run swagger-codegen with the options in the example below. The URL references where the yaml for this documentation is stored on github. Make sure to replace CURRENT_VERSION with the correct version. (The current version is `0.1.7`.) To generate Java classes rather, change the `-l python` to `-l java`. Change the value to the `-o` option to the desired output location. ``` swagger-codegen generate -l python -o ./client -i https://raw.githubusercontent.com/ml4ai/automates-v2/master/docs/source/gromet_FN_v{CURRENT_VERSION}.yaml ``` 3. Once it executes, the client code will be generated at your specified location. For python, the classes will be located in `$OUTPUT_PATH/skema.gromet.fn.`. For java, they will be located in `$OUTPUT_PATH/src/main/java/io/swagger/client/model/` If generating GroMEt schema data model classes in SKEMA (AutoMATES), then after generating the above, follow the instructions here: ``` /automates/model_assembly/gromet/model/README.md ``` # noqa: E501 - OpenAPI spec version: 0.1.9 + OpenAPI spec version: 0.1.10 Contact: claytonm@arizona.edu Generated by: https://github.com/swagger-api/swagger-codegen.git """ diff --git a/skema/program_analysis/easy_multi_file_ingester.py b/skema/program_analysis/easy_multi_file_ingester.py index 0a4791c9201..af15d85084e 100644 --- a/skema/program_analysis/easy_multi_file_ingester.py +++ b/skema/program_analysis/easy_multi_file_ingester.py @@ -7,19 +7,21 @@ from skema.gromet.fn import GrometFNModuleCollection from skema.skema_py.server import SUPPORTED_FILE_EXTENSIONS -def easy_process_file_system(system_name: str, root_path: str, write_to_file=False, original_source=False) -> GrometFNModuleCollection: +def easy_process_file_system(system_name: str, root_path: str, write_to_file=False, original_source=False, dependency_depth=0) -> GrometFNModuleCollection: """ Like process_file_system but doesn't require a system_filepaths.txt file. Returns a GrometFNModuleCollection. + Optionally, specify the dependency depth for analysis. Parameters: system_name (str): The name of the system to ingest. root_path (str): The relative or absolute path to the directory to ingest write_to_file (bool, optional): Whether or not to output Gromet to file. original_source (bool, optional): Whether or not to include original source code in output Gromet. + dependency_depth (int, optional): Specify the dependency depth for analysis. """ path_obj = Path(root_path).resolve() - # Create temporary system_filepaths file by recursivly itterating over all files in root path + # Create temporary system_filepaths file by recursively iterating over all files in root path file_paths = [] for extension in SUPPORTED_FILE_EXTENSIONS: file_paths.extend([str(file.relative_to(path_obj)) for file in path_obj.rglob(f"*{extension}")]) @@ -29,11 +31,9 @@ def easy_process_file_system(system_name: str, root_path: str, write_to_file=Fal tmp.write("\n".join(file_paths)) tmp.close() - gromet_collection = process_file_system( - system_name, root_path, tmp.name, write_to_file, original_source + system_name, str(path_obj), tmp.name, write_to_file, original_source, dependency_depth ) - # Delete temporary system_filepaths file os.unlink(tmp.name) @@ -54,5 +54,8 @@ def generate_statistics(): parser.add_argument( "--source", action="store_true", help="Toggle whether or not to include the full source code of the code in the GroMEt metadata" ) + parser.add_argument( + "--dependency_depth", type=int, default=0, help="Specify the dependency depth for analysis" + ) args = parser.parse_args() - easy_process_file_system(args.system_name, args.root_path, True, args.source) + easy_process_file_system(args.system_name, args.root_path, True, args.source, args.dependency_depth) diff --git a/skema/program_analysis/module_locate.py b/skema/program_analysis/module_locate.py new file mode 100644 index 00000000000..c9a43e9919d --- /dev/null +++ b/skema/program_analysis/module_locate.py @@ -0,0 +1,110 @@ +import argparse +import os +import pkg_resources +import requests +import importlib +import sys +import re +import subprocess +import tempfile +from pathlib import Path + +from skema.gromet.fn import TypedValue, ImportSourceType, GrometFNModuleDependencyReference + +IMPORT_PATTERN = re.compile(r'^\s*(from\s+[^\s]+\s+import\s+[^\s,]+(?:\s*,\s*[^\s,]+)*|import\s+[^\s,]+(?:\s*,\s*[^\s,]+)*)', re.MULTILINE) + +def identify_source_type(source: str): + if not source: + return "Unknown" + if "github" in source: + return "Repository" + elif source.startswith("http"): + return "Url" + return "Local" + + +def extract_imports(source: str): + output_references = [] + + import_statements = IMPORT_PATTERN.findall(source) + modules = set(tuple([statement.split()[1] for statement in import_statements])) + + for module in modules: + source_value = module_locate(module) + source_type = identify_source_type(source_value) + output_references.append( + GrometFNModuleDependencyReference( + name=module, + source_reference=TypedValue( + type=source_type, + value=source_value + ))) + + return output_references + +def module_locate(module_name: str) -> str: + """ + Locates the source of a Python module specified by the import statement. + If the module is built-in or installed, it returns the file path. + If the module is on PyPI with a GitHub link, it returns the GitHub URL. + For PyPI modules, it also attempts to return the tarball URL for the current version. + + :param module_name: The name of the module or submodule as a string. + :return: The module's file path, GitHub URL, or tarball URL. + """ + + # Attempt to find the module in the local environment + try: + module_obj = importlib.import_module(module_name) + module_file = getattr(module_obj, '__file__', None) + if module_file: + module_path = Path(module_file) + # Check if it's a package + if module_path.name == "__init__.py": + return str(module_path.parent) + return str(module_path) + except ImportError: + pass # If module is not found locally, proceed to check on PyPI + + # Fetch module info from PyPI + try: + pypi_url = f"https://pypi.org/pypi/{module_name}/json" + response = requests.get(pypi_url) + data = response.json() + + project_urls = data.get('info', {}).get('project_urls', {}) + github_url = project_urls.get('Source', '') or project_urls.get('Homepage', '') + if 'github.com' in github_url: + return github_url + + # Get the tarball URL for the current version + version = data['info']['version'] + releases = data['releases'].get(version, []) + for release in releases: + if release['filename'].endswith('.tar.gz'): + return release['url'] + except Exception as e: + # Handle errors related to network issues or JSON decoding + print(f"Error fetching module information from PyPI: {e}") + + return None + + +""" +# Basic tests +print(module_locate("import os")) +print(module_locate("import requests")) +print(module_locate("import xml.etree")) +print(module_locate("import minimal")) + +# PyDice tests +print(module_locate("import numpy as np")) +print(module_locate("import time")) +print(module_locate("from numba import njit,guvectorize,float64")) +print(module_locate("import scipy.optimize as opt")) +print(module_locate("from matplotlib import pyplot as plt")) +""" + + + + diff --git a/skema/program_analysis/multi_file_ingester.py b/skema/program_analysis/multi_file_ingester.py index 0d0929d820d..c0ab123529e 100644 --- a/skema/program_analysis/multi_file_ingester.py +++ b/skema/program_analysis/multi_file_ingester.py @@ -17,6 +17,7 @@ from skema.program_analysis.matlab2cast import matlab_to_cast from skema.utils.fold import dictionary_to_gromet_json, del_nulls from skema.program_analysis.tree_sitter_parsers.build_parsers import LANGUAGES_YAML_FILEPATH +from skema.program_analysis.module_locate import extract_imports def get_args(): parser = argparse.ArgumentParser() @@ -42,7 +43,7 @@ def get_args(): def process_file_system( - system_name, path, files, write_to_file=False, original_source=False + system_name, path, files, write_to_file=False, original_source=False, dependency_depth=0 ) -> GrometFNModuleCollection: root_dir = path.strip() file_list = open(files, "r").readlines() @@ -52,6 +53,7 @@ def process_file_system( name=system_name, modules=[], module_index=[], + module_dependencies=[], executables=[], ) @@ -60,6 +62,7 @@ def process_file_system( for f in file_list: full_file = os.path.join(os.path.normpath(root_dir), f.strip("\n")) full_file_obj = Path(full_file) + try: # To maintain backwards compatibility for the process_file_system function, for now we will determine the language by file extension if full_file_obj.suffix in language_yaml_obj["python"]["extensions"]: @@ -94,7 +97,7 @@ def process_file_system( # and then convert back into a string representing the full file file_text = "".join(open(full_file).readlines()) source_metadata[0].files[0].source_string = file_text - + # Then, after we generate the GroMEt we store it in the 'modules' field # and store its path in the 'module_index' field @@ -113,6 +116,10 @@ def process_file_system( module_collection.module_index.append(python_module_path) + # TODO: Check for duplicate modules across files + # TODO: Remove submodule if higher level module is included + module_collection.module_dependencies.extend(extract_imports(full_file_obj.read_text())) + # Done: Determine how we know a gromet goes in the 'executable' field # We do this by finding all user_defined top level functions in the Gromet # and check if the name 'main' is among them @@ -129,11 +136,64 @@ def process_file_system( module_collection.executables.append( len(module_collection.module_index) ) + except (Exception,SystemExit) as e: os.chdir(cur_dir) print(e) + def clean_dependencies(dependencies, system_name): + # Step 1: Remove duplicates and perform initial filtering in one step. + # This uses a dictionary to preserve insertion order (Python 3.7+ guaranteed order). + cleaned = { + dep.name: dep for dep in dependencies + if not dep.name.startswith(".") and dep.name != system_name + }.values() + + # Step 2: Sort by the number of dots in the name. + sorted_deps = sorted(cleaned, key=lambda dep: dep.name.count('.')) + + # Step 3: Remove submodules of other modules. + # This step keeps an entry if no other entry is its "parent" module. + final_deps = [ + dep for i, dep in enumerate(sorted_deps) + if not any(dep.name.startswith(other.name + ".") for other in sorted_deps[:i]) + ] + + return final_deps + + module_collection.module_dependencies = clean_dependencies(module_collection.module_dependencies, system_name) + + # NOTE: These cannot be imported at the top-level due to circular dependancies + from skema.program_analysis.single_file_ingester import process_file + from skema.program_analysis.easy_multi_file_ingester import easy_process_file_system + from skema.program_analysis.url_ingester import process_git_repo, process_archive + + if dependency_depth > 0: + to_add = [] + for index, dependency in enumerate(module_collection.module_dependencies): + + if dependency.source_reference.type == "Local": + if Path(dependency.source_reference.value).is_dir(): + dependency_gromet = easy_process_file_system(dependency.name, dependency.source_reference.value, False, False, dependency_depth=dependency_depth-1) + else: + dependency_gromet = process_file(dependency.source_reference.value, False, False, dependency_depth=dependency_depth-1) + elif dependency.source_reference.type == "Url": + dependency_gromet = process_archive(dependency.source_reference.value, False, False, dependency_depth=dependency_depth-1) + elif dependency.source_reference.type == "Repository": + dependency_gromet = process_git_repo(dependency.source_reference.value, None, False, False, dependency_depth=dependency_depth-1) + else: + continue + + # Flatten dependency gromet onto parent Gromet + for index in range(len(dependency_gromet.modules)): + dependency_gromet.modules[index].is_depenency = True + module_collection.modules.extend(dependency_gromet.modules) + module_collection.module_index.extend([f"{element} (dependency)" for element in dependency_gromet.module_index]) + to_add.extend(dependency_gromet.module_dependencies) + + module_collection.module_dependencies.extend(to_add) + if write_to_file: with open(f"{system_name}--Gromet-FN-auto.json", "w") as f: gromet_collection_dict = module_collection.to_dict() @@ -141,6 +201,7 @@ def process_file_system( dictionary_to_gromet_json(del_nulls(gromet_collection_dict)) ) + return module_collection diff --git a/skema/program_analysis/single_file_ingester.py b/skema/program_analysis/single_file_ingester.py index 595d718e005..47ddbed063d 100644 --- a/skema/program_analysis/single_file_ingester.py +++ b/skema/program_analysis/single_file_ingester.py @@ -7,10 +7,11 @@ from skema.gromet.fn import GrometFNModuleCollection -def process_file(path: str, write_to_file=False, original_source=False) -> GrometFNModuleCollection: +def process_file(path: str, write_to_file=False, original_source=False, dependency_depth=0) -> GrometFNModuleCollection: """Run a single Python or Fortran file through the CODE2FN pipeline and return the GrometFNModuleCollection. Optionally, output the Gromet JSON to a file. Optionally, include the entire original source code of the file in the GrometFNModuleCollection. + Optionally, specify the dependency depth for analysis. """ path_obj = Path(path) @@ -24,7 +25,7 @@ def process_file(path: str, write_to_file=False, original_source=False) -> Grome tmp.close() gromet_collection = process_file_system( - system_name, root_path, tmp.name, write_to_file, original_source + system_name, root_path, tmp.name, write_to_file, original_source, dependency_depth ) # Delete temporary system_filepaths file @@ -41,5 +42,8 @@ def process_file(path: str, write_to_file=False, original_source=False) -> Grome parser.add_argument( "--source", action="store_true", help="Toggle whether or not to include the full source code of the code in the GroMEt metadata" ) + parser.add_argument( + "--dependency_depth", type=int, default=0, help="Specify the dependency depth for analysis" + ) args = parser.parse_args() - process_file(args.path, True, args.source) + process_file(args.path, True, args.source, args.dependency_depth) diff --git a/skema/program_analysis/url_ingester.py b/skema/program_analysis/url_ingester.py index ffdf6e8576d..f7c12af6ee4 100644 --- a/skema/program_analysis/url_ingester.py +++ b/skema/program_analysis/url_ingester.py @@ -2,52 +2,69 @@ import tempfile import os import argparse +import requests +import tarfile from pathlib import Path from skema.gromet.fn import GrometFNModuleCollection from skema.program_analysis.easy_multi_file_ingester import easy_process_file_system -def process_git_repo(repo_url: str, checkout_ref=None, write_to_file=False, original_source=False) -> GrometFNModuleCollection: +def process_git_repo(repo_url: str, checkout_ref=None, write_to_file=False, original_source=False, dependency_depth=0) -> GrometFNModuleCollection: """ - Clones a Git repository to a temporary directory and ingests it into a GrometFNModuleCollection. - - Parameters: - repo_url (str): The URL of the Git repository. - checkout_ref (str, optional): The tag, commit, or branch to checkout after cloning. - write_to_file (bool, optional): Whether or not to output Gromet to file. - original_source (bool, optional): Whether or not to include original source code in output Gromet. + Clones a Git repository to a temporary directory and ingests it into a GrometFNModuleCollection with an optional dependency depth. """ - # Calculate the system name from the repo url system_name = Path(repo_url).stem - # Create a temporary directory with tempfile.TemporaryDirectory() as temp: - cloned_path = Path(temp) / Path(system_name) + cloned_path = Path(temp) / system_name try: - # Execute the git clone command - subprocess.check_call(['git', 'clone', repo_url], cwd=temp) + subprocess.check_call(['git', 'clone', repo_url, cloned_path.name], cwd=temp) if checkout_ref: - # Checkout the specified tag, commit, or branch - subprocess.check_call(['git', 'checkout', checkout_ref],cwd=cloned_path) + subprocess.check_call(['git', 'checkout', checkout_ref], cwd=cloned_path) except subprocess.CalledProcessError as e: - print(f"Failed to clone repositroy at {repo_url}. Exiting.") + print(f"Failed to clone repository at {repo_url}. Exiting.") exit() - gromet_collection = easy_process_file_system(system_name, str(cloned_path), write_to_file, original_source) + gromet_collection = easy_process_file_system(system_name, str(cloned_path), write_to_file, original_source, dependency_depth) return gromet_collection +def process_archive(archive_url: str, write_to_file: bool = False, original_source: bool = False, dependency_depth=0) -> GrometFNModuleCollection: + """ + Downloads a repository archive in tar format and ingests it into a GrometFNModuleCollection with an optional dependency depth. + """ + system_name = archive_url.split('/')[-1].replace('.tar.gz', '').replace('.tar', '') + + response = requests.get(archive_url) + + with tempfile.TemporaryDirectory() as temp: + temp_archive_path = Path(temp) / f"{system_name}.tar.gz" + temp_archive_path.write_bytes(response.content) + with tarfile.open(temp_archive_path, "r:*") as tar: + tar.extractall(path=temp) + + extracted_dir_path = Path(temp) / system_name + gromet_collection = easy_process_file_system(system_name, str(extracted_dir_path), write_to_file, original_source, dependency_depth) + + return gromet_collection def main(): - parser = argparse.ArgumentParser(description="Clone a Git repository into a temporary directory and optionally check out a specific ref.") - parser.add_argument("repo_url", help="The URL of the Git repository to clone.") - parser.add_argument("--ref", help="The tag, commit, or branch to checkout after cloning.", default=None) - parser.add_argument( - "--source", action="store_true", help="Toggle whether or not to include the full source code of the code in the GroMEt metadata" - ) + parser = argparse.ArgumentParser(description="Process a Git repository or a tar archive into a GrometFNModuleCollection.") + parser.add_argument("--mode", choices=['git', 'tar'], required=True, help="The mode of operation: 'git' for Git repositories, 'tar' for tar archives.") + parser.add_argument("url", help="The URL of the Git repository or tar archive to process.") + parser.add_argument("--ref", help="The tag, commit, or branch to checkout after cloning (Git mode only).", default=None) + parser.add_argument("--write_to_file", action="store_true", help="Whether to output Gromet to file.") + parser.add_argument("--source", action="store_true", help="Toggle whether or not to include the full source code in the Gromet metadata.") + parser.add_argument("--dependency_depth", type=int, default=0, help="Specify the dependency depth for analysis") + args = parser.parse_args() - process_git_repo(args.repo_url, args.ref, True, args.source) + if args.mode == 'git': + process_git_repo(args.url, args.ref, args.write_to_file, args.source, args.dependency_depth) + elif args.mode == 'tar': + process_archive(args.url, args.write_to_file, args.source, args.dependency_depth) + else: + print("Invalid mode selected. Please choose either 'git' or 'tar'.") if __name__ == "__main__": - main() \ No newline at end of file + main() diff --git a/skema/skema_py/server.py b/skema/skema_py/server.py index a840e2b32d1..5a5cd15b804 100644 --- a/skema/skema_py/server.py +++ b/skema/skema_py/server.py @@ -109,7 +109,16 @@ class System(BaseModel): } }], ) - + dependency_depth: Optional[int] = Field( + default=0, + ge=0, + le=1, + description="The depth at which to ingest dependencies into Gromet. i.e. 0=Ingest no dependencies, 1=Ingest system dependencies. Accepted values: [0,1]", + examples = [ + 1 + ] + ) + class MML_System(BaseModel): """ @@ -222,6 +231,7 @@ async def system_to_gromet(system: System): system.system_name or "", str(Path(tmp_path, system.root_name or "")), str(system_filepaths), + dependency_depth=system.dependency_depth ) # Attempt to enrich the system with comments. May return the same system if Rust isn't insalled. @@ -321,7 +331,6 @@ async def fn_given_filepaths(system: System): response = requests.post("http://0.0.0.0:8000/fn-given-filepaths", json=system) gromet_json = response.json() """ - return await system_to_gromet(system) diff --git a/skema/skema_py/tests/test_server.py b/skema/skema_py/tests/test_server.py index 5c807085b65..14fb887161a 100644 --- a/skema/skema_py/tests/test_server.py +++ b/skema/skema_py/tests/test_server.py @@ -185,6 +185,52 @@ def test_hidden_files(): assert gromet_collection["metadata_collection"][0][0]["gromet_type"] == "Debug" assert gromet_collection["metadata_collection"][0][0]["severity"] == "ERROR" +def test_dependency_depth(): + system = { + "files": ["dependency.py"], + "blobs": [ + "import minimal" + ], + "dependency_depth": 1 + } + + response = client.post("/code2fn/fn-given-filepaths", json=system) + gromet_collection = response.json() + assert response.status_code == 200 + assert len(gromet_collection["module_dependencies"]) > 1 + + +def test_dependency_depth_missing(): + system = { + "files": ["dependency.py"], + "blobs": [ + "import minimal" + ], + } + + response = client.post("/code2fn/fn-given-filepaths", json=system) + gromet_collection = response.json() + assert response.status_code == 200 + assert len(gromet_collection["module_dependencies"]) == 1 + + +def test_dependency_depth_invalid(): + system = { + "files": ["dependency.py"], + "blobs": [ + "import minimal" + ], + "dependency_depth": -1 + } + + response = client.post("/code2fn/fn-given-filepaths", json=system) + gromet_collection = response.json() + assert response.status_code == 422 + + system["dependency_depth"] = 5 + response = client.post("/code2fn/fn-given-filepaths", json=system) + gromet_collection = response.json() + assert response.status_code == 422 def test_gromet_object_count(): """Test case for get-object-count endpoint"""