dshellInterpreter 0.2.15.3__py3-none-any.whl → 0.2.16.0__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.

@@ -2,7 +2,7 @@ __all__ = [
2
2
  "utils_len",
3
3
  ]
4
4
 
5
- async def utils_len(value):
5
+ async def utils_len(ctx, value):
6
6
  """
7
7
  Return the length of a list, or a string
8
8
  :param value:
@@ -4,10 +4,11 @@ __all__ = [
4
4
  "utils_list_clear",
5
5
  "utils_list_pop",
6
6
  "utils_list_sort",
7
- "utils_list_reverse"
7
+ "utils_list_reverse",
8
+ "utils_list_get_value",
8
9
  ]
9
10
 
10
- async def utils_list_add(value: "ListNode", *elements):
11
+ async def utils_list_add(ctx, value: "ListNode", *elements):
11
12
  """
12
13
  Add an element to a list
13
14
  :param value:
@@ -19,25 +20,28 @@ async def utils_list_add(value: "ListNode", *elements):
19
20
  raise TypeError("value must be a list in add command")
20
21
 
21
22
  for elem in elements:
22
- value.add(elem)
23
+ if isinstance(elem, ListNode):
24
+ value.extend(elem)
25
+ else:
26
+ value.add(elem)
23
27
  return value
24
28
 
25
- async def utils_list_remove(value: "ListNode", *elements):
29
+ async def utils_list_remove(ctx, value: "ListNode", element, count: int = 1):
26
30
  """
27
31
  Remove an element from a list
28
32
  :param value:
29
- :param elements:
33
+ :param element:
34
+ :param count:
30
35
  :return:
31
36
  """
32
37
  from ..._DshellParser.ast_nodes import ListNode
33
38
  if not isinstance(value, ListNode):
34
39
  raise TypeError("value must be a list in remove command")
35
40
 
36
- for elem in elements:
37
- value.remove(elem)
41
+ value.remove(element, count)
38
42
  return value
39
43
 
40
- async def utils_list_clear(value: "ListNode"):
44
+ async def utils_list_clear(ctx, value: "ListNode"):
41
45
  """
42
46
  Clear a list
43
47
  :param value:
@@ -49,7 +53,7 @@ async def utils_list_clear(value: "ListNode"):
49
53
  value.clear()
50
54
  return value
51
55
 
52
- async def utils_list_pop(value: "ListNode", index: int = -1):
56
+ async def utils_list_pop(ctx, value: "ListNode", index: int = -1):
53
57
  """
54
58
  Pop an element from a list
55
59
  :param value:
@@ -63,7 +67,7 @@ async def utils_list_pop(value: "ListNode", index: int = -1):
63
67
  raise TypeError("index must be an integer in pop command")
64
68
  return value.pop(index)
65
69
 
66
- async def utils_list_sort(value: "ListNode", reverse: bool = False):
70
+ async def utils_list_sort(ctx, value: "ListNode", reverse: bool = False):
67
71
  """
68
72
  Sort a list
69
73
  :param value:
@@ -78,7 +82,7 @@ async def utils_list_sort(value: "ListNode", reverse: bool = False):
78
82
  value.sort(reverse=reverse)
79
83
  return value
80
84
 
81
- async def utils_list_reverse(value: "ListNode"):
85
+ async def utils_list_reverse(ctx, value: "ListNode"):
82
86
  """
83
87
  Reverse a list
84
88
  :param value:
@@ -89,3 +93,17 @@ async def utils_list_reverse(value: "ListNode"):
89
93
  raise TypeError("value must be a list in reverse command")
90
94
  value.reverse()
91
95
  return value
96
+
97
+ async def utils_list_get_value(ctx, value: "ListNode", index: int):
98
+ """
99
+ Get a value from a list
100
+ :param value:
101
+ :param index:
102
+ :return:
103
+ """
104
+ from ..._DshellParser.ast_nodes import ListNode
105
+ if not isinstance(value, ListNode):
106
+ raise TypeError("value must be a list in get command")
107
+ if not isinstance(index, int):
108
+ raise TypeError("index must be an integer in get command")
109
+ return value[index]
@@ -602,6 +602,14 @@ class ListNode(ASTNode):
602
602
  """
603
603
  self.iterable.reverse()
604
604
 
605
+ def extend(self, values: "ListNode"):
606
+ """
607
+ Extend the list with another list.
608
+ :param values: List of values to extend the list with.
609
+ """
610
+ for v in values:
611
+ self.add(v)
612
+
605
613
  def __add__(self, other: "ListNode"):
606
614
  """
607
615
  Add another ListNode to this one.
@@ -37,6 +37,7 @@ dshell_commands: dict[str, Callable] = {
37
37
  'pop': utils_list_pop,
38
38
  'sort': utils_list_sort,
39
39
  'reverse': utils_list_reverse,
40
+ 'get': utils_list_get_value,
40
41
 
41
42
  "gp": dshell_get_pastbin, # get pastbin
42
43
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dshellInterpreter
3
- Version: 0.2.15.3
3
+ Version: 0.2.16.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
@@ -8,21 +8,21 @@ Dshell/DISCORD_COMMANDS/dshell_message.py,sha256=zcWl6Y1W31h9MTHS-j9tLDwcrRiE_wG
8
8
  Dshell/DISCORD_COMMANDS/dshell_pastbin.py,sha256=H0tUJOwdzYBXvxqipK3mzoNZUKrSLcVm4EZlWbBRScs,796
9
9
  Dshell/DISCORD_COMMANDS/dshell_role.py,sha256=t_yRZRD0FKE2gT4dIDIsHz2PSZZztDVEkkqkG_OkNh4,5002
10
10
  Dshell/DISCORD_COMMANDS/utils/__init__.py,sha256=-amNcYysjgx3YDpDSnbQmJhnm3lbJere9K9aDH-YnJg,115
11
- Dshell/DISCORD_COMMANDS/utils/utils_global.py,sha256=ZCcypoo4kMvARHp2qc4yUPsze6hEv4OVKvXqlcxFohg,382
12
- Dshell/DISCORD_COMMANDS/utils/utils_list.py,sha256=5IIU9BemhGZXP9zlEJ-3Mo9NQafPiZHLV_NWzipUXuA,2539
11
+ Dshell/DISCORD_COMMANDS/utils/utils_global.py,sha256=JDueE5jCIosUziWNuzzW7iw6_RjgGfHEszJXKgU6FR8,387
12
+ Dshell/DISCORD_COMMANDS/utils/utils_list.py,sha256=43ZYZfXDk2fVe83cf6n1Kk-M0BHlcrVSjikOzdrGnyw,3156
13
13
  Dshell/DISCORD_COMMANDS/utils/utils_message.py,sha256=cQvJ15f49ddOjybARwkJKNFe3ITYQciF-pZHERFPkr0,2964
14
14
  Dshell/DISCORD_COMMANDS/utils/utils_thread.py,sha256=tVl4msEwrWHY-0AytI6eY3JSs-eIFUigDSJfK9mT1ww,1457
15
15
  Dshell/_DshellInterpreteur/__init__.py,sha256=xy5-J-R3YmY99JF3NBHTRRLsComFxpjnCA5xacISctU,35
16
16
  Dshell/_DshellInterpreteur/dshell_interpreter.py,sha256=OGn6HHPrlVWVI9z7s90edBqrv3Fv410A0rPYW8JP-Hs,32096
17
17
  Dshell/_DshellParser/__init__.py,sha256=ONDfhZMvClqP_6tE8SLjp-cf3pXL-auQYnfYRrHZxC4,56
18
- Dshell/_DshellParser/ast_nodes.py,sha256=m6a4bMFVb0grMCyghWMeb4xABxdlWxFBbycnR388dg0,18518
18
+ Dshell/_DshellParser/ast_nodes.py,sha256=S2byqd02RMC-ILCX-ZS8zhwOBIBtvMtQ4ESnljjsWmA,18748
19
19
  Dshell/_DshellParser/dshell_parser.py,sha256=KD2ZbKYa1nnvroKmN8fIRD2exXre54Qx_roEBrTV7Mo,18588
20
20
  Dshell/_DshellTokenizer/__init__.py,sha256=LIQSRhDx2B9pmPx5ADMwwD0Xr9ybneVLhHH8qrJWw_s,172
21
- Dshell/_DshellTokenizer/dshell_keywords.py,sha256=4QvBXvuXJPjKWyhVqAPBYCqE95G7dG8waXD3XtmuoBw,6345
21
+ Dshell/_DshellTokenizer/dshell_keywords.py,sha256=Bfr8izuSrJteNTgAg1dk9pQMTPMwaKLTHQVBQGJU5xA,6379
22
22
  Dshell/_DshellTokenizer/dshell_token_type.py,sha256=gYIb2XN2YcgeRgmar_rBDS5CGmwfmxihu8mOW_d6lbE,1533
23
23
  Dshell/_DshellTokenizer/dshell_tokenizer.py,sha256=AJnUocD6hbU6wvjRAN5uDha5QQieTwXlHzZVtgRGaZQ,7307
24
- dshellinterpreter-0.2.15.3.dist-info/licenses/LICENSE,sha256=lNgcw1_xb7QENAQi3uHGymaFtbs0RV-ihiCd7AoLQjA,1082
25
- dshellinterpreter-0.2.15.3.dist-info/METADATA,sha256=P6SnHbwdWUtM6hcP5rFj02wrSjR2IXy-SNg3l1BiZG4,1151
26
- dshellinterpreter-0.2.15.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
27
- dshellinterpreter-0.2.15.3.dist-info/top_level.txt,sha256=B4CMhtmchGwPQJLuqUy0GhRG-0cUGxKL4GqEbCiB_vE,7
28
- dshellinterpreter-0.2.15.3.dist-info/RECORD,,
24
+ dshellinterpreter-0.2.16.0.dist-info/licenses/LICENSE,sha256=lNgcw1_xb7QENAQi3uHGymaFtbs0RV-ihiCd7AoLQjA,1082
25
+ dshellinterpreter-0.2.16.0.dist-info/METADATA,sha256=E-x-UuQeNiMfmVf_Kvp2fTaX99BkFNZ8RRjaHGlY7mk,1151
26
+ dshellinterpreter-0.2.16.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
27
+ dshellinterpreter-0.2.16.0.dist-info/top_level.txt,sha256=B4CMhtmchGwPQJLuqUy0GhRG-0cUGxKL4GqEbCiB_vE,7
28
+ dshellinterpreter-0.2.16.0.dist-info/RECORD,,