dfpyre 0.7.11__py3-none-any.whl → 0.7.12__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.
Potentially problematic release.
This version of dfpyre might be problematic. Click here for more details.
- dfpyre/pyre.py +2 -2
- dfpyre/scriptgen.py +21 -1
- {dfpyre-0.7.11.dist-info → dfpyre-0.7.12.dist-info}/METADATA +1 -1
- {dfpyre-0.7.11.dist-info → dfpyre-0.7.12.dist-info}/RECORD +6 -6
- {dfpyre-0.7.11.dist-info → dfpyre-0.7.12.dist-info}/LICENSE +0 -0
- {dfpyre-0.7.11.dist-info → dfpyre-0.7.12.dist-info}/WHEEL +0 -0
dfpyre/pyre.py
CHANGED
|
@@ -111,10 +111,10 @@ def _warn_unrecognized_name(codeblock_type: str, codeblock_name: str):
|
|
|
111
111
|
|
|
112
112
|
def _add_inverted(data, inverted):
|
|
113
113
|
"""
|
|
114
|
-
If inverted is true, add '
|
|
114
|
+
If inverted is true, add 'attribute': 'NOT' to data.
|
|
115
115
|
"""
|
|
116
116
|
if inverted:
|
|
117
|
-
data['
|
|
117
|
+
data['attribute'] = 'NOT'
|
|
118
118
|
|
|
119
119
|
|
|
120
120
|
def _convert_args(args):
|
dfpyre/scriptgen.py
CHANGED
|
@@ -3,6 +3,7 @@ import re
|
|
|
3
3
|
from dfpyre.items import *
|
|
4
4
|
from dfpyre.actiondump import get_default_tags
|
|
5
5
|
|
|
6
|
+
|
|
6
7
|
SCRIPT_START = '''from dfpyre import *
|
|
7
8
|
|
|
8
9
|
t = DFTemplate()
|
|
@@ -127,11 +128,11 @@ def add_script_line(flags: GeneratorFlags, script_lines: list[str], indent_level
|
|
|
127
128
|
script_lines.append(added_line)
|
|
128
129
|
|
|
129
130
|
|
|
130
|
-
# TODO: add tag values if not default
|
|
131
131
|
def generate_script(template, flags: GeneratorFlags) -> str:
|
|
132
132
|
indent_level = 0
|
|
133
133
|
script_lines = []
|
|
134
134
|
for codeblock in template.codeblocks:
|
|
135
|
+
# Handle brackets and indentation
|
|
135
136
|
if codeblock.name == 'bracket':
|
|
136
137
|
if codeblock.data['direct'] == 'open':
|
|
137
138
|
add_script_line(flags, script_lines, indent_level, 't.bracket(', False)
|
|
@@ -140,26 +141,45 @@ def generate_script(template, flags: GeneratorFlags) -> str:
|
|
|
140
141
|
indent_level -= 1
|
|
141
142
|
add_script_line(flags, script_lines, indent_level, ')')
|
|
142
143
|
continue
|
|
144
|
+
|
|
145
|
+
# Handle else
|
|
143
146
|
if codeblock.name == 'else':
|
|
144
147
|
add_script_line(flags, script_lines, indent_level, 't.else_()')
|
|
145
148
|
continue
|
|
146
149
|
|
|
150
|
+
|
|
151
|
+
# Get codeblock method and start its arguments with the action
|
|
147
152
|
method_name = TEMPLATE_METHOD_LOOKUP[codeblock.data['block']]
|
|
148
153
|
method_args = [f'"{codeblock.name}"']
|
|
154
|
+
|
|
155
|
+
# Set function or process name if necessary
|
|
149
156
|
if codeblock.name == 'dynamic':
|
|
150
157
|
method_args[0] = f'"{codeblock.data["data"]}"'
|
|
151
158
|
|
|
159
|
+
# Convert argument objects to valid Python strings
|
|
152
160
|
codeblock_args = [argument_item_to_string(flags, i) for i in codeblock.args]
|
|
153
161
|
if codeblock_args:
|
|
154
162
|
method_args.extend(codeblock_args)
|
|
163
|
+
|
|
164
|
+
# Add target if necessary
|
|
155
165
|
if method_name in TARGET_CODEBLOCKS and codeblock.target.name != 'SELECTION':
|
|
156
166
|
method_args.append(f'target=Target.{codeblock.target.name}')
|
|
167
|
+
|
|
168
|
+
# Add tags
|
|
157
169
|
if codeblock.tags:
|
|
158
170
|
default_tags = get_default_tags(codeblock.data.get('block'), codeblock.name)
|
|
159
171
|
written_tags = {t: o for t, o in codeblock.tags.items() if default_tags[t] != o}
|
|
160
172
|
if written_tags:
|
|
161
173
|
method_args.append(f'tags={str(written_tags)}')
|
|
162
174
|
|
|
175
|
+
# Add sub-action for repeat
|
|
176
|
+
if codeblock.data.get('subAction'):
|
|
177
|
+
method_args.append(f'sub_action="{codeblock.data["subAction"]}"')
|
|
178
|
+
|
|
179
|
+
# Add inversion for NOT
|
|
180
|
+
if codeblock.data.get('attribute') == 'NOT':
|
|
181
|
+
method_args.append('inverted=True')
|
|
182
|
+
|
|
163
183
|
line = f't.{method_name}({", ".join(method_args)})'
|
|
164
184
|
add_script_line(flags, script_lines, indent_level, line)
|
|
165
185
|
return SCRIPT_START + '\n'.join(script_lines)
|
|
@@ -2,11 +2,11 @@ dfpyre/__init__.py,sha256=apPsSxJ1Tztfl71MoORoSmDfX7LyKLYlLwOGeLQUitw,25
|
|
|
2
2
|
dfpyre/actiondump.py,sha256=MVI1kVJBNpab882Tgqo-xtemiBN2W1_2OcopBcRupWQ,2587
|
|
3
3
|
dfpyre/data/actiondump_min.json,sha256=hFcIbG_G55FWwqRSW6X77ZrKkQiXLs4CGgJrZgyR2Gg,1938799
|
|
4
4
|
dfpyre/items.py,sha256=StQnkvGAZj3mb7qG3bMyuuiRaSIttyW1Azs139e5c_4,11374
|
|
5
|
-
dfpyre/pyre.py,sha256=
|
|
6
|
-
dfpyre/scriptgen.py,sha256=
|
|
5
|
+
dfpyre/pyre.py,sha256=TcMRpaPx0jWpbiK-xH2fmZmKcKyazh13HpcGQfDRbXA,18318
|
|
6
|
+
dfpyre/scriptgen.py,sha256=yVH3KqlFSq-FFRkp2rXycu--My6bmGFoT1WlAL_QWTo,6956
|
|
7
7
|
dfpyre/style.py,sha256=mLW1CFvvi8_9fk8JaH10I5S4WI0YBdQIXHtI3G_4sR8,980
|
|
8
8
|
dfpyre/util.py,sha256=gHIPPVD0dcLPAaN1M5EnNgxenarwlxfRKN4xno1YJHM,582
|
|
9
|
-
dfpyre-0.7.
|
|
10
|
-
dfpyre-0.7.
|
|
11
|
-
dfpyre-0.7.
|
|
12
|
-
dfpyre-0.7.
|
|
9
|
+
dfpyre-0.7.12.dist-info/LICENSE,sha256=_vuDskB0ja2c-Fgm7Gt8Q8cO9NsLNpZAVyvmZwX7E6o,1060
|
|
10
|
+
dfpyre-0.7.12.dist-info/METADATA,sha256=sqi3b3ndrsulFHTW2yynGabUyhYUbGNj7SKiSm8qLiM,11755
|
|
11
|
+
dfpyre-0.7.12.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
|
12
|
+
dfpyre-0.7.12.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|