dshellInterpreter 1.2.7.2__tar.gz → 1.2.7.3__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.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DISCORD_COMMANDS/utils/utils_type_validation.py +1 -1
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DshellInterpreteur/dshell_interpreter.py +2 -2
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DshellPreProcess/dshell_preprocess.py +14 -11
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DshellTokenizer/dshell_keywords.py +1 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DshellTokenizer/dshell_tokenizer.py +7 -5
- {dshellinterpreter-1.2.7.2/dshellInterpreter.egg-info → dshellinterpreter-1.2.7.3}/PKG-INFO +1 -1
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3/dshellInterpreter.egg-info}/PKG-INFO +1 -1
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/setup.py +1 -1
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DISCORD_COMMANDS/__init__.py +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DISCORD_COMMANDS/dshell_channel.py +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DISCORD_COMMANDS/dshell_embed.py +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DISCORD_COMMANDS/dshell_file.py +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DISCORD_COMMANDS/dshell_interaction.py +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DISCORD_COMMANDS/dshell_member.py +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DISCORD_COMMANDS/dshell_message.py +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DISCORD_COMMANDS/dshell_pastbin.py +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DISCORD_COMMANDS/dshell_role.py +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DISCORD_COMMANDS/dshell_ui.py +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DISCORD_COMMANDS/utils/__init__.py +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DISCORD_COMMANDS/utils/utils_embed.py +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DISCORD_COMMANDS/utils/utils_file.py +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DISCORD_COMMANDS/utils/utils_global.py +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DISCORD_COMMANDS/utils/utils_list.py +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DISCORD_COMMANDS/utils/utils_member.py +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DISCORD_COMMANDS/utils/utils_message.py +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DISCORD_COMMANDS/utils/utils_numbers.py +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DISCORD_COMMANDS/utils/utils_permissions.py +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DISCORD_COMMANDS/utils/utils_string.py +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DISCORD_COMMANDS/utils/utils_thread.py +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DshellInterpreteur/__init__.py +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DshellInterpreteur/cached_messages.py +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DshellInterpreteur/dshell_arguments.py +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DshellInterpreteur/dshell_global_variables.py +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DshellInterpreteur/dshell_iterators.py +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DshellInterpreteur/dshell_scope.py +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DshellInterpreteur/errors.py +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DshellInterpreteur/utils_interpreter.py +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DshellParser/__init__.py +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DshellParser/ast_nodes.py +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DshellParser/dshell_parser.py +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DshellParser/errors.py +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DshellPreProcess/__init__.py +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DshellTokenizer/__init__.py +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DshellTokenizer/dshell_token_type.py +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/__init__.py +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/full_import.py +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/LICENSE +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/README.md +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/dshellInterpreter.egg-info/SOURCES.txt +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/dshellInterpreter.egg-info/dependency_links.txt +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/dshellInterpreter.egg-info/requires.txt +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/dshellInterpreter.egg-info/top_level.txt +0 -0
- {dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/setup.cfg +0 -0
|
@@ -117,7 +117,7 @@ def _validate_optional_permission(value, param_name: StrNode, command_name: StrN
|
|
|
117
117
|
:param command_name: The command name for error messages (optional)
|
|
118
118
|
:raises TypeError: If the value is not None and not a PermissionNode
|
|
119
119
|
"""
|
|
120
|
-
if value is not None and not isinstance(value, PermissionNode):
|
|
120
|
+
if (value is not None or not isinstance(value, _MissingSentinel)) and not isinstance(value, PermissionNode):
|
|
121
121
|
raise TypeError(f"[{command_name}] -> {param_name} must be a PermissionNode or None, not {type(value).__name__}")
|
|
122
122
|
|
|
123
123
|
|
|
@@ -88,7 +88,7 @@ class DshellInterpreteur:
|
|
|
88
88
|
'__message_add_reaction__': None, # Can be overwritten by add vars_env parameter to get the reaction added on message add event reaction
|
|
89
89
|
'__message_remove_reaction__': None, # Can be overwritten by add vars_env parameter to get the reaction removed on message remove event reaction
|
|
90
90
|
'__message_url__': StrNode(message.jump_url) if hasattr(message, 'jump_url') else None,
|
|
91
|
-
'__last_message__': IntNode(message.channel.last_message_id),
|
|
91
|
+
'__last_message__': IntNode(message.channel.last_message_id or 1),
|
|
92
92
|
|
|
93
93
|
'__channel__': IntNode(message.channel.id),
|
|
94
94
|
'__channel_name__': StrNode(message.channel.name),
|
|
@@ -102,7 +102,7 @@ class DshellInterpreteur:
|
|
|
102
102
|
'__guild_members__': ListNode([IntNode(member.id) for member in message.channel.guild.members], bypass_limit_elt=True, editable=False),
|
|
103
103
|
'__guild_member_count__': IntNode(message.channel.guild.member_count),
|
|
104
104
|
'__guild_icon__': StrNode(message.channel.guild.icon.url) if message.channel.guild.icon else None,
|
|
105
|
-
'__guild_owner_id__': IntNode(message.channel.guild.owner_id),
|
|
105
|
+
'__guild_owner_id__': IntNode(message.channel.guild.owner_id or 1),
|
|
106
106
|
'__guild_description__': StrNode(message.channel.guild.description),
|
|
107
107
|
'__guild_roles__': ListNode([IntNode(role.id) for role in message.channel.guild.roles], bypass_limit_elt=True, editable=False),
|
|
108
108
|
'__guild_roles_count__': IntNode(len(message.channel.guild.roles)),
|
{dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DshellPreProcess/dshell_preprocess.py
RENAMED
|
@@ -6,33 +6,36 @@ class PreProcessorData:
|
|
|
6
6
|
self.symbol = symbol
|
|
7
7
|
self.value = value
|
|
8
8
|
|
|
9
|
-
def define(
|
|
9
|
+
def define(line: str, pre_processor_data: PreProcessorData) -> str:
|
|
10
10
|
"""
|
|
11
11
|
Replace all symbol with the current value
|
|
12
|
-
:param
|
|
13
|
-
:param
|
|
12
|
+
:param line: the current line before tokenization
|
|
13
|
+
:param pre_processor_data: all data for the ##define pre-processor
|
|
14
14
|
:return:
|
|
15
15
|
"""
|
|
16
|
-
return sub(f"(?<![a-zA-Z]){pre_processor_data.symbol}(?![a-zA-Z])", pre_processor_data.value,
|
|
16
|
+
return sub(f"(?<![a-zA-Z]){pre_processor_data.symbol}(?![a-zA-Z])", pre_processor_data.value, line)
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
|
|
19
|
+
def preProcessor(line: str) -> Optional[PreProcessorData]:
|
|
19
20
|
"""
|
|
20
|
-
Execute preprocessor
|
|
21
|
-
:param
|
|
21
|
+
Execute preprocessor line
|
|
22
|
+
:param line: the current line before tokenization
|
|
22
23
|
:return:
|
|
23
24
|
"""
|
|
24
|
-
pre_process_match = search(r"^\s*##([a-zA-Z]+)\s+([a-zA-Z]+)\s+(.*)$",
|
|
25
|
+
pre_process_match = search(r"^\s*##([a-zA-Z]+)\s+([a-zA-Z]+)\s+(.*)$", line)
|
|
25
26
|
if pre_process_match:
|
|
26
27
|
return PreProcessorData(pre_process_match.group(1).lower(), pre_process_match.group(2), pre_process_match.group(3))
|
|
27
28
|
return None
|
|
28
29
|
|
|
29
|
-
def applyPreProcessor(
|
|
30
|
+
def applyPreProcessor(line: str, pre_processor_data: PreProcessorData):
|
|
30
31
|
"""
|
|
31
32
|
Apply preprocessor data to code
|
|
32
|
-
:param
|
|
33
|
+
:param line: the current line before tokenization
|
|
33
34
|
:param pre_processor_data:
|
|
34
35
|
:return:
|
|
35
36
|
"""
|
|
36
37
|
match pre_processor_data.instruction:
|
|
37
38
|
case "define":
|
|
38
|
-
return define(
|
|
39
|
+
return define(line, pre_processor_data)
|
|
40
|
+
|
|
41
|
+
return None
|
{dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DshellTokenizer/dshell_keywords.py
RENAMED
|
@@ -13,6 +13,7 @@ from ..DISCORD_COMMANDS import *
|
|
|
13
13
|
from ..full_import import Callable
|
|
14
14
|
from ..DshellInterpreteur.dshell_iterators import IntIterator
|
|
15
15
|
|
|
16
|
+
|
|
16
17
|
dshell_keyword: set[str] = {
|
|
17
18
|
'if', 'else', 'elif', 'loop', '#end', 'var', '#loop', '#if', 'sleep',
|
|
18
19
|
'param', '#param', 'code', '#code', 'eval', 'return', 'break',
|
{dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DshellTokenizer/dshell_tokenizer.py
RENAMED
|
@@ -7,7 +7,7 @@ __all__ = [
|
|
|
7
7
|
from .dshell_token_type import Token
|
|
8
8
|
from .dshell_token_type import DshellTokenType as DTT
|
|
9
9
|
|
|
10
|
-
from Dshell.full_import import (
|
|
10
|
+
from Dshell.full_import import (
|
|
11
11
|
Pattern,
|
|
12
12
|
ASCII,
|
|
13
13
|
DOTALL,
|
|
@@ -17,6 +17,7 @@ from Dshell.full_import import (Optional,
|
|
|
17
17
|
escape,
|
|
18
18
|
findall,
|
|
19
19
|
finditer,
|
|
20
|
+
Match,
|
|
20
21
|
sub)
|
|
21
22
|
|
|
22
23
|
from .dshell_keywords import (dshell_keyword,
|
|
@@ -43,15 +44,15 @@ table_regex: dict[DTT, Pattern] = {
|
|
|
43
44
|
DTT.STR: compile(r'"((?:[^\\"]|\\.)*)"', flags=DOTALL),
|
|
44
45
|
DTT.EVAL_L_EXPRESSION: compile(r"({)"),
|
|
45
46
|
DTT.EVAL_R_EXPRESSION: compile(r"(})"),
|
|
46
|
-
DTT.EVAL_L_GROUP: compile(
|
|
47
|
+
DTT.EVAL_L_GROUP: compile(rf"(\()"),
|
|
47
48
|
DTT.EVAL_R_GROUP: compile(r"(\))"),
|
|
48
49
|
DTT.EVAL_OUTDATED_GROUP: compile(r"(`)"),
|
|
49
50
|
DTT.LIST_L: compile(r"(\[)"),
|
|
50
51
|
DTT.LIST_R: compile(r"(])"),
|
|
51
52
|
DTT.PARAMETERS: compile(rf"--\*\s*([A-Za-z_]+)\s*", flags=ASCII),
|
|
52
|
-
DTT.STR_PARAMETER: compile(rf"
|
|
53
|
+
DTT.STR_PARAMETER: compile(rf"--'\s*([A-Za-z_]+)\s*", flags=ASCII),
|
|
53
54
|
DTT.PARAMETER: compile(rf"--\s*([A-Za-z_]+)\s*", flags=ASCII),
|
|
54
|
-
DTT.MENTION: compile(r'<(
|
|
55
|
+
DTT.MENTION: compile(r'<(?:@[!&]?|#)([0-9]+)>'),
|
|
55
56
|
DTT.KEYWORD: compile(rf"(?<!\w)(#?{'|'.join(dshell_keyword)})(?!\w)"),
|
|
56
57
|
DTT.DISCORD_KEYWORD: compile(rf"(?<!\w|-)(#?{'|'.join(dshell_discord_keyword)})(?!\w|-)", flags=IGNORECASE),
|
|
57
58
|
DTT.COMMAND: compile(rf"\b({'|'.join(dshell_commands.keys())})\b", flags=IGNORECASE),
|
|
@@ -126,6 +127,7 @@ class DshellTokenizer:
|
|
|
126
127
|
continue
|
|
127
128
|
|
|
128
129
|
for match in finditer(pattern, line): # iterate the match results to get their positions
|
|
130
|
+
match: Match
|
|
129
131
|
|
|
130
132
|
if token_type == DTT.COMMENT: # if we encounter a comment, stop tokenizing the line
|
|
131
133
|
if len(match.group(0)) == len(line):
|
|
@@ -175,7 +177,7 @@ class DshellTokenizer:
|
|
|
175
177
|
|
|
176
178
|
commands: str = command.strip()
|
|
177
179
|
temporary_replacement = '[REPLACE]'
|
|
178
|
-
pattern_find_regrouped_part = compile(
|
|
180
|
+
pattern_find_regrouped_part = compile(rf'({grouping_character}(?:[^\\{grouping_character}]|\\.)*{grouping_character})', flags=DOTALL)
|
|
179
181
|
between_grouping_character = findall(pattern_find_regrouped_part, commands) # find parts between quotes and save them
|
|
180
182
|
|
|
181
183
|
res = sub(pattern_find_regrouped_part,
|
|
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
|
|
5
5
|
|
|
6
6
|
setup(
|
|
7
7
|
name="dshellInterpreter",
|
|
8
|
-
version="1.2.7.
|
|
8
|
+
version="1.2.7.3",
|
|
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.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DISCORD_COMMANDS/dshell_channel.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DISCORD_COMMANDS/dshell_embed.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DISCORD_COMMANDS/dshell_file.py
RENAMED
|
File without changes
|
|
File without changes
|
{dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DISCORD_COMMANDS/dshell_member.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DISCORD_COMMANDS/dshell_message.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DISCORD_COMMANDS/dshell_pastbin.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DISCORD_COMMANDS/dshell_role.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DISCORD_COMMANDS/dshell_ui.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DISCORD_COMMANDS/utils/__init__.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DISCORD_COMMANDS/utils/utils_embed.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DISCORD_COMMANDS/utils/utils_file.py
RENAMED
|
File without changes
|
|
File without changes
|
{dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/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
|
{dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DshellInterpreteur/__init__.py
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DshellInterpreteur/cached_messages.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DshellInterpreteur/dshell_scope.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DshellParser/dshell_parser.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/Dshell/DshellTokenizer/dshell_token_type.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/dshellInterpreter.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/dshellInterpreter.egg-info/requires.txt
RENAMED
|
File without changes
|
{dshellinterpreter-1.2.7.2 → dshellinterpreter-1.2.7.3}/dshellInterpreter.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|