dshellInterpreter 1.2.1.4__tar.gz → 1.2.1.6__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.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DISCORD_COMMANDS/dshell_ui.py +4 -15
  2. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DshellInterpreteur/dshell_interpreter.py +11 -7
  3. {dshellinterpreter-1.2.1.4/dshellInterpreter.egg-info → dshellinterpreter-1.2.1.6}/PKG-INFO +1 -1
  4. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6/dshellInterpreter.egg-info}/PKG-INFO +1 -1
  5. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/setup.py +1 -1
  6. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DISCORD_COMMANDS/__init__.py +0 -0
  7. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DISCORD_COMMANDS/dshell_channel.py +0 -0
  8. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DISCORD_COMMANDS/dshell_embed.py +0 -0
  9. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DISCORD_COMMANDS/dshell_file.py +0 -0
  10. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DISCORD_COMMANDS/dshell_interaction.py +0 -0
  11. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DISCORD_COMMANDS/dshell_member.py +0 -0
  12. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DISCORD_COMMANDS/dshell_message.py +0 -0
  13. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DISCORD_COMMANDS/dshell_pastbin.py +0 -0
  14. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DISCORD_COMMANDS/dshell_role.py +0 -0
  15. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DISCORD_COMMANDS/utils/__init__.py +0 -0
  16. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DISCORD_COMMANDS/utils/utils_embed.py +0 -0
  17. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DISCORD_COMMANDS/utils/utils_file.py +0 -0
  18. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DISCORD_COMMANDS/utils/utils_global.py +0 -0
  19. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DISCORD_COMMANDS/utils/utils_list.py +0 -0
  20. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DISCORD_COMMANDS/utils/utils_member.py +0 -0
  21. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DISCORD_COMMANDS/utils/utils_message.py +0 -0
  22. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DISCORD_COMMANDS/utils/utils_numbers.py +0 -0
  23. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DISCORD_COMMANDS/utils/utils_permissions.py +0 -0
  24. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DISCORD_COMMANDS/utils/utils_string.py +0 -0
  25. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DISCORD_COMMANDS/utils/utils_thread.py +0 -0
  26. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DISCORD_COMMANDS/utils/utils_type_validation.py +0 -0
  27. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DshellInterpreteur/__init__.py +0 -0
  28. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DshellInterpreteur/cached_messages.py +0 -0
  29. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DshellInterpreteur/dshell_arguments.py +0 -0
  30. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DshellInterpreteur/dshell_global_variables.py +0 -0
  31. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DshellInterpreteur/dshell_scope.py +0 -0
  32. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DshellInterpreteur/errors.py +0 -0
  33. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DshellInterpreteur/utils_interpreter.py +0 -0
  34. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DshellParser/__init__.py +0 -0
  35. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DshellParser/ast_nodes.py +0 -0
  36. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DshellParser/dshell_parser.py +0 -0
  37. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DshellParser/errors.py +0 -0
  38. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DshellPreProcess/__init__.py +0 -0
  39. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DshellPreProcess/dshell_preprocess.py +0 -0
  40. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DshellTokenizer/__init__.py +0 -0
  41. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DshellTokenizer/dshell_keywords.py +0 -0
  42. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DshellTokenizer/dshell_token_type.py +0 -0
  43. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/DshellTokenizer/dshell_tokenizer.py +0 -0
  44. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/__init__.py +0 -0
  45. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/full_import.py +0 -0
  46. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/Dshell/regex_test.py +0 -0
  47. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/LICENSE +0 -0
  48. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/README.md +0 -0
  49. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/dshellInterpreter.egg-info/SOURCES.txt +0 -0
  50. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/dshellInterpreter.egg-info/dependency_links.txt +0 -0
  51. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/dshellInterpreter.egg-info/requires.txt +0 -0
  52. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/dshellInterpreter.egg-info/top_level.txt +0 -0
  53. {dshellinterpreter-1.2.1.4 → dshellinterpreter-1.2.1.6}/setup.cfg +0 -0
@@ -179,9 +179,10 @@ async def build_ui(ui_node: Union[UiButtonNode, UiSelectNode], interpreter: "Dsh
179
179
  """
180
180
 
181
181
  async def ui_timeout(ctx):
182
+ print("nbr d'usage pour ", interpreter.scope_id, ":", get_usage_scope(interpreter.scope_id))
182
183
  update_nbr_usage_scope(interpreter.scope_id, -1)
183
184
 
184
- view = EasyModifiedViews(timeout=3600, call_on_timeout=ui_timeout, disabled_on_timeout=True)
185
+ view = EasyModifiedViews(timeout=10, call_on_timeout=ui_timeout, disabled_on_timeout=True)
185
186
 
186
187
  if isinstance(ui_node, UiButtonNode):
187
188
  async for _, args_button, code in build_ui_button_parameters(ui_node, interpreter):
@@ -383,17 +384,11 @@ async def ui_button_callback(button: ui.Button, interaction: Interaction, data:
383
384
  code,
384
385
  ctx=interaction,
385
386
  debug=False,
386
- vars_env=get_scope(scope))
387
-
388
- if scope is not None:
389
- update_nbr_usage_scope(scope, 1)
387
+ vars_env=scope)
390
388
 
391
389
  with new_scope(new_interpreter, local_env):
392
390
  await new_interpreter.execute()
393
391
 
394
- if scope is not None:
395
- update_nbr_usage_scope(scope, -1)
396
-
397
392
  else:
398
393
  await interaction.response.defer(invisible=True)
399
394
 
@@ -527,16 +522,10 @@ async def ui_select_callback(select: ui.Select, interaction: Interaction, data:
527
522
  code,
528
523
  ctx=interaction,
529
524
  debug=False,
530
- vars_env=get_scope(scope))
531
-
532
- if scope is not None:
533
- update_nbr_usage_scope(scope, 1)
525
+ vars_env=scope)
534
526
 
535
527
  with new_scope(new_interpreter, local_env):
536
528
  await new_interpreter.execute()
537
529
 
538
- if scope is not None:
539
- update_nbr_usage_scope(scope, -1)
540
-
541
530
  else:
542
531
  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] | Scope] = None):
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
- self.scope_id: str = create_scope()
53
- self.env: Optional[Scope] = get_scope(self.scope_id)
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
- if isinstance(vars_env, Scope):
116
- self.env = vars_env
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('')
@@ -333,9 +337,9 @@ class DshellInterpreteur:
333
337
  """
334
338
  Clear the interpreter environment.
335
339
  """
336
- self.env.clear()
337
340
  self.ast.clear()
338
341
  update_nbr_usage_scope(self.scope_id, -1)
342
+ print("nbr d'usage après clear de l'interpréteur :", get_usage_scope(self.scope_id))
339
343
 
340
344
 
341
345
  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.1.4
3
+ Version: 1.2.1.6
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.1.4
3
+ Version: 1.2.1.6
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.1.4",
8
+ version="1.2.1.6",
9
9
  author="Chronos",
10
10
  author_email="vagabonwalybi@gmail.com",
11
11
  description="A Discord bot interpreter for creating custom commands and automations.",