funcnodes-basic 0.2.0__py3-none-any.whl → 0.2.2__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 +3 -1
- funcnodes_basic/input.py +84 -0
- funcnodes_basic/logic.py +18 -16
- {funcnodes_basic-0.2.0.dist-info → funcnodes_basic-0.2.2.dist-info}/METADATA +10 -15
- funcnodes_basic-0.2.2.dist-info/RECORD +13 -0
- {funcnodes_basic-0.2.0.dist-info → funcnodes_basic-0.2.2.dist-info}/WHEEL +2 -1
- funcnodes_basic-0.2.2.dist-info/entry_points.txt +3 -0
- funcnodes_basic-0.2.2.dist-info/top_level.txt +1 -0
- funcnodes_basic-0.2.0.dist-info/RECORD +0 -11
- funcnodes_basic-0.2.0.dist-info/entry_points.txt +0 -4
- {funcnodes_basic-0.2.0.dist-info → funcnodes_basic-0.2.2.dist-info/licenses}/LICENSE +0 -0
funcnodes_basic/__init__.py
CHANGED
@@ -4,13 +4,15 @@ from .math_nodes import NODE_SHELF as math_shelf
|
|
4
4
|
from .lists import NODE_SHELF as lists_shelf
|
5
5
|
from .strings import NODE_SHELF as strings_shelf
|
6
6
|
from .dicts import NODE_SHELF as dicts_shelf
|
7
|
+
from .input import NODE_SHELF as input_shelf
|
7
8
|
|
8
9
|
|
9
|
-
__version__ = "0.2.
|
10
|
+
__version__ = "0.2.2"
|
10
11
|
|
11
12
|
NODE_SHELF = Shelf(
|
12
13
|
nodes=[],
|
13
14
|
subshelves=[
|
15
|
+
input_shelf,
|
14
16
|
lists_shelf,
|
15
17
|
dicts_shelf,
|
16
18
|
strings_shelf,
|
funcnodes_basic/input.py
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
from typing import Union
|
2
|
+
import funcnodes_core as fn
|
3
|
+
|
4
|
+
|
5
|
+
@fn.NodeDecorator(
|
6
|
+
node_id="input.any",
|
7
|
+
node_name="Input",
|
8
|
+
description="Any input",
|
9
|
+
outputs=[
|
10
|
+
{"name": "out"},
|
11
|
+
],
|
12
|
+
)
|
13
|
+
def any_input(input: Union[str, float, int, bool]) -> str:
|
14
|
+
return input
|
15
|
+
|
16
|
+
|
17
|
+
@fn.NodeDecorator(
|
18
|
+
node_id="input.str",
|
19
|
+
node_name="String Input",
|
20
|
+
description="Input a string",
|
21
|
+
outputs=[
|
22
|
+
{"name": "string"},
|
23
|
+
],
|
24
|
+
)
|
25
|
+
def str_input(input: str) -> str:
|
26
|
+
return str(input)
|
27
|
+
|
28
|
+
|
29
|
+
@fn.NodeDecorator(
|
30
|
+
node_id="input.int",
|
31
|
+
node_name="Integer Input",
|
32
|
+
description="Input an integer",
|
33
|
+
outputs=[
|
34
|
+
{"name": "integer"},
|
35
|
+
],
|
36
|
+
)
|
37
|
+
def int_input(input: int) -> int:
|
38
|
+
return int(input)
|
39
|
+
|
40
|
+
|
41
|
+
@fn.NodeDecorator(
|
42
|
+
node_id="input.float",
|
43
|
+
node_name="Float Input",
|
44
|
+
description="Input a float",
|
45
|
+
outputs=[
|
46
|
+
{"name": "float"},
|
47
|
+
],
|
48
|
+
)
|
49
|
+
def float_input(input: float) -> float:
|
50
|
+
return float(input)
|
51
|
+
|
52
|
+
|
53
|
+
@fn.NodeDecorator(
|
54
|
+
node_id="input.bool",
|
55
|
+
node_name="Boolean Input",
|
56
|
+
description="Input a boolean",
|
57
|
+
outputs=[
|
58
|
+
{"name": "boolean"},
|
59
|
+
],
|
60
|
+
)
|
61
|
+
def bool_input(input: bool) -> bool:
|
62
|
+
if isinstance(input, str):
|
63
|
+
if input.lower() in ("true", "1", "yes"):
|
64
|
+
input = True
|
65
|
+
elif input.lower() in ("false", "0", "no"):
|
66
|
+
input = False
|
67
|
+
elif isinstance(input, (int, float)):
|
68
|
+
input = bool(input)
|
69
|
+
else:
|
70
|
+
input = bool(input)
|
71
|
+
return bool(input)
|
72
|
+
|
73
|
+
|
74
|
+
NODE_SHELF = fn.Shelf(
|
75
|
+
nodes=[
|
76
|
+
any_input,
|
77
|
+
str_input,
|
78
|
+
int_input,
|
79
|
+
float_input,
|
80
|
+
bool_input,
|
81
|
+
],
|
82
|
+
name="Input",
|
83
|
+
description="Simple input nodes",
|
84
|
+
)
|
funcnodes_basic/logic.py
CHANGED
@@ -6,6 +6,7 @@ from funcnodes_core.io import NodeInput, NodeOutput, NoValue
|
|
6
6
|
import asyncio
|
7
7
|
|
8
8
|
import funcnodes_core as fn
|
9
|
+
import time
|
9
10
|
|
10
11
|
|
11
12
|
class IfNode(Node):
|
@@ -57,17 +58,18 @@ class WaitNode(Node):
|
|
57
58
|
output = NodeOutput(id="output", type=Any)
|
58
59
|
|
59
60
|
async def func(self, delay: float, input: Optional[Any] = NoValue) -> None:
|
60
|
-
|
61
|
-
|
62
|
-
remaining_seconds = delay - total_seconds
|
63
|
-
self.progress.unit = "s"
|
64
|
-
self.progress.reset(total=total_seconds)
|
65
|
-
self.progress.set_description("Waiting")
|
66
|
-
for _ in range(total_seconds):
|
67
|
-
await asyncio.sleep(1)
|
68
|
-
self.progress.update()
|
69
|
-
await asyncio.sleep(remaining_seconds)
|
61
|
+
start = time.time()
|
62
|
+
remaining_seconds = delay
|
70
63
|
|
64
|
+
if delay > 1:
|
65
|
+
with self.progress(desc="Waiting", unit="s", total=delay) as pbar:
|
66
|
+
while remaining_seconds > 0:
|
67
|
+
interval = min(remaining_seconds, 1)
|
68
|
+
await asyncio.sleep(interval)
|
69
|
+
now = time.time()
|
70
|
+
elapsed = now - start
|
71
|
+
remaining_seconds = max(0, delay - elapsed)
|
72
|
+
pbar.update(interval)
|
71
73
|
else:
|
72
74
|
await asyncio.sleep(delay)
|
73
75
|
self.outputs["output"].value = input
|
@@ -85,12 +87,13 @@ class ForNode(Node):
|
|
85
87
|
results = []
|
86
88
|
self.outputs["done"].value = NoValue
|
87
89
|
|
88
|
-
iplen =
|
89
|
-
|
90
|
-
|
91
|
-
|
90
|
+
iplen = None
|
91
|
+
try:
|
92
|
+
iplen = len(input)
|
93
|
+
except Exception:
|
94
|
+
pass
|
92
95
|
|
93
|
-
for i in input:
|
96
|
+
for i in self.progress(input, desc="Iterating", unit="it", total=iplen):
|
94
97
|
self.outputs["do"].set_value(i, does_trigger=False)
|
95
98
|
triggerstack = TriggerStack()
|
96
99
|
await self.outputs["do"].trigger(triggerstack)
|
@@ -98,7 +101,6 @@ class ForNode(Node):
|
|
98
101
|
if v is not NoValue:
|
99
102
|
results.append(v)
|
100
103
|
self.inputs["collector"].value = NoValue
|
101
|
-
self.progress.update()
|
102
104
|
self.outputs["done"].value = results
|
103
105
|
|
104
106
|
|
@@ -1,24 +1,20 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: funcnodes-basic
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.2
|
4
4
|
Summary: Basic functionalities for funcnodes
|
5
|
+
Author-email: Julian Kimmig <julian.kimmig@linkdlab.de>
|
5
6
|
License: AGPL-3.0
|
6
|
-
Author: Julian Kimmig
|
7
|
-
Author-email: julian.kimmig@gmx.net
|
8
|
-
Requires-Python: >=3.11
|
9
|
-
Classifier: License :: OSI Approved :: GNU Affero General Public License v3
|
10
|
-
Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
|
11
|
-
Classifier: Programming Language :: Python :: 3
|
12
|
-
Classifier: Programming Language :: Python :: 3.11
|
13
|
-
Classifier: Programming Language :: Python :: 3.12
|
14
|
-
Classifier: Programming Language :: Python :: 3.13
|
15
|
-
Requires-Dist: funcnodes
|
16
|
-
Requires-Dist: funcnodes-core (>=0.3.4)
|
17
|
-
Project-URL: download, https://pypi.org/project/funcnodes-basic/#files
|
18
7
|
Project-URL: homepage, https://github.com/Linkdlab/funcnodes_basic
|
19
8
|
Project-URL: source, https://github.com/Linkdlab/funcnodes_basic
|
20
9
|
Project-URL: tracker, https://github.com/Linkdlab/funcnodes_basic/issues
|
10
|
+
Project-URL: download, https://pypi.org/project/funcnodes-basic/#files
|
11
|
+
Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
|
12
|
+
Requires-Python: >=3.11
|
21
13
|
Description-Content-Type: text/markdown
|
14
|
+
License-File: LICENSE
|
15
|
+
Requires-Dist: funcnodes-core>=0.3.9
|
16
|
+
Requires-Dist: funcnodes
|
17
|
+
Dynamic: license-file
|
22
18
|
|
23
19
|
# FuncNodes Basic
|
24
20
|
|
@@ -53,4 +49,3 @@ This project is licensed under the MIT License.
|
|
53
49
|
## Contact
|
54
50
|
|
55
51
|
For any questions or issues, please open an issue on the GitHub repository.
|
56
|
-
|
@@ -0,0 +1,13 @@
|
|
1
|
+
funcnodes_basic/__init__.py,sha256=-Y8ZnYjuERjcJ1JET2VMwT3l8OVXgO_q16Af-ViZ3YA,583
|
2
|
+
funcnodes_basic/dicts.py,sha256=koNJEwIq9ryC7evBpnI-QmR7MBIbgUWqpPpwhB3M69Y,2507
|
3
|
+
funcnodes_basic/input.py,sha256=FSHS1bIJ2dJc9NqWaJO0MxegRBERhfxFdkmDiwAuE6o,1654
|
4
|
+
funcnodes_basic/lists.py,sha256=9kGnovK-oClFatslbIeYne27l2-EPEXZbr_6yQ1B1cY,5835
|
5
|
+
funcnodes_basic/logic.py,sha256=YwIcAgDqxnmJoLVN_hk9XgqrOJvkx3zczx2DxgBliHU,4304
|
6
|
+
funcnodes_basic/math_nodes.py,sha256=PasNf-1wAvbJ_c-_qeiIDaUVfgPQEREJApeUcTS4FQg,10586
|
7
|
+
funcnodes_basic/strings.py,sha256=O6rcxBQJ5eYd765w_tolaD6xMwsNmtBjiPgJ_69tKyA,16429
|
8
|
+
funcnodes_basic-0.2.2.dist-info/licenses/LICENSE,sha256=21Lj2q2SYKHMY4768_a3pr3q0jY2VYamAHipoodhMDc,34273
|
9
|
+
funcnodes_basic-0.2.2.dist-info/METADATA,sha256=bsn7Tm2o61wEtJ8v4qTFdiEklTu7o0-KjHQJuqaVsiM,2001
|
10
|
+
funcnodes_basic-0.2.2.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
11
|
+
funcnodes_basic-0.2.2.dist-info/entry_points.txt,sha256=HZ0g1oDO8PrL_f6b09lfTrS-jXqbZrP0qYf1Km_pVxw,79
|
12
|
+
funcnodes_basic-0.2.2.dist-info/top_level.txt,sha256=xYbcX5Jx-Ow3N3kgXtyvh8kuhCahb3eHBIZfMvkpVKI,16
|
13
|
+
funcnodes_basic-0.2.2.dist-info/RECORD,,
|
@@ -0,0 +1 @@
|
|
1
|
+
funcnodes_basic
|
@@ -1,11 +0,0 @@
|
|
1
|
-
funcnodes_basic/__init__.py,sha256=qxQVn3gdrmJZH7jwmFnxBL5Q9p-y0PBegd6zlt4cydw,517
|
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=SLA2ISn22or2YmuROM8lss_bGNImiWR_ljlcL8Q0zec,4244
|
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.2.0.dist-info/LICENSE,sha256=21Lj2q2SYKHMY4768_a3pr3q0jY2VYamAHipoodhMDc,34273
|
8
|
-
funcnodes_basic-0.2.0.dist-info/METADATA,sha256=SpomJcIAhnTrqOwVmCtVunBFyaYIG7oAx088Y4gQkts,2240
|
9
|
-
funcnodes_basic-0.2.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
10
|
-
funcnodes_basic-0.2.0.dist-info/entry_points.txt,sha256=Y7-9Rw_0qbyg8MrdLG6zjiEmUYBug_K4TBdJz9MAKxA,76
|
11
|
-
funcnodes_basic-0.2.0.dist-info/RECORD,,
|
File without changes
|