cff1acb028a442105c7a88da1c72d65ee9945c3b
[dcaegen2/platform.git] / adapter / acumos / tests / fixtures / models / example-model-listofm / example_model.py
1 # ============LICENSE_START====================================================\r
2 # org.onap.dcae\r
3 # =============================================================================\r
4 # Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.\r
5 # =============================================================================\r
6 # Licensed under the Apache License, Version 2.0 (the "License");\r
7 # you may not use this file except in compliance with the License.\r
8 # You may obtain a copy of the License at\r
9 #\r
10 #      http://www.apache.org/licenses/LICENSE-2.0\r
11 #\r
12 # Unless required by applicable law or agreed to in writing, software\r
13 # distributed under the License is distributed on an "AS IS" BASIS,\r
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
15 # See the License for the specific language governing permissions and\r
16 # limitations under the License.\r
17 # ============LICENSE_END======================================================\r
18 \r
19 from acumos.session import AcumosSession\r
20 from acumos.modeling import Model, List, NamedTuple\r
21 \r
22 \r
23 class Args(NamedTuple):\r
24     x: int\r
25     y: int\r
26 \r
27 \r
28 class ArgsList(NamedTuple):\r
29     args: List[Args]\r
30 \r
31 \r
32 def sum(args: ArgsList) -> List[int]:\r
33     return [arg.x + arg.y for arg in args]\r
34 \r
35 \r
36 if __name__ == '__main__':\r
37     '''Main'''\r
38     model = Model(sum=sum)\r
39 \r
40     session = AcumosSession()\r
41     session.dump(model, 'example-model', '.')\r