pyfcstm 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyfcstm/__init__.py +0 -0
- pyfcstm/__main__.py +4 -0
- pyfcstm/config/__init__.py +0 -0
- pyfcstm/config/meta.py +20 -0
- pyfcstm/dsl/__init__.py +6 -0
- pyfcstm/dsl/error.py +226 -0
- pyfcstm/dsl/grammar/Grammar.g4 +190 -0
- pyfcstm/dsl/grammar/Grammar.interp +168 -0
- pyfcstm/dsl/grammar/Grammar.tokens +118 -0
- pyfcstm/dsl/grammar/GrammarLexer.interp +214 -0
- pyfcstm/dsl/grammar/GrammarLexer.py +523 -0
- pyfcstm/dsl/grammar/GrammarLexer.tokens +118 -0
- pyfcstm/dsl/grammar/GrammarListener.py +521 -0
- pyfcstm/dsl/grammar/GrammarParser.py +4373 -0
- pyfcstm/dsl/grammar/__init__.py +3 -0
- pyfcstm/dsl/listener.py +440 -0
- pyfcstm/dsl/node.py +1581 -0
- pyfcstm/dsl/parse.py +155 -0
- pyfcstm/entry/__init__.py +1 -0
- pyfcstm/entry/base.py +126 -0
- pyfcstm/entry/cli.py +12 -0
- pyfcstm/entry/dispatch.py +46 -0
- pyfcstm/entry/generate.py +83 -0
- pyfcstm/entry/plantuml.py +67 -0
- pyfcstm/model/__init__.py +3 -0
- pyfcstm/model/base.py +51 -0
- pyfcstm/model/expr.py +764 -0
- pyfcstm/model/model.py +1392 -0
- pyfcstm/render/__init__.py +3 -0
- pyfcstm/render/env.py +36 -0
- pyfcstm/render/expr.py +180 -0
- pyfcstm/render/func.py +77 -0
- pyfcstm/render/render.py +279 -0
- pyfcstm/utils/__init__.py +6 -0
- pyfcstm/utils/binary.py +38 -0
- pyfcstm/utils/doc.py +64 -0
- pyfcstm/utils/jinja2.py +121 -0
- pyfcstm/utils/json.py +125 -0
- pyfcstm/utils/text.py +91 -0
- pyfcstm/utils/validate.py +102 -0
- pyfcstm-0.0.1.dist-info/LICENSE +165 -0
- pyfcstm-0.0.1.dist-info/METADATA +205 -0
- pyfcstm-0.0.1.dist-info/RECORD +46 -0
- pyfcstm-0.0.1.dist-info/WHEEL +5 -0
- pyfcstm-0.0.1.dist-info/entry_points.txt +2 -0
- pyfcstm-0.0.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,205 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: pyfcstm
|
3
|
+
Version: 0.0.1
|
4
|
+
Summary: A Python framework for parsing finite state machine DSL and generating executable code in multiple target languages.
|
5
|
+
Home-page: https://github.com/hansbug/pyfcstm
|
6
|
+
Author: HansBug
|
7
|
+
Author-email: hansbug@buaa.edu.cn
|
8
|
+
License: Apache License, Version 2.0
|
9
|
+
Project-URL: Homepage, https://github.com/hansbug/pyfcstm
|
10
|
+
Project-URL: Documentation, https://hansbug.github.io/pyfcstm/
|
11
|
+
Project-URL: Source, https://github.com/hansbug/pyfcstm
|
12
|
+
Project-URL: Download, https://pypi.org/project/pyfcstm/#files
|
13
|
+
Project-URL: Bug Reports, https://github.com/hansbug/pyfcstm/issues
|
14
|
+
Project-URL: Contributing, https://github.com/hansbug/pyfcstm/blob/main/CONTRIBUTING.md
|
15
|
+
Project-URL: Pull Requests, https://github.com/hansbug/pyfcstm/pulls
|
16
|
+
Project-URL: CI, https://github.com/hansbug/pyfcstm/actions
|
17
|
+
Project-URL: Coverage, https://codecov.io/gh/hansbug/pyfcstm
|
18
|
+
Project-URL: Wiki, https://github.com/hansbug/pyfcstm/wiki
|
19
|
+
Project-URL: License, https://github.com/hansbug/pyfcstm/blob/main/LICENSE
|
20
|
+
Keywords: huggingface,download,upload,batch processing,data processing,machine learning,ai
|
21
|
+
Classifier: Development Status :: 5 - Production/Stable
|
22
|
+
Classifier: Intended Audience :: Developers
|
23
|
+
Classifier: Intended Audience :: Science/Research
|
24
|
+
Classifier: Intended Audience :: Information Technology
|
25
|
+
Classifier: License :: OSI Approved :: MIT License
|
26
|
+
Classifier: Programming Language :: Python
|
27
|
+
Classifier: Programming Language :: Python :: 3
|
28
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
29
|
+
Classifier: Programming Language :: Python :: 3.8
|
30
|
+
Classifier: Programming Language :: Python :: 3.9
|
31
|
+
Classifier: Programming Language :: Python :: 3.10
|
32
|
+
Classifier: Programming Language :: Python :: 3.11
|
33
|
+
Classifier: Programming Language :: Python :: 3.12
|
34
|
+
Classifier: Programming Language :: Python :: 3.13
|
35
|
+
Classifier: Operating System :: OS Independent
|
36
|
+
Classifier: Operating System :: POSIX
|
37
|
+
Classifier: Operating System :: Microsoft :: Windows
|
38
|
+
Classifier: Operating System :: MacOS
|
39
|
+
Classifier: Topic :: Scientific/Engineering
|
40
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
41
|
+
Classifier: Topic :: Software Development :: Libraries
|
42
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
43
|
+
Classifier: Topic :: Internet :: File Transfer Protocol (FTP)
|
44
|
+
Classifier: Topic :: Utilities
|
45
|
+
Classifier: Typing :: Typed
|
46
|
+
Classifier: Natural Language :: English
|
47
|
+
Requires-Python: >=3.7
|
48
|
+
Description-Content-Type: text/markdown
|
49
|
+
License-File: LICENSE
|
50
|
+
Requires-Dist: hbutils
|
51
|
+
Requires-Dist: natsort
|
52
|
+
Requires-Dist: cachetools
|
53
|
+
Requires-Dist: pyyaml
|
54
|
+
Requires-Dist: antlr4-python3-runtime ==4.9.3
|
55
|
+
Requires-Dist: jinja2 >=3
|
56
|
+
Requires-Dist: unidecode
|
57
|
+
Requires-Dist: pathspec
|
58
|
+
Requires-Dist: click >=8
|
59
|
+
Provides-Extra: build
|
60
|
+
Requires-Dist: pyinstaller >=4.7 ; extra == 'build'
|
61
|
+
Requires-Dist: setuptools ; extra == 'build'
|
62
|
+
Requires-Dist: hbutils ; extra == 'build'
|
63
|
+
Provides-Extra: dev
|
64
|
+
Requires-Dist: ruff ; extra == 'dev'
|
65
|
+
Requires-Dist: antlr4-python3-runtime ==4.9.3 ; extra == 'dev'
|
66
|
+
Provides-Extra: doc
|
67
|
+
Requires-Dist: Jinja2 >=3.0.0 ; extra == 'doc'
|
68
|
+
Requires-Dist: sphinx >=3.2.0 ; extra == 'doc'
|
69
|
+
Requires-Dist: sphinx-rtd-theme >=0.4.3 ; extra == 'doc'
|
70
|
+
Requires-Dist: enum-tools >=0.9.0 ; extra == 'doc'
|
71
|
+
Requires-Dist: sphinx-toolbox ; extra == 'doc'
|
72
|
+
Requires-Dist: plantumlcli >=0.0.2 ; extra == 'doc'
|
73
|
+
Requires-Dist: packaging ; extra == 'doc'
|
74
|
+
Requires-Dist: sphinx-multiversion >=0.2.4 ; extra == 'doc'
|
75
|
+
Requires-Dist: where >=1.0.2 ; extra == 'doc'
|
76
|
+
Requires-Dist: easydict <2,>=1.7 ; extra == 'doc'
|
77
|
+
Requires-Dist: responses >=0.20.0 ; extra == 'doc'
|
78
|
+
Requires-Dist: natsort ; extra == 'doc'
|
79
|
+
Requires-Dist: nbsphinx >=0.8.8 ; extra == 'doc'
|
80
|
+
Requires-Dist: ipython >=7.16.3 ; extra == 'doc'
|
81
|
+
Requires-Dist: psutil >=5.8.0 ; extra == 'doc'
|
82
|
+
Requires-Dist: ipykernel >=6.15 ; extra == 'doc'
|
83
|
+
Requires-Dist: py-cpuinfo >=8.0.0 ; extra == 'doc'
|
84
|
+
Requires-Dist: click >=7.0.0 ; extra == 'doc'
|
85
|
+
Requires-Dist: pandas ; extra == 'doc'
|
86
|
+
Provides-Extra: test
|
87
|
+
Requires-Dist: coverage >=5 ; extra == 'test'
|
88
|
+
Requires-Dist: mock >=4.0.3 ; extra == 'test'
|
89
|
+
Requires-Dist: flake8 >=3.5 ; extra == 'test'
|
90
|
+
Requires-Dist: testfixtures >=6.18.5 ; extra == 'test'
|
91
|
+
Requires-Dist: pytest >=6.2.5 ; extra == 'test'
|
92
|
+
Requires-Dist: pytest-cov >=3.0.0 ; extra == 'test'
|
93
|
+
Requires-Dist: pytest-mock >=3.6.1 ; extra == 'test'
|
94
|
+
Requires-Dist: pytest-xdist >=1.34.0 ; extra == 'test'
|
95
|
+
Requires-Dist: pytest-rerunfailures >=10.2 ; extra == 'test'
|
96
|
+
Requires-Dist: pytest-timeout >=2.0.2 ; extra == 'test'
|
97
|
+
Requires-Dist: pytest-benchmark >=3.4.0 ; extra == 'test'
|
98
|
+
Requires-Dist: easydict <2,>=1.7 ; extra == 'test'
|
99
|
+
Requires-Dist: testtools >=2 ; extra == 'test'
|
100
|
+
Requires-Dist: where >=1.0.2 ; extra == 'test'
|
101
|
+
Requires-Dist: natsort ; extra == 'test'
|
102
|
+
|
103
|
+
# pyfcstm
|
104
|
+
|
105
|
+
[](https://pypi.org/project/pyfcstm/)
|
106
|
+

|
107
|
+

|
108
|
+

|
109
|
+
|
110
|
+

|
111
|
+

|
112
|
+
[](https://codeclimate.com/github/HansBug/pyfcstm/maintainability)
|
113
|
+
[](https://codecov.io/gh/hansbug/pyfcstm)
|
114
|
+
|
115
|
+
[](https://github.com/hansbug/pyfcstm/actions?query=workflow%3A%22Docs+Deploy%22)
|
116
|
+
[](https://github.com/hansbug/pyfcstm/actions?query=workflow%3A%22Code+Test%22)
|
117
|
+
[](https://github.com/hansbug/pyfcstm/actions?query=workflow%3A%22Badge+Creation%22)
|
118
|
+
[](https://github.com/hansbug/pyfcstm/actions?query=workflow%3A%22Package+Release%22)
|
119
|
+
|
120
|
+
[](https://github.com/hansbug/pyfcstm/stargazers)
|
121
|
+
[](https://github.com/hansbug/pyfcstm/network)
|
122
|
+

|
123
|
+
[](https://github.com/hansbug/pyfcstm/issues)
|
124
|
+
[](https://github.com/hansbug/pyfcstm/pulls)
|
125
|
+
[](https://github.com/hansbug/pyfcstm/graphs/contributors)
|
126
|
+
[](https://github.com/hansbug/pyfcstm/blob/master/LICENSE)
|
127
|
+
|
128
|
+
A Python framework for parsing finite state machine DSL and generating executable code in multiple target languages.
|
129
|
+
|
130
|
+
```python
|
131
|
+
from pyfcstm.dsl import parse_with_grammar_entry
|
132
|
+
from pyfcstm.model.model import parse_dsl_node_to_state_machine
|
133
|
+
from pyfcstm.render import StateMachineCodeRenderer
|
134
|
+
|
135
|
+
if __name__ == '__main__':
|
136
|
+
ast_node = parse_with_grammar_entry("""
|
137
|
+
def int a = 0;
|
138
|
+
def int b = 0x0;
|
139
|
+
def int round_count = 0; // define variables
|
140
|
+
state TrafficLight {
|
141
|
+
state InService {
|
142
|
+
enter {
|
143
|
+
a = 0;
|
144
|
+
b = 0;
|
145
|
+
round_count = 0;
|
146
|
+
}
|
147
|
+
|
148
|
+
enter abstract InServiceAbstractEnter /*
|
149
|
+
Abstract Operation When Entering State 'InService'
|
150
|
+
TODO: Should be Implemented In Generated Code Framework
|
151
|
+
*/
|
152
|
+
|
153
|
+
// for non-leaf state, either 'before' or 'after' aspect keyword should be used for during block
|
154
|
+
during before abstract InServiceBeforeEnterChild /*
|
155
|
+
Abstract Operation Before Entering Child States of State 'InService'
|
156
|
+
TODO: Should be Implemented In Generated Code Framework
|
157
|
+
*/
|
158
|
+
|
159
|
+
during after abstract InServiceAfterEnterChild /*
|
160
|
+
Abstract Operation After Entering Child States of State 'InService'
|
161
|
+
TODO: Should be Implemented In Generated Code Framework
|
162
|
+
*/
|
163
|
+
|
164
|
+
exit abstract InServiceAbstractExit /*
|
165
|
+
Abstract Operation When Leaving State 'InService'
|
166
|
+
TODO: Should be Implemented In Generated Code Framework
|
167
|
+
*/
|
168
|
+
|
169
|
+
state Red {
|
170
|
+
during { // no aspect keywords ('before', 'after') should be used for during block of leaf state
|
171
|
+
a = 0x1 << 2;
|
172
|
+
}
|
173
|
+
}
|
174
|
+
state Yellow;
|
175
|
+
state Green;
|
176
|
+
[*] -> Red :: Start effect {
|
177
|
+
b = 0x1;
|
178
|
+
};
|
179
|
+
Red -> Green effect {
|
180
|
+
b = 0x3;
|
181
|
+
};
|
182
|
+
Green -> Yellow effect {
|
183
|
+
b = 0x2;
|
184
|
+
};
|
185
|
+
Yellow -> Red : if [a >= 10] effect {
|
186
|
+
b = 0x1;
|
187
|
+
round_count = round_count + 1;
|
188
|
+
};
|
189
|
+
}
|
190
|
+
state Idle;
|
191
|
+
|
192
|
+
[*] -> InService;
|
193
|
+
InService -> Idle :: Maintain;
|
194
|
+
Idle -> [*];
|
195
|
+
}
|
196
|
+
""", entry_name='state_machine_dsl')
|
197
|
+
model = parse_dsl_node_to_state_machine(ast_node)
|
198
|
+
|
199
|
+
renderer = StateMachineCodeRenderer(
|
200
|
+
# template_dir='test_template',
|
201
|
+
template_dir='../fsm_generation_template'
|
202
|
+
)
|
203
|
+
renderer.render(model, 'test_output_x')
|
204
|
+
|
205
|
+
```
|
@@ -0,0 +1,46 @@
|
|
1
|
+
pyfcstm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
+
pyfcstm/__main__.py,sha256=rqAJpNJgf8R-OZnKecjYyCrK_hJcQhHaO0UL6Vb92-8,75
|
3
|
+
pyfcstm/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
|
+
pyfcstm/config/meta.py,sha256=EoP3nTEy-YXDjAFCroCE3FPRygrCLbja0bwPliRa_cQ,534
|
5
|
+
pyfcstm/dsl/__init__.py,sha256=3GMEILDRArhkjz0vQPHOk_eiby74H94TOa3o-Tpo4x0,349
|
6
|
+
pyfcstm/dsl/error.py,sha256=BEaroPj98Q8J12IT73rfPeb9y0TXjPG6llDo5GiqRIU,8878
|
7
|
+
pyfcstm/dsl/listener.py,sha256=9J8QETMu40HxT20ZOJ4c9QWY7X_Y6AbEgkzoD-xTAg4,19633
|
8
|
+
pyfcstm/dsl/node.py,sha256=fODmIoPqHBGL3zRJCBQ20CtJFWIcEMMmiqptb-AOC_w,43489
|
9
|
+
pyfcstm/dsl/parse.py,sha256=Pylxw1DfZTZIRMYUlnsukMnUNRGuG7ssHZMKUOvZkD0,4631
|
10
|
+
pyfcstm/dsl/grammar/Grammar.g4,sha256=mRz2U3hNOErU2WmgAcx8yIjRzDCeDw96fuXGRxfZORE,7827
|
11
|
+
pyfcstm/dsl/grammar/Grammar.interp,sha256=WBj9wxHgJ-mI6j5reU7Pi9afwwTAz1Ny43HqQ04OA9I,20226
|
12
|
+
pyfcstm/dsl/grammar/Grammar.tokens,sha256=7cz_jF-lJe0vAuXdGqI0lRXH_dsP-1Hqe7APdWavpO4,1023
|
13
|
+
pyfcstm/dsl/grammar/GrammarLexer.interp,sha256=eLSpnsq0jdZazD_FMf8_KgTZZCKWbhml0koL-senp1U,21720
|
14
|
+
pyfcstm/dsl/grammar/GrammarLexer.py,sha256=YBjYBOi6I0BA8my1IvS0Kt4uwIpWZ4Q0Q1zSprT0Uxg,25608
|
15
|
+
pyfcstm/dsl/grammar/GrammarLexer.tokens,sha256=7cz_jF-lJe0vAuXdGqI0lRXH_dsP-1Hqe7APdWavpO4,1023
|
16
|
+
pyfcstm/dsl/grammar/GrammarListener.py,sha256=ehskzANLn1EsPHoGJsjvGO1rEH0hHmOLueeTNZ2OfjQ,19345
|
17
|
+
pyfcstm/dsl/grammar/GrammarParser.py,sha256=w8hbBCwScL828beoKsPhHnzTZSNtqYLeexgxv_qMhL4,175305
|
18
|
+
pyfcstm/dsl/grammar/__init__.py,sha256=24npTN-wJ_1WL4qR6f6JIIaXDkhs6gn0fbW3R_-FVDw,125
|
19
|
+
pyfcstm/entry/__init__.py,sha256=3dO1hloAnUm_Sctxk_ERdaiqCF-ie8lijVjtXb-YE8g,35
|
20
|
+
pyfcstm/entry/base.py,sha256=SC1UthaKaoXIWilU-pNLjpQZ9PWm8I1UYDBg2VSU8cM,3334
|
21
|
+
pyfcstm/entry/cli.py,sha256=crBHD8yK16vkiyVDTG1zM6TCIfCs_Bu_nVoeGpQWpA0,269
|
22
|
+
pyfcstm/entry/dispatch.py,sha256=LMXy8aNyvrY_ianK2FgKbRiZ7GjO3I9me2_c5gtX0qI,1868
|
23
|
+
pyfcstm/entry/generate.py,sha256=gK8pB7okwRjTWquVm1HqMYXVJY_DkDEHxv6f6Kh7u3Y,3185
|
24
|
+
pyfcstm/entry/plantuml.py,sha256=i07Fc-jxyVGA3_kOjhBllEbsQ652OWVvoK9WUGKzwns,2620
|
25
|
+
pyfcstm/model/__init__.py,sha256=aJ76DOX21iXRJN2xwsH7CiEG7iPkpDJMXKvEh9Xb9Q4,93
|
26
|
+
pyfcstm/model/base.py,sha256=3H6Sf9uTfAZUNemSmR4L1aoSICG42EcrVncgQDZNAXY,1761
|
27
|
+
pyfcstm/model/expr.py,sha256=X3eyOYMeZ66LdD0ZpwDjDRQUQrkpXtpSWLY9TILFzSI,18908
|
28
|
+
pyfcstm/model/model.py,sha256=fiZ69V3CGUBbCxV4gkRrWECTOsXaJ9Ful3adHlIv8tk,56066
|
29
|
+
pyfcstm/render/__init__.py,sha256=Bettq3kIoswqSZQSxjQciMrmRZqkn5noaKoQO9d8Jlw,153
|
30
|
+
pyfcstm/render/env.py,sha256=pjZnlvYLL8sA9lZupKtIHijrHOiAWBeBU_ytNYLxz1w,1106
|
31
|
+
pyfcstm/render/expr.py,sha256=sT7uazQuEFrAFHBSTV0FviubNIYP-CTjhNhd4dO96Fo,7551
|
32
|
+
pyfcstm/render/func.py,sha256=FZlQiKxKpOomH83FDqYYoeeclXlmm07zHYJk8MN5Cws,2663
|
33
|
+
pyfcstm/render/render.py,sha256=QhVcwcNfeAH9Ioh59sW3JyoDt4cWG2SndMeW9PMoNbc,11531
|
34
|
+
pyfcstm/utils/__init__.py,sha256=1gp84WrUSTmiAEzxpcek0RvlWyDLJVee9wcq4PcdxxA,282
|
35
|
+
pyfcstm/utils/binary.py,sha256=6AnX6Hx4JFRHl0Y1A6OJ1b_1-QtzaajEywp0h-a4kbs,1196
|
36
|
+
pyfcstm/utils/doc.py,sha256=CNGQoxTl33KEAnEXl_sr4I97zNARaAa2IwKKt5IC1MA,1905
|
37
|
+
pyfcstm/utils/jinja2.py,sha256=9lJFnsxfzTfc9Wj1twhk3e6aFgRzBW-mbhdOVudNcKw,4321
|
38
|
+
pyfcstm/utils/json.py,sha256=WPubB5ObTNT8eEyGV3DcgFE8BuYxJUO8xYPx5_kvvCQ,3732
|
39
|
+
pyfcstm/utils/text.py,sha256=wb4vIWB3mLne1R64x_MIS5qsIlGQ6cGCUVcbPlV21Hw,2895
|
40
|
+
pyfcstm/utils/validate.py,sha256=87k1B-gzYd-mZP2N5-nsC8OeLZsfNTOCjp_5LUgsaxw,3129
|
41
|
+
pyfcstm-0.0.1.dist-info/LICENSE,sha256=pWgb-bBdsU2Gd2kwAXxketnm5W_2u8_fIeWEgojfrxs,7651
|
42
|
+
pyfcstm-0.0.1.dist-info/METADATA,sha256=qhTaf4e0f77jUkSZhaEkzLZP9FM55dPAlSzJAwc1hBc,9816
|
43
|
+
pyfcstm-0.0.1.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
|
44
|
+
pyfcstm-0.0.1.dist-info/entry_points.txt,sha256=Jh9a4hY-nMh5VTiuIBiZcM403biCHOwXk5hKNBr3Eok,53
|
45
|
+
pyfcstm-0.0.1.dist-info/top_level.txt,sha256=0VZTj6MqIhOSyoQLYUk1inV0P34VgetNZIKrzj-HNqo,8
|
46
|
+
pyfcstm-0.0.1.dist-info/RECORD,,
|
@@ -0,0 +1 @@
|
|
1
|
+
pyfcstm
|