dshellInterpreter 0.2.7__py3-none-any.whl → 0.2.8__py3-none-any.whl
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.
- Dshell/_DshellInterpreteur/dshell_interpreter.py +3 -2
- Dshell/_DshellTokenizer/dshell_keywords.py +10 -5
- Dshell/_DshellTokenizer/dshell_token_type.py +1 -0
- Dshell/_DshellTokenizer/dshell_tokenizer.py +2 -1
- {dshellinterpreter-0.2.7.dist-info → dshellinterpreter-0.2.8.dist-info}/METADATA +1 -1
- {dshellinterpreter-0.2.7.dist-info → dshellinterpreter-0.2.8.dist-info}/RECORD +9 -9
- {dshellinterpreter-0.2.7.dist-info → dshellinterpreter-0.2.8.dist-info}/WHEEL +0 -0
- {dshellinterpreter-0.2.7.dist-info → dshellinterpreter-0.2.8.dist-info}/licenses/LICENSE +0 -0
- {dshellinterpreter-0.2.7.dist-info → dshellinterpreter-0.2.8.dist-info}/top_level.txt +0 -0
|
@@ -49,7 +49,7 @@ class DshellInterpreteur:
|
|
|
49
49
|
'__channel_type__': ctx.channel.type.name if hasattr(ctx.channel, 'type') else None,
|
|
50
50
|
'__channel_id__': ctx.channel.id,
|
|
51
51
|
'__private_channel__': isinstance(ctx.channel, PrivateChannel),
|
|
52
|
-
}
|
|
52
|
+
} if ctx is not None else {}
|
|
53
53
|
self.vars = vars if vars is not None else ''
|
|
54
54
|
self.ctx: context = ctx
|
|
55
55
|
if debug:
|
|
@@ -249,7 +249,7 @@ def eval_expression(tokens: list[Token], interpreter: DshellInterpreteur) -> Any
|
|
|
249
249
|
if token.type in {DTT.INT, DTT.FLOAT, DTT.BOOL, DTT.STR, DTT.LIST, DTT.IDENT}:
|
|
250
250
|
stack.append(interpreter.eval_data_token(token))
|
|
251
251
|
|
|
252
|
-
elif token.type in (DTT.MATHS_OPERATOR, DTT.LOGIC_OPERATOR):
|
|
252
|
+
elif token.type in (DTT.MATHS_OPERATOR, DTT.LOGIC_OPERATOR, DTT.LOGIC_WORD_OPERATOR):
|
|
253
253
|
op = token.value
|
|
254
254
|
|
|
255
255
|
if op == "not":
|
|
@@ -407,6 +407,7 @@ def build_permission(body: list[Token], interpreter: DshellInterpreteur) -> dict
|
|
|
407
407
|
|
|
408
408
|
for i in args_permissions:
|
|
409
409
|
i.pop('*')
|
|
410
|
+
i.pop('--*')
|
|
410
411
|
permissions.update(DshellPermissions(i).get_permission_overwrite(interpreter.ctx.channel.guild))
|
|
411
412
|
|
|
412
413
|
return permissions
|
|
@@ -4,7 +4,8 @@ __all__ = [
|
|
|
4
4
|
"dshell_commands",
|
|
5
5
|
"dshell_mathematical_operators",
|
|
6
6
|
"dshell_logical_operators",
|
|
7
|
-
"dshell_operators"
|
|
7
|
+
"dshell_operators",
|
|
8
|
+
"dshell_logical_word_operators"
|
|
8
9
|
]
|
|
9
10
|
|
|
10
11
|
from typing import Callable
|
|
@@ -78,6 +79,13 @@ dshell_mathematical_operators: dict[str, tuple[Callable, int]] = {
|
|
|
78
79
|
r"/": (lambda a, b: a / b, 7),
|
|
79
80
|
}
|
|
80
81
|
|
|
82
|
+
dshell_logical_word_operators: dict[str, tuple[Callable, int]] = {
|
|
83
|
+
r"and": (lambda a, b: bool(a and b), 2),
|
|
84
|
+
r"or": (lambda a, b: bool(a or b), 1),
|
|
85
|
+
r"not": (lambda a: not a, 3),
|
|
86
|
+
r"in": (lambda a, b: a in b, 4),
|
|
87
|
+
}
|
|
88
|
+
|
|
81
89
|
dshell_logical_operators: dict[str, tuple[Callable, int]] = {
|
|
82
90
|
|
|
83
91
|
r"<": (lambda a, b: a < b, 4),
|
|
@@ -89,16 +97,13 @@ dshell_logical_operators: dict[str, tuple[Callable, int]] = {
|
|
|
89
97
|
r">": (lambda a, b: a > b, 4),
|
|
90
98
|
r">=": (lambda a, b: a >= b, 4),
|
|
91
99
|
r"=>": (lambda a, b: a >= b, 4),
|
|
92
|
-
r"and": (lambda a, b: bool(a and b), 2),
|
|
93
100
|
r"&": (lambda a, b: a & b, 2),
|
|
94
|
-
r"or": (lambda a, b: bool(a or b), 1),
|
|
95
101
|
r"|": (lambda a, b: a | b, 1),
|
|
96
|
-
r"in": (lambda a, b: a in b, 4),
|
|
97
|
-
r"not": (lambda a: not a, 3),
|
|
98
102
|
|
|
99
103
|
}
|
|
100
104
|
|
|
101
105
|
dshell_operators: dict[str, tuple[Callable, int]] = dshell_logical_operators.copy()
|
|
106
|
+
dshell_operators.update(dshell_logical_word_operators)
|
|
102
107
|
dshell_operators.update(dshell_mathematical_operators)
|
|
103
108
|
|
|
104
109
|
'''
|
|
@@ -26,7 +26,8 @@ table_regex: dict[DTT, Pattern] = {
|
|
|
26
26
|
DTT.DISCORD_KEYWORD: compile(rf"(?<!\w|-)(#?{'|'.join(dshell_discord_keyword)})(?!\w|-)"),
|
|
27
27
|
DTT.COMMAND: compile(rf"\b({'|'.join(dshell_commands.keys())})\b"),
|
|
28
28
|
DTT.MATHS_OPERATOR: compile(rf"({'|'.join([escape(i) for i in dshell_mathematical_operators.keys()])})"),
|
|
29
|
-
DTT.LOGIC_OPERATOR: compile(rf"(
|
|
29
|
+
DTT.LOGIC_OPERATOR: compile(rf"({'|'.join([escape(i) for i in dshell_logical_operators.keys()])})"),
|
|
30
|
+
DTT.LOGIC_WORD_OPERATOR: compile(rf"({'|'.join([escape(i) for i in dshell_logical_word_operators.keys()])})"),
|
|
30
31
|
DTT.FLOAT: compile(r"(\d+\.\d+)"),
|
|
31
32
|
DTT.INT: compile(r"(\d+)"),
|
|
32
33
|
DTT.BOOL: compile(r"(True|False)", flags=IGNORECASE),
|
|
@@ -7,16 +7,16 @@ Dshell/DISCORD_COMMANDS/dshell_message.py,sha256=SvX9I4nYMWm8ACE56QJBM5yEiZoXIKb
|
|
|
7
7
|
Dshell/DISCORD_COMMANDS/dshell_pastbin.py,sha256=TkWFGRRTvhhJgvwkDFx9Fz4UM2UUFwxyq0laMVx0mUk,881
|
|
8
8
|
Dshell/DISCORD_COMMANDS/dshell_role.py,sha256=fotsYWGHebgIx157q-zRbcCd90Y7jIuKCZ8udQoEzSU,4970
|
|
9
9
|
Dshell/_DshellInterpreteur/__init__.py,sha256=xy5-J-R3YmY99JF3NBHTRRLsComFxpjnCA5xacISctU,35
|
|
10
|
-
Dshell/_DshellInterpreteur/dshell_interpreter.py,sha256=
|
|
10
|
+
Dshell/_DshellInterpreteur/dshell_interpreter.py,sha256=sYQ9qIVjRedwkfITEeVAFN0RdHjiY7RGO6z0j4D7eno,23072
|
|
11
11
|
Dshell/_DshellParser/__init__.py,sha256=ONDfhZMvClqP_6tE8SLjp-cf3pXL-auQYnfYRrHZxC4,56
|
|
12
12
|
Dshell/_DshellParser/ast_nodes.py,sha256=2qwL_M0ELPia6L6gqwgV5hqprvyuo97cx3Zk2dVz09U,15341
|
|
13
13
|
Dshell/_DshellParser/dshell_parser.py,sha256=RxS5GgmTel10pH9HII0X_8XZnVyIQGd9ThZZcZDpEqc,15545
|
|
14
14
|
Dshell/_DshellTokenizer/__init__.py,sha256=LIQSRhDx2B9pmPx5ADMwwD0Xr9ybneVLhHH8qrJWw_s,172
|
|
15
|
-
Dshell/_DshellTokenizer/dshell_keywords.py,sha256=
|
|
16
|
-
Dshell/_DshellTokenizer/dshell_token_type.py,sha256=
|
|
17
|
-
Dshell/_DshellTokenizer/dshell_tokenizer.py,sha256
|
|
18
|
-
dshellinterpreter-0.2.
|
|
19
|
-
dshellinterpreter-0.2.
|
|
20
|
-
dshellinterpreter-0.2.
|
|
21
|
-
dshellinterpreter-0.2.
|
|
22
|
-
dshellinterpreter-0.2.
|
|
15
|
+
Dshell/_DshellTokenizer/dshell_keywords.py,sha256=l8PZhSXLhFHpi8RRoBRm2NRvAyA_NoONw0vRU4bw3t0,5058
|
|
16
|
+
Dshell/_DshellTokenizer/dshell_token_type.py,sha256=gYIb2XN2YcgeRgmar_rBDS5CGmwfmxihu8mOW_d6lbE,1533
|
|
17
|
+
Dshell/_DshellTokenizer/dshell_tokenizer.py,sha256=3KZhysONhgFmB7olDEZh-fvLwpai1_Asbqu0IO2p400,7134
|
|
18
|
+
dshellinterpreter-0.2.8.dist-info/licenses/LICENSE,sha256=lNgcw1_xb7QENAQi3uHGymaFtbs0RV-ihiCd7AoLQjA,1082
|
|
19
|
+
dshellinterpreter-0.2.8.dist-info/METADATA,sha256=EXwmP5l2xkbC-eernwlaTW5hzUiEXGRMLyGBUo9cMWY,1120
|
|
20
|
+
dshellinterpreter-0.2.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
21
|
+
dshellinterpreter-0.2.8.dist-info/top_level.txt,sha256=B4CMhtmchGwPQJLuqUy0GhRG-0cUGxKL4GqEbCiB_vE,7
|
|
22
|
+
dshellinterpreter-0.2.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|