funcnodes-basic 0.1.10__py3-none-any.whl → 0.1.11__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.
- funcnodes_basic/__init__.py +1 -1
- funcnodes_basic/lists.py +40 -53
- {funcnodes_basic-0.1.10.dist-info → funcnodes_basic-0.1.11.dist-info}/METADATA +1 -1
- funcnodes_basic-0.1.11.dist-info/RECORD +11 -0
- funcnodes_basic-0.1.10.dist-info/RECORD +0 -11
- {funcnodes_basic-0.1.10.dist-info → funcnodes_basic-0.1.11.dist-info}/LICENSE +0 -0
- {funcnodes_basic-0.1.10.dist-info → funcnodes_basic-0.1.11.dist-info}/WHEEL +0 -0
- {funcnodes_basic-0.1.10.dist-info → funcnodes_basic-0.1.11.dist-info}/entry_points.txt +0 -0
funcnodes_basic/__init__.py
CHANGED
funcnodes_basic/lists.py
CHANGED
@@ -11,52 +11,30 @@ def contains(collection: List[Union[str, Any]], item: Union[str, Any]) -> bool:
|
|
11
11
|
return item in collection
|
12
12
|
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
description
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
self.get_input("inputlist").on("after_set_value", self._update_indices)
|
39
|
-
|
40
|
-
def _update_indices(self, **kwargs):
|
41
|
-
try:
|
42
|
-
lst = self.get_input("inputlist").value
|
43
|
-
index = self.get_input("index")
|
44
|
-
except KeyError:
|
45
|
-
return
|
46
|
-
try:
|
47
|
-
index.update_value_options(min=0, max=len(lst) - 1)
|
48
|
-
except Exception:
|
49
|
-
index.update_value_options(min=0, max=0)
|
50
|
-
|
51
|
-
async def func(
|
52
|
-
self,
|
53
|
-
inputlist: List[Any],
|
54
|
-
index: int,
|
55
|
-
) -> Any:
|
56
|
-
index = int(index)
|
57
|
-
ele = inputlist[index]
|
58
|
-
self.get_output("element").value = ele
|
59
|
-
return ele
|
14
|
+
@fn.NodeDecorator(
|
15
|
+
id="list_get",
|
16
|
+
name="Get Element",
|
17
|
+
description="Gets an element from a list.",
|
18
|
+
default_io_options={
|
19
|
+
"lst": {
|
20
|
+
"on": {
|
21
|
+
"after_set_value": fn.decorator.update_other_io_value_options(
|
22
|
+
"index",
|
23
|
+
lambda result: {
|
24
|
+
"min": -len(result),
|
25
|
+
"max": len(result) - 1 if len(result) > 0 else 0,
|
26
|
+
},
|
27
|
+
)
|
28
|
+
}
|
29
|
+
},
|
30
|
+
},
|
31
|
+
outputs=[
|
32
|
+
{"name": "element"},
|
33
|
+
],
|
34
|
+
)
|
35
|
+
def list_get(lst: List[Any], index: int = -1) -> Tuple[Any]:
|
36
|
+
# shallow copy the list
|
37
|
+
return lst[index]
|
60
38
|
|
61
39
|
|
62
40
|
@fn.NodeDecorator(
|
@@ -102,7 +80,10 @@ def list_extend(lst: List[Any], items: List[Any]) -> List[Any]:
|
|
102
80
|
"on": {
|
103
81
|
"after_set_value": fn.decorator.update_other_io_value_options(
|
104
82
|
"index",
|
105
|
-
lambda result: {
|
83
|
+
lambda result: {
|
84
|
+
"min": -len(result),
|
85
|
+
"max": len(result) - 1 if len(result) > 0 else 0,
|
86
|
+
},
|
106
87
|
)
|
107
88
|
}
|
108
89
|
},
|
@@ -112,7 +93,7 @@ def list_extend(lst: List[Any], items: List[Any]) -> List[Any]:
|
|
112
93
|
{"name": "item"},
|
113
94
|
],
|
114
95
|
)
|
115
|
-
def list_pop(lst: List[Any], index: int) -> Tuple[List[Any], Any]:
|
96
|
+
def list_pop(lst: List[Any], index: int = -1) -> Tuple[List[Any], Any]:
|
116
97
|
# shallow copy the list
|
117
98
|
lst = copy.copy(lst)
|
118
99
|
item = lst.pop(index)
|
@@ -177,13 +158,16 @@ def list_count(lst: List[Any], item: Any) -> int:
|
|
177
158
|
"on": {
|
178
159
|
"after_set_value": fn.decorator.update_other_io_value_options(
|
179
160
|
"index",
|
180
|
-
lambda result: {
|
161
|
+
lambda result: {
|
162
|
+
"min": -len(result),
|
163
|
+
"max": len(result),
|
164
|
+
},
|
181
165
|
)
|
182
166
|
}
|
183
167
|
},
|
184
168
|
},
|
185
169
|
)
|
186
|
-
def list_insert(lst: List[Any],
|
170
|
+
def list_insert(lst: List[Any], item: Any, index: int = -1) -> List[Any]:
|
187
171
|
lst = copy.copy(lst)
|
188
172
|
lst.insert(index, item)
|
189
173
|
return lst
|
@@ -197,13 +181,16 @@ def list_insert(lst: List[Any], index: int, item: Any) -> List[Any]:
|
|
197
181
|
"on": {
|
198
182
|
"after_set_value": fn.decorator.update_other_io_value_options(
|
199
183
|
"index",
|
200
|
-
lambda result: {
|
184
|
+
lambda result: {
|
185
|
+
"min": -len(result),
|
186
|
+
"max": len(result) - 1 if len(result) > 0 else 0,
|
187
|
+
},
|
201
188
|
)
|
202
189
|
}
|
203
190
|
},
|
204
191
|
},
|
205
192
|
)
|
206
|
-
def list_set(lst: List[Any],
|
193
|
+
def list_set(lst: List[Any], item: Any, index: int = -1) -> List[Any]:
|
207
194
|
lst = copy.copy(lst)
|
208
195
|
lst[index] = item
|
209
196
|
return lst
|
@@ -250,7 +237,7 @@ def list_slice_step(
|
|
250
237
|
NODE_SHELF = fn.Shelf(
|
251
238
|
nodes=[
|
252
239
|
contains,
|
253
|
-
|
240
|
+
list_get,
|
254
241
|
to_list,
|
255
242
|
list_length,
|
256
243
|
list_append,
|
@@ -0,0 +1,11 @@
|
|
1
|
+
funcnodes_basic/__init__.py,sha256=KuOmn4v9chfXk9dpxZGT_678bDZjfkpErOWrKjwB2fE,518
|
2
|
+
funcnodes_basic/dicts.py,sha256=koNJEwIq9ryC7evBpnI-QmR7MBIbgUWqpPpwhB3M69Y,2507
|
3
|
+
funcnodes_basic/lists.py,sha256=9kGnovK-oClFatslbIeYne27l2-EPEXZbr_6yQ1B1cY,5835
|
4
|
+
funcnodes_basic/logic.py,sha256=ecWXzkgjxYMfMdvm0Gdt-agsSbe9-_ilCNfhLz5OFXk,3575
|
5
|
+
funcnodes_basic/math_nodes.py,sha256=PasNf-1wAvbJ_c-_qeiIDaUVfgPQEREJApeUcTS4FQg,10586
|
6
|
+
funcnodes_basic/strings.py,sha256=O6rcxBQJ5eYd765w_tolaD6xMwsNmtBjiPgJ_69tKyA,16429
|
7
|
+
funcnodes_basic-0.1.11.dist-info/LICENSE,sha256=VcvnA4LohgMs8yTDTS1sS3aZbSFa3Ei9YeJogeosE7Y,1070
|
8
|
+
funcnodes_basic-0.1.11.dist-info/METADATA,sha256=Q85XfSoC8p8Jy48BJVq2rRBBRrvOtM5cmBr3_krokfs,2117
|
9
|
+
funcnodes_basic-0.1.11.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
10
|
+
funcnodes_basic-0.1.11.dist-info/entry_points.txt,sha256=Y7-9Rw_0qbyg8MrdLG6zjiEmUYBug_K4TBdJz9MAKxA,76
|
11
|
+
funcnodes_basic-0.1.11.dist-info/RECORD,,
|
@@ -1,11 +0,0 @@
|
|
1
|
-
funcnodes_basic/__init__.py,sha256=KTwOVIWjb4bZ2w0RLTdG18BX-vZlvqDs46ZnYOJROYU,518
|
2
|
-
funcnodes_basic/dicts.py,sha256=koNJEwIq9ryC7evBpnI-QmR7MBIbgUWqpPpwhB3M69Y,2507
|
3
|
-
funcnodes_basic/lists.py,sha256=D2RH1-zMa9geKClyR_KqTVQelH4DJI26ukr2ax4vD7c,6041
|
4
|
-
funcnodes_basic/logic.py,sha256=ecWXzkgjxYMfMdvm0Gdt-agsSbe9-_ilCNfhLz5OFXk,3575
|
5
|
-
funcnodes_basic/math_nodes.py,sha256=PasNf-1wAvbJ_c-_qeiIDaUVfgPQEREJApeUcTS4FQg,10586
|
6
|
-
funcnodes_basic/strings.py,sha256=O6rcxBQJ5eYd765w_tolaD6xMwsNmtBjiPgJ_69tKyA,16429
|
7
|
-
funcnodes_basic-0.1.10.dist-info/LICENSE,sha256=VcvnA4LohgMs8yTDTS1sS3aZbSFa3Ei9YeJogeosE7Y,1070
|
8
|
-
funcnodes_basic-0.1.10.dist-info/METADATA,sha256=sXStmwolU5OeWm_xRPaRnJmth3VPi8m8xcMGup41nhY,2117
|
9
|
-
funcnodes_basic-0.1.10.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
10
|
-
funcnodes_basic-0.1.10.dist-info/entry_points.txt,sha256=Y7-9Rw_0qbyg8MrdLG6zjiEmUYBug_K4TBdJz9MAKxA,76
|
11
|
-
funcnodes_basic-0.1.10.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|