dshellInterpreter 1.2.0.22__tar.gz → 1.2.1.0__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.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DISCORD_COMMANDS/dshell_channel.py +2 -2
  2. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DshellInterpreteur/dshell_interpreter.py +11 -2
  3. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DshellParser/ast_nodes.py +0 -21
  4. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DshellParser/dshell_parser.py +2 -6
  5. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DshellTokenizer/dshell_keywords.py +2 -1
  6. {dshellinterpreter-1.2.0.22/dshellInterpreter.egg-info → dshellinterpreter-1.2.1.0}/PKG-INFO +1 -1
  7. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0/dshellInterpreter.egg-info}/PKG-INFO +1 -1
  8. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/setup.py +1 -1
  9. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DISCORD_COMMANDS/__init__.py +0 -0
  10. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DISCORD_COMMANDS/dshell_embed.py +0 -0
  11. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DISCORD_COMMANDS/dshell_file.py +0 -0
  12. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DISCORD_COMMANDS/dshell_interaction.py +0 -0
  13. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DISCORD_COMMANDS/dshell_member.py +0 -0
  14. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DISCORD_COMMANDS/dshell_message.py +0 -0
  15. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DISCORD_COMMANDS/dshell_pastbin.py +0 -0
  16. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DISCORD_COMMANDS/dshell_role.py +0 -0
  17. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DISCORD_COMMANDS/dshell_ui.py +0 -0
  18. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DISCORD_COMMANDS/utils/__init__.py +0 -0
  19. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DISCORD_COMMANDS/utils/utils_embed.py +0 -0
  20. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DISCORD_COMMANDS/utils/utils_file.py +0 -0
  21. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DISCORD_COMMANDS/utils/utils_global.py +0 -0
  22. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DISCORD_COMMANDS/utils/utils_list.py +0 -0
  23. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DISCORD_COMMANDS/utils/utils_member.py +0 -0
  24. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DISCORD_COMMANDS/utils/utils_message.py +0 -0
  25. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DISCORD_COMMANDS/utils/utils_numbers.py +0 -0
  26. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DISCORD_COMMANDS/utils/utils_permissions.py +0 -0
  27. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DISCORD_COMMANDS/utils/utils_string.py +0 -0
  28. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DISCORD_COMMANDS/utils/utils_thread.py +0 -0
  29. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DISCORD_COMMANDS/utils/utils_type_validation.py +0 -0
  30. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DshellInterpreteur/__init__.py +0 -0
  31. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DshellInterpreteur/cached_messages.py +0 -0
  32. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DshellInterpreteur/dshell_arguments.py +0 -0
  33. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DshellInterpreteur/dshell_global_variables.py +0 -0
  34. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DshellInterpreteur/dshell_scope.py +0 -0
  35. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DshellInterpreteur/errors.py +0 -0
  36. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DshellInterpreteur/utils_interpreter.py +0 -0
  37. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DshellParser/__init__.py +0 -0
  38. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DshellParser/errors.py +0 -0
  39. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DshellPreProcess/__init__.py +0 -0
  40. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DshellPreProcess/dshell_preprocess.py +0 -0
  41. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DshellTokenizer/__init__.py +0 -0
  42. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DshellTokenizer/dshell_token_type.py +0 -0
  43. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/DshellTokenizer/dshell_tokenizer.py +0 -0
  44. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/__init__.py +0 -0
  45. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/full_import.py +0 -0
  46. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/Dshell/regex_test.py +0 -0
  47. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/LICENSE +0 -0
  48. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/README.md +0 -0
  49. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/dshellInterpreter.egg-info/SOURCES.txt +0 -0
  50. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/dshellInterpreter.egg-info/dependency_links.txt +0 -0
  51. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/dshellInterpreter.egg-info/requires.txt +0 -0
  52. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/dshellInterpreter.egg-info/top_level.txt +0 -0
  53. {dshellinterpreter-1.2.0.22 → dshellinterpreter-1.2.1.0}/setup.cfg +0 -0
@@ -158,7 +158,7 @@ async def dshell_create_text_channel(ctx: Message,
158
158
 
159
159
  channel_category = ctx.channel.category if category is None else ctx.channel.guild.get_channel(category)
160
160
 
161
- final_permissions = permissions.value if not MISSING else permissions
161
+ final_permissions = permissions.value if not isinstance(permissions, _MissingSentinel) else permissions
162
162
 
163
163
  created_channel = await ctx.guild.create_text_channel(str(name),
164
164
  category=channel_category,
@@ -198,7 +198,7 @@ async def dshell_create_voice_channel(ctx: Message,
198
198
 
199
199
  channel_category = ctx.channel.category if category is None else ctx.channel.guild.get_channel(category)
200
200
 
201
- final_permissions = permissions.value if not MISSING else permissions
201
+ final_permissions = permissions.value if not isinstance(permissions, _MissingSentinel) else permissions
202
202
 
203
203
  created_channel = await ctx.guild.create_voice_channel(StrNode(name),
204
204
  category=channel_category,
@@ -1,6 +1,6 @@
1
1
  from ..DshellTokenizer.dshell_token_type import Token
2
2
  from ..DshellTokenizer.dshell_token_type import DshellTokenType as DTT
3
- from ..DshellInterpreteur.errors import DshellInterpreterStopExecution
3
+ from ..DshellInterpreteur.errors import DshellInterpreterStopExecution, DshellInterpreterError
4
4
  from Dshell.full_import import TypeVar, Union, Optional, Any, Callable, sleep, findall
5
5
  from ..DshellParser.ast_nodes import *
6
6
  from Dshell.full_import import AutoShardedBot, Interaction, Message, PrivateChannel
@@ -120,6 +120,7 @@ class DshellInterpreteur:
120
120
  print_ast(self.ast)
121
121
 
122
122
  self.raise_error = False
123
+ self.end_program: bool = False
123
124
 
124
125
  async def _execute_command_node(self, node: CommandNode):
125
126
  """Execute a command node."""
@@ -155,6 +156,9 @@ class DshellInterpreteur:
155
156
  self.env.set('__break__', BoolNode(0))
156
157
  break
157
158
 
159
+ if self.end_program:
160
+ break
161
+
158
162
  async def _execute_break_node(self, node: BreakNode):
159
163
  """Execute a break node."""
160
164
  self.env.set('__break__', BoolNode(1))
@@ -223,9 +227,14 @@ class DshellInterpreteur:
223
227
 
224
228
  for node in ast:
225
229
 
230
+ # cut the current program if an EndNode is encountred with the parameter "error_message" to False
231
+ if self.end_program:
232
+ return
233
+
226
234
  try:
227
235
  if isinstance(node, StartNode):
228
236
  await self.execute(node.body)
237
+ return
229
238
 
230
239
  if isinstance(node, CommandNode):
231
240
  await self._execute_command_node(node)
@@ -260,7 +269,7 @@ class DshellInterpreteur:
260
269
  if await self.eval_data_token(node.error_message):
261
270
  raise RuntimeError("Execution stopped - EndNode encountered")
262
271
  else:
263
- raise DshellInterpreterStopExecution("Execution stopped without error")
272
+ self.end_program = True
264
273
 
265
274
  except Exception as e:
266
275
  if not self.raise_error:
@@ -35,7 +35,6 @@ __all__ = [
35
35
  'UiButtonNode',
36
36
  'UiSelectNode',
37
37
  'OptionUiSelectNode',
38
- 'ScanNode',
39
38
  'FileNode',
40
39
  'FileStreamNode'
41
40
  ]
@@ -337,26 +336,6 @@ class ArgsCommandNode(ASTNode):
337
336
  "body": [token.to_dict() for token in self.body]
338
337
  }
339
338
 
340
- class ScanNode(ASTNode):
341
- """
342
- Node representing a scan message in the AST
343
- """
344
- def __init__(self, body: ArgsCommandNode, line: int):
345
- super().__init__(line)
346
- self.body = body
347
-
348
- def __repr__(self):
349
- return StrNode(f"<SCAN> - {self.body}")
350
-
351
- def to_dict(self):
352
- """
353
- Convert the ScanNode to a dictionary representation.
354
- :return: Dictionary representation of the ScanNode.
355
- """
356
- return {
357
- "type": "ScanNode",
358
- "body": self.body.to_dict()
359
- }
360
339
 
361
340
  class CommandNode(ASTNode):
362
341
  """
@@ -221,18 +221,14 @@ def parse(token_lines: list[list[Token]], start_node: ASTNode) -> tuple[list[AST
221
221
  return_node = ReturnNode(body=tokens_by_line[1:], line=line)
222
222
  last_block.body.append(return_node)
223
223
 
224
- elif first_token_line.value == 'scan':
225
- scan_node = ScanNode(ArgsCommandNode(body=tokens_by_line[1:], line=line), line=line)
226
- last_block.body.append(scan_node)
227
-
228
224
  elif first_token_line.value == '#end': # node pour arrêter le programme si elle est rencontré
229
- error_message = True
225
+ error_message = BoolNode(1)
230
226
  if len_tokens_by_line_since_command_name > 0:
231
227
  if tokens_by_line[1].type != DTT.BOOL:
232
228
  raise TypeError(f'[#END] the variable given must be a boolean, not {tokens_by_line[1].type}')
233
229
  else:
234
230
  error_message = tokens_by_line[1]
235
- end_node = EndNode(error_message)
231
+ end_node = EndNode(line=line, error_message=error_message)
236
232
  last_block.body.append(end_node)
237
233
 
238
234
  ############################## DISCORD KEYWORDS ##############################
@@ -11,7 +11,6 @@ __all__ = [
11
11
  from ..DISCORD_COMMANDS import *
12
12
 
13
13
  from Dshell.full_import import Callable
14
- from ..DISCORD_COMMANDS.dshell_file import dshell_read_file, dshell_write_file, dshell_get_message_files
15
14
 
16
15
  dshell_keyword: set[str] = {
17
16
  'if', 'else', 'elif', 'loop', '#end', 'var', '#loop', '#if', 'sleep', 'param', '#param', 'code', '#code', 'eval', 'return', 'break'
@@ -184,6 +183,8 @@ dshell_mathematical_operators: dict[str, tuple[Callable, int, int, int]] = {
184
183
  r"%": (lambda a, b: a % b, 7, 2, 2),
185
184
  r"-": (lambda a, b=None: a-b if b is not None else -a, 6, 1, 2),
186
185
  r"+": (lambda a, b: a + b, 6, 2, 2),
186
+ r"..": (lambda a, b: ListNode([IntNode(i) for i in range(IntNode(a), IntNode(b))])
187
+ if a <= b else ListNode([IntNode(i) for i in range(IntNode(a), IntNode(b), -1)]), 5, 2, 2)
187
188
  # warning: ambiguity between unary and binary to be handled in your parser
188
189
 
189
190
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dshellInterpreter
3
- Version: 1.2.0.22
3
+ Version: 1.2.1.0
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.0.22
3
+ Version: 1.2.1.0
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.0.22",
8
+ version="1.2.1.0",
9
9
  author="Chronos",
10
10
  author_email="vagabonwalybi@gmail.com",
11
11
  description="A Discord bot interpreter for creating custom commands and automations.",