dshellInterpreter 1.2.1.3__tar.gz → 1.2.1.5__tar.gz
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.
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DISCORD_COMMANDS/dshell_ui.py +9 -16
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DshellInterpreteur/dshell_interpreter.py +10 -6
- {dshellinterpreter-1.2.1.3/dshellInterpreter.egg-info → dshellinterpreter-1.2.1.5}/PKG-INFO +1 -1
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5/dshellInterpreter.egg-info}/PKG-INFO +1 -1
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/setup.py +1 -1
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DISCORD_COMMANDS/__init__.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DISCORD_COMMANDS/dshell_channel.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DISCORD_COMMANDS/dshell_embed.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DISCORD_COMMANDS/dshell_file.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DISCORD_COMMANDS/dshell_interaction.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DISCORD_COMMANDS/dshell_member.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DISCORD_COMMANDS/dshell_message.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DISCORD_COMMANDS/dshell_pastbin.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DISCORD_COMMANDS/dshell_role.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DISCORD_COMMANDS/utils/__init__.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DISCORD_COMMANDS/utils/utils_embed.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DISCORD_COMMANDS/utils/utils_file.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DISCORD_COMMANDS/utils/utils_global.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DISCORD_COMMANDS/utils/utils_list.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DISCORD_COMMANDS/utils/utils_member.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DISCORD_COMMANDS/utils/utils_message.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DISCORD_COMMANDS/utils/utils_numbers.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DISCORD_COMMANDS/utils/utils_permissions.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DISCORD_COMMANDS/utils/utils_string.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DISCORD_COMMANDS/utils/utils_thread.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DISCORD_COMMANDS/utils/utils_type_validation.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DshellInterpreteur/__init__.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DshellInterpreteur/cached_messages.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DshellInterpreteur/dshell_arguments.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DshellInterpreteur/dshell_global_variables.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DshellInterpreteur/dshell_scope.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DshellInterpreteur/errors.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DshellInterpreteur/utils_interpreter.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DshellParser/__init__.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DshellParser/ast_nodes.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DshellParser/dshell_parser.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DshellParser/errors.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DshellPreProcess/__init__.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DshellPreProcess/dshell_preprocess.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DshellTokenizer/__init__.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DshellTokenizer/dshell_keywords.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DshellTokenizer/dshell_token_type.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DshellTokenizer/dshell_tokenizer.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/__init__.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/full_import.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/regex_test.py +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/LICENSE +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/README.md +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/dshellInterpreter.egg-info/SOURCES.txt +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/dshellInterpreter.egg-info/dependency_links.txt +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/dshellInterpreter.egg-info/requires.txt +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/dshellInterpreter.egg-info/top_level.txt +0 -0
- {dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/setup.cfg +0 -0
{dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DISCORD_COMMANDS/dshell_ui.py
RENAMED
|
@@ -177,13 +177,18 @@ async def build_ui(ui_node: Union[UiButtonNode, UiSelectNode], interpreter: "Dsh
|
|
|
177
177
|
:param interpreter:
|
|
178
178
|
:return:
|
|
179
179
|
"""
|
|
180
|
-
|
|
180
|
+
|
|
181
|
+
async def ui_timeout(ctx):
|
|
182
|
+
update_nbr_usage_scope(interpreter.scope_id, -1)
|
|
183
|
+
|
|
184
|
+
view = EasyModifiedViews(timeout=3600, call_on_timeout=ui_timeout, disabled_on_timeout=True)
|
|
181
185
|
|
|
182
186
|
if isinstance(ui_node, UiButtonNode):
|
|
183
187
|
async for _, args_button, code in build_ui_button_parameters(ui_node, interpreter):
|
|
184
188
|
b = ui.Button(**args_button)
|
|
185
189
|
view.add_items(b)
|
|
186
190
|
view.set_callable(b.custom_id, _callable=ui_button_callback, data={'code': code, scope_id: interpreter.scope_id})
|
|
191
|
+
update_nbr_usage_scope(interpreter.scope_id, 1)
|
|
187
192
|
|
|
188
193
|
elif isinstance(ui_node, UiSelectNode):
|
|
189
194
|
s = SelectMenu()
|
|
@@ -217,6 +222,7 @@ async def build_ui(ui_node: Union[UiButtonNode, UiSelectNode], interpreter: "Dsh
|
|
|
217
222
|
s.set_callable(args_select["custom_id"], _callable=ui_select_callback, data={'code': code, scope_id: interpreter.scope_id})
|
|
218
223
|
|
|
219
224
|
view.add_items(s)
|
|
225
|
+
update_nbr_usage_scope(interpreter.scope_id, 1)
|
|
220
226
|
|
|
221
227
|
else:
|
|
222
228
|
raise TypeError(f"UI node must be UiButtonNode or UiSelectNode, not {type(ui_node)} !")
|
|
@@ -224,7 +230,6 @@ async def build_ui(ui_node: Union[UiButtonNode, UiSelectNode], interpreter: "Dsh
|
|
|
224
230
|
return view
|
|
225
231
|
|
|
226
232
|
|
|
227
|
-
|
|
228
233
|
async def rebuild_ui(ui_node: Union[UiButtonNode, UiSelectNode], view: EasyModifiedViews, interpreter: "DshellInterpreteur") -> EasyModifiedViews:
|
|
229
234
|
"""
|
|
230
235
|
Rebuilds a UI component from an existing EasyModifiedViews.
|
|
@@ -378,17 +383,11 @@ async def ui_button_callback(button: ui.Button, interaction: Interaction, data:
|
|
|
378
383
|
code,
|
|
379
384
|
ctx=interaction,
|
|
380
385
|
debug=False,
|
|
381
|
-
vars_env=
|
|
382
|
-
|
|
383
|
-
if scope is not None:
|
|
384
|
-
update_nbr_usage_scope(scope, 1)
|
|
386
|
+
vars_env=scope)
|
|
385
387
|
|
|
386
388
|
with new_scope(new_interpreter, local_env):
|
|
387
389
|
await new_interpreter.execute()
|
|
388
390
|
|
|
389
|
-
if scope is not None:
|
|
390
|
-
update_nbr_usage_scope(scope, -1)
|
|
391
|
-
|
|
392
391
|
else:
|
|
393
392
|
await interaction.response.defer(invisible=True)
|
|
394
393
|
|
|
@@ -522,16 +521,10 @@ async def ui_select_callback(select: ui.Select, interaction: Interaction, data:
|
|
|
522
521
|
code,
|
|
523
522
|
ctx=interaction,
|
|
524
523
|
debug=False,
|
|
525
|
-
vars_env=
|
|
526
|
-
|
|
527
|
-
if scope is not None:
|
|
528
|
-
update_nbr_usage_scope(scope, 1)
|
|
524
|
+
vars_env=scope)
|
|
529
525
|
|
|
530
526
|
with new_scope(new_interpreter, local_env):
|
|
531
527
|
await new_interpreter.execute()
|
|
532
528
|
|
|
533
|
-
if scope is not None:
|
|
534
|
-
update_nbr_usage_scope(scope, -1)
|
|
535
|
-
|
|
536
529
|
else:
|
|
537
530
|
await interaction.response.defer(invisible=True)
|
|
@@ -27,7 +27,7 @@ class DshellInterpreteur:
|
|
|
27
27
|
def __init__(self, code: Union[str, CodeNode], ctx: context,
|
|
28
28
|
debug: bool = False,
|
|
29
29
|
vars: Optional[str] = None,
|
|
30
|
-
vars_env: Optional[dict[str, Any] |
|
|
30
|
+
vars_env: Optional[dict[str, Any] | str] = None):
|
|
31
31
|
"""
|
|
32
32
|
Interpreter Dshell code
|
|
33
33
|
:param code: The code to interpret. Each line must end with a newline character, except SEPARATOR and SUB_SEPARATOR tokens.
|
|
@@ -49,8 +49,13 @@ class DshellInterpreteur:
|
|
|
49
49
|
message = ctx.message if isinstance(ctx, Interaction) else ctx
|
|
50
50
|
|
|
51
51
|
# scope creation
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
scope = get_scope(vars_env)
|
|
53
|
+
if scope:
|
|
54
|
+
self.env = scope
|
|
55
|
+
self.scope_id = vars_env
|
|
56
|
+
else:
|
|
57
|
+
self.scope_id: str = create_scope()
|
|
58
|
+
self.env: Optional[Scope] = get_scope(self.scope_id)
|
|
54
59
|
|
|
55
60
|
if self.env is None:
|
|
56
61
|
raise Exception(f"Scope {self.scope_id} not found in interpreter creation !")
|
|
@@ -112,9 +117,8 @@ class DshellInterpreteur:
|
|
|
112
117
|
|
|
113
118
|
} if message is not None and not debug else {'__ret__': None, '__break__': BoolNode(0)}) # {} is used in debug mode, when ctx is None
|
|
114
119
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
elif isinstance(vars_env, dict): # add the variables to the environment
|
|
120
|
+
|
|
121
|
+
if isinstance(vars_env, dict): # add the variables to the environment
|
|
118
122
|
self.env.update(vars_env)
|
|
119
123
|
|
|
120
124
|
self.vars = StrNode(vars) if vars is not None else StrNode('')
|
|
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
|
|
5
5
|
|
|
6
6
|
setup(
|
|
7
7
|
name="dshellInterpreter",
|
|
8
|
-
version="1.2.1.
|
|
8
|
+
version="1.2.1.5",
|
|
9
9
|
author="Chronos",
|
|
10
10
|
author_email="vagabonwalybi@gmail.com",
|
|
11
11
|
description="A Discord bot interpreter for creating custom commands and automations.",
|
|
File without changes
|
{dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DISCORD_COMMANDS/dshell_channel.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DISCORD_COMMANDS/dshell_embed.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DISCORD_COMMANDS/dshell_file.py
RENAMED
|
File without changes
|
|
File without changes
|
{dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DISCORD_COMMANDS/dshell_member.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DISCORD_COMMANDS/dshell_message.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DISCORD_COMMANDS/dshell_pastbin.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DISCORD_COMMANDS/dshell_role.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DISCORD_COMMANDS/utils/__init__.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DISCORD_COMMANDS/utils/utils_embed.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DISCORD_COMMANDS/utils/utils_file.py
RENAMED
|
File without changes
|
|
File without changes
|
{dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DISCORD_COMMANDS/utils/utils_list.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DshellInterpreteur/__init__.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DshellInterpreteur/cached_messages.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DshellInterpreteur/dshell_scope.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DshellParser/dshell_parser.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DshellPreProcess/dshell_preprocess.py
RENAMED
|
File without changes
|
|
File without changes
|
{dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DshellTokenizer/dshell_keywords.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DshellTokenizer/dshell_token_type.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/Dshell/DshellTokenizer/dshell_tokenizer.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/dshellInterpreter.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/dshellInterpreter.egg-info/requires.txt
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.1.3 → dshellinterpreter-1.2.1.5}/dshellInterpreter.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|