dshellInterpreter 0.2.15.0__tar.gz → 0.2.15.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.
Potentially problematic release.
This version of dshellInterpreter might be problematic. Click here for more details.
- {dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/Dshell/_DshellInterpreteur/dshell_interpreter.py +10 -4
- {dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/Dshell/_DshellParser/ast_nodes.py +48 -0
- {dshellinterpreter-0.2.15.0/dshellInterpreter.egg-info → dshellinterpreter-0.2.15.2}/PKG-INFO +1 -1
- {dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2/dshellInterpreter.egg-info}/PKG-INFO +1 -1
- {dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/setup.py +1 -1
- {dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/Dshell/DISCORD_COMMANDS/__init__.py +0 -0
- {dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/Dshell/DISCORD_COMMANDS/dshell_channel.py +0 -0
- {dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/Dshell/DISCORD_COMMANDS/dshell_interaction.py +0 -0
- {dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/Dshell/DISCORD_COMMANDS/dshell_member.py +0 -0
- {dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/Dshell/DISCORD_COMMANDS/dshell_message.py +0 -0
- {dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/Dshell/DISCORD_COMMANDS/dshell_pastbin.py +0 -0
- {dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/Dshell/DISCORD_COMMANDS/dshell_role.py +0 -0
- {dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/Dshell/DISCORD_COMMANDS/utils/__init__.py +0 -0
- {dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/Dshell/DISCORD_COMMANDS/utils/utils_message.py +0 -0
- {dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/Dshell/DISCORD_COMMANDS/utils/utils_thread.py +0 -0
- {dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/Dshell/_DshellInterpreteur/__init__.py +0 -0
- {dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/Dshell/_DshellParser/__init__.py +0 -0
- {dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/Dshell/_DshellParser/dshell_parser.py +0 -0
- {dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/Dshell/_DshellTokenizer/__init__.py +0 -0
- {dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/Dshell/_DshellTokenizer/dshell_keywords.py +0 -0
- {dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/Dshell/_DshellTokenizer/dshell_token_type.py +0 -0
- {dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/Dshell/_DshellTokenizer/dshell_tokenizer.py +0 -0
- {dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/Dshell/__init__.py +0 -0
- {dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/Dshell/_utils.py +0 -0
- {dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/LICENSE +0 -0
- {dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/README.md +0 -0
- {dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/dshellInterpreter.egg-info/SOURCES.txt +0 -0
- {dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/dshellInterpreter.egg-info/dependency_links.txt +0 -0
- {dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/dshellInterpreter.egg-info/requires.txt +0 -0
- {dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/dshellInterpreter.egg-info/top_level.txt +0 -0
- {dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/setup.cfg +0 -0
|
@@ -162,14 +162,14 @@ class DshellInterpreteur:
|
|
|
162
162
|
elif isinstance(first_node, LengthNode):
|
|
163
163
|
self.env[node.name.value] = length(first_node)
|
|
164
164
|
|
|
165
|
+
elif isinstance(first_node, IdentOperationNode):
|
|
166
|
+
self.env[node.name.value] = self.eval_ident_operation(first_node)
|
|
167
|
+
|
|
165
168
|
else:
|
|
166
169
|
self.env[node.name.value] = eval_expression(node.body, self)
|
|
167
170
|
|
|
168
171
|
elif isinstance(node, IdentOperationNode):
|
|
169
|
-
|
|
170
|
-
listNode = self.eval_data_token(node.ident)
|
|
171
|
-
if hasattr(listNode, function):
|
|
172
|
-
getattr(listNode, function)(self.eval_data_token(node.args))
|
|
172
|
+
return self.eval_ident_operation(node)
|
|
173
173
|
|
|
174
174
|
elif isinstance(node, SleepNode):
|
|
175
175
|
sleep_time = eval_expression(node.body, self)
|
|
@@ -217,6 +217,12 @@ class DshellInterpreteur:
|
|
|
217
217
|
else:
|
|
218
218
|
return token.value # fallback
|
|
219
219
|
|
|
220
|
+
def eval_ident_operation(self, node: IdentOperationNode) -> Optional[Any]:
|
|
221
|
+
function = self.eval_data_token(node.function)
|
|
222
|
+
listNode = self.eval_data_token(node.ident)
|
|
223
|
+
if hasattr(listNode, function):
|
|
224
|
+
return getattr(listNode, function)(self.eval_data_token(node.args))
|
|
225
|
+
return None
|
|
220
226
|
|
|
221
227
|
def get_params(node: ParamNode, interpreter: DshellInterpreteur) -> dict[str, Any]:
|
|
222
228
|
"""
|
|
@@ -586,6 +586,54 @@ class ListNode(ASTNode):
|
|
|
586
586
|
if number < 1:
|
|
587
587
|
raise Exception(f"The number of elements to remove must be at least 1, not {number} !")
|
|
588
588
|
|
|
589
|
+
count = 0
|
|
590
|
+
while number > 0 and count < self.len_iterable:
|
|
591
|
+
if self.iterable[count] == value:
|
|
592
|
+
self.iterable.pop(count)
|
|
593
|
+
self.len_iterable -= 1
|
|
594
|
+
number -= 1
|
|
595
|
+
continue
|
|
596
|
+
count += 1
|
|
597
|
+
|
|
598
|
+
def pop(self):
|
|
599
|
+
"""
|
|
600
|
+
Remove and return the last element of the list.
|
|
601
|
+
:return: The last element of the list.
|
|
602
|
+
"""
|
|
603
|
+
if self.len_iterable == 0:
|
|
604
|
+
raise IndexError("pop from empty list")
|
|
605
|
+
|
|
606
|
+
self.len_iterable -= 1
|
|
607
|
+
return self.iterable.pop()
|
|
608
|
+
|
|
609
|
+
def count(self):
|
|
610
|
+
"""
|
|
611
|
+
Return the number of elements in the list.
|
|
612
|
+
:return: The number of elements in the list.
|
|
613
|
+
"""
|
|
614
|
+
return self.len_iterable
|
|
615
|
+
|
|
616
|
+
def clear(self):
|
|
617
|
+
"""
|
|
618
|
+
Clear the list.
|
|
619
|
+
"""
|
|
620
|
+
self.iterable = []
|
|
621
|
+
self.len_iterable = 0
|
|
622
|
+
self.iterateur_count = 0
|
|
623
|
+
|
|
624
|
+
def sort(self, reverse: bool = False):
|
|
625
|
+
"""
|
|
626
|
+
Sort the list.
|
|
627
|
+
:param reverse: Whether to sort the list in reverse order.
|
|
628
|
+
"""
|
|
629
|
+
self.iterable.sort(reverse=reverse)
|
|
630
|
+
|
|
631
|
+
def reverse(self):
|
|
632
|
+
"""
|
|
633
|
+
Reverse the list.
|
|
634
|
+
"""
|
|
635
|
+
self.iterable.reverse()
|
|
636
|
+
|
|
589
637
|
def __add__(self, other: "ListNode"):
|
|
590
638
|
"""
|
|
591
639
|
Add another ListNode to this one.
|
|
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
|
|
5
5
|
|
|
6
6
|
setup(
|
|
7
7
|
name="dshellInterpreter",
|
|
8
|
-
version="0.2.15.
|
|
8
|
+
version="0.2.15.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.",
|
{dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/Dshell/DISCORD_COMMANDS/__init__.py
RENAMED
|
File without changes
|
{dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/Dshell/DISCORD_COMMANDS/dshell_channel.py
RENAMED
|
File without changes
|
|
File without changes
|
{dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/Dshell/DISCORD_COMMANDS/dshell_member.py
RENAMED
|
File without changes
|
{dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/Dshell/DISCORD_COMMANDS/dshell_message.py
RENAMED
|
File without changes
|
{dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/Dshell/DISCORD_COMMANDS/dshell_pastbin.py
RENAMED
|
File without changes
|
{dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/Dshell/DISCORD_COMMANDS/dshell_role.py
RENAMED
|
File without changes
|
{dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/Dshell/DISCORD_COMMANDS/utils/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/Dshell/_DshellInterpreteur/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/Dshell/_DshellParser/dshell_parser.py
RENAMED
|
File without changes
|
{dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/Dshell/_DshellTokenizer/__init__.py
RENAMED
|
File without changes
|
{dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/Dshell/_DshellTokenizer/dshell_keywords.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/dshellInterpreter.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/dshellInterpreter.egg-info/requires.txt
RENAMED
|
File without changes
|
{dshellinterpreter-0.2.15.0 → dshellinterpreter-0.2.15.2}/dshellInterpreter.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|