dshellInterpreter 1.2.8.0__tar.gz → 1.2.8.2__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.
Files changed (53) hide show
  1. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DISCORD_COMMANDS/dshell_ui.py +4 -1
  2. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DshellInterpreteur/dshell_interpreter.py +10 -3
  3. {dshellinterpreter-1.2.8.0/dshellInterpreter.egg-info → dshellinterpreter-1.2.8.2}/PKG-INFO +1 -1
  4. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2/dshellInterpreter.egg-info}/PKG-INFO +1 -1
  5. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/setup.py +1 -1
  6. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DISCORD_COMMANDS/__init__.py +0 -0
  7. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DISCORD_COMMANDS/dshell_channel.py +0 -0
  8. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DISCORD_COMMANDS/dshell_embed.py +0 -0
  9. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DISCORD_COMMANDS/dshell_file.py +0 -0
  10. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DISCORD_COMMANDS/dshell_interaction.py +0 -0
  11. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DISCORD_COMMANDS/dshell_member.py +0 -0
  12. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DISCORD_COMMANDS/dshell_message.py +0 -0
  13. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DISCORD_COMMANDS/dshell_pastbin.py +0 -0
  14. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DISCORD_COMMANDS/dshell_role.py +0 -0
  15. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DISCORD_COMMANDS/utils/__init__.py +0 -0
  16. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DISCORD_COMMANDS/utils/utils_embed.py +0 -0
  17. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DISCORD_COMMANDS/utils/utils_file.py +0 -0
  18. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DISCORD_COMMANDS/utils/utils_global.py +0 -0
  19. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DISCORD_COMMANDS/utils/utils_list.py +0 -0
  20. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DISCORD_COMMANDS/utils/utils_member.py +0 -0
  21. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DISCORD_COMMANDS/utils/utils_message.py +0 -0
  22. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DISCORD_COMMANDS/utils/utils_numbers.py +0 -0
  23. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DISCORD_COMMANDS/utils/utils_permissions.py +0 -0
  24. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DISCORD_COMMANDS/utils/utils_string.py +0 -0
  25. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DISCORD_COMMANDS/utils/utils_thread.py +0 -0
  26. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DISCORD_COMMANDS/utils/utils_type_validation.py +0 -0
  27. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DshellInterpreteur/__init__.py +0 -0
  28. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DshellInterpreteur/cached_messages.py +0 -0
  29. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DshellInterpreteur/dshell_arguments.py +0 -0
  30. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DshellInterpreteur/dshell_global_variables.py +0 -0
  31. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DshellInterpreteur/dshell_iterators.py +0 -0
  32. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DshellInterpreteur/dshell_scope.py +0 -0
  33. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DshellInterpreteur/errors.py +0 -0
  34. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DshellInterpreteur/utils_interpreter.py +0 -0
  35. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DshellParser/__init__.py +0 -0
  36. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DshellParser/ast_nodes.py +0 -0
  37. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DshellParser/dshell_parser.py +0 -0
  38. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DshellParser/errors.py +0 -0
  39. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DshellPreProcess/__init__.py +0 -0
  40. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DshellPreProcess/dshell_preprocess.py +0 -0
  41. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DshellTokenizer/__init__.py +0 -0
  42. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DshellTokenizer/dshell_keywords.py +0 -0
  43. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DshellTokenizer/dshell_token_type.py +0 -0
  44. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/DshellTokenizer/dshell_tokenizer.py +0 -0
  45. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/__init__.py +0 -0
  46. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/Dshell/full_import.py +0 -0
  47. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/LICENSE +0 -0
  48. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/README.md +0 -0
  49. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/dshellInterpreter.egg-info/SOURCES.txt +0 -0
  50. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/dshellInterpreter.egg-info/dependency_links.txt +0 -0
  51. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/dshellInterpreter.egg-info/requires.txt +0 -0
  52. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/dshellInterpreter.egg-info/top_level.txt +0 -0
  53. {dshellinterpreter-1.2.8.0 → dshellinterpreter-1.2.8.2}/setup.cfg +0 -0
@@ -78,6 +78,7 @@ def build_ui_scope(env: Scope, code_node: CodeNode):
78
78
  for token in code_node.global_env_vars.env_variables:
79
79
 
80
80
  new_ui_scope.set(token.value, deepcopy(env.get(token.value, None)))
81
+ print(new_ui_scope.vars)
81
82
 
82
83
  return new_ui_scope
83
84
 
@@ -334,7 +335,7 @@ async def ui_button_callback(button: ui.Button, interaction: Interaction, data:
334
335
  :return:
335
336
  """
336
337
  code = data.get('code', None)
337
- scope: Optional[str] = data.get("scope", None)
338
+ scope: Scope = data.get("scope", Scope())
338
339
 
339
340
  if code is not None:
340
341
  message = interaction
@@ -434,6 +435,8 @@ async def ui_button_callback(button: ui.Button, interaction: Interaction, data:
434
435
  with new_scope(new_interpreter, local_env):
435
436
  await new_interpreter.execute()
436
437
 
438
+ new_interpreter.clear()
439
+
437
440
  else:
438
441
  await interaction.response.defer(invisible=True)
439
442
 
@@ -28,7 +28,8 @@ class DshellInterpreteur:
28
28
  def __init__(self, code: Union[str, CodeNode], ctx: context,
29
29
  debug: bool = False,
30
30
  vars: Optional[str] = None,
31
- vars_env: Optional[dict[str, Any] | str] = None):
31
+ vars_env: Optional[dict[str, Any] | Scope] = None,
32
+ is_ui: bool = False):
32
33
  """
33
34
  Interpreter Dshell code
34
35
  :param code: The code to interpret. Each line must end with a newline character, except SEPARATOR and SUB_SEPARATOR tokens.
@@ -36,6 +37,7 @@ class DshellInterpreteur:
36
37
  :param debug: If True, prints the AST of the code and put the ctx to None.
37
38
  :param vars: Optional dictionary of variables to initialize in the interpreter's environment.
38
39
  :param vars_env: Optional dictionary of additional environment variables to add to the interpreter's environment.
40
+ :param is_ui: If is true, env scope parent was nos delete because it will be reused after
39
41
 
40
42
  Note: __message_before__ (message content before edit) can be overwritten by vars_env parameter.
41
43
  """
@@ -51,6 +53,13 @@ class DshellInterpreteur:
51
53
 
52
54
  # scope creation
53
55
  self.env: Scope = Scope()
56
+ if isinstance(vars_env, Scope):
57
+ self.env = vars_env
58
+ elif isinstance(vars_env, dict):
59
+ self.env = Scope()
60
+ self.env.update(vars_env)
61
+
62
+ self.is_ui = is_ui
54
63
 
55
64
  self.env.update({
56
65
  '__ret__': None, # environment variables, '__ret__' is used to store the return value of commands
@@ -343,8 +352,6 @@ class DshellInterpreteur:
343
352
  """
344
353
  self.env.clear()
345
354
  del self.env
346
- self.ast.clear()
347
- del self.ast
348
355
 
349
356
 
350
357
  async def call_function(function: Callable, args: ArgsCommandNode, interpreter: DshellInterpreteur):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dshellInterpreter
3
- Version: 1.2.8.0
3
+ Version: 1.2.8.2
4
4
  Summary: A Discord bot interpreter for creating custom commands and automations.
5
5
  Home-page: https://github.com/BOXERRMD/Dshell_Interpreter
6
6
  Author: Chronos
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dshellInterpreter
3
- Version: 1.2.8.0
3
+ Version: 1.2.8.2
4
4
  Summary: A Discord bot interpreter for creating custom commands and automations.
5
5
  Home-page: https://github.com/BOXERRMD/Dshell_Interpreter
6
6
  Author: Chronos
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
5
5
 
6
6
  setup(
7
7
  name="dshellInterpreter",
8
- version="1.2.8.0",
8
+ version="1.2.8.2",
9
9
  author="Chronos",
10
10
  author_email="vagabonwalybi@gmail.com",
11
11
  description="A Discord bot interpreter for creating custom commands and automations.",