funcnodes-basic 0.2.0__py3-none-any.whl → 0.2.1__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.
@@ -6,7 +6,7 @@ from .strings import NODE_SHELF as strings_shelf
6
6
  from .dicts import NODE_SHELF as dicts_shelf
7
7
 
8
8
 
9
- __version__ = "0.2.0"
9
+ __version__ = "0.2.1"
10
10
 
11
11
  NODE_SHELF = Shelf(
12
12
  nodes=[],
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
- if delay > 1:
61
- total_seconds = int(delay)
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 = len(input)
89
- self.progress.unit = "it"
90
- self.progress.reset(total=iplen)
91
- self.progress.set_description("Iterating")
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,21 +1,16 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: funcnodes-basic
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Basic functionalities for funcnodes
5
5
  License: AGPL-3.0
6
6
  Author: Julian Kimmig
7
- Author-email: julian.kimmig@gmx.net
7
+ Author-email: julian.kimmig@linkdlab.de>
8
8
  Requires-Python: >=3.11
9
- Classifier: License :: OSI Approved :: GNU Affero General Public License v3
10
9
  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
10
  Requires-Dist: funcnodes
16
- Requires-Dist: funcnodes-core (>=0.3.4)
11
+ Requires-Dist: funcnodes-core (>=0.3.9)
12
+ Project-URL: Homepage, https://github.com/Linkdlab/funcnodes_basic
17
13
  Project-URL: download, https://pypi.org/project/funcnodes-basic/#files
18
- Project-URL: homepage, https://github.com/Linkdlab/funcnodes_basic
19
14
  Project-URL: source, https://github.com/Linkdlab/funcnodes_basic
20
15
  Project-URL: tracker, https://github.com/Linkdlab/funcnodes_basic/issues
21
16
  Description-Content-Type: text/markdown
@@ -0,0 +1,11 @@
1
+ funcnodes_basic/__init__.py,sha256=zmYrXkQBz7FVRpwBlCsirF_PlMcCfInJ7vnEeVkFbPA,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=YwIcAgDqxnmJoLVN_hk9XgqrOJvkx3zczx2DxgBliHU,4304
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.1.dist-info/LICENSE,sha256=21Lj2q2SYKHMY4768_a3pr3q0jY2VYamAHipoodhMDc,34273
8
+ funcnodes_basic-0.2.1.dist-info/METADATA,sha256=yQQi_2DTK5h44zXyRO-d-pNxC_DLS6qRBrfwLOOI5wY,1968
9
+ funcnodes_basic-0.2.1.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
10
+ funcnodes_basic-0.2.1.dist-info/entry_points.txt,sha256=Y7-9Rw_0qbyg8MrdLG6zjiEmUYBug_K4TBdJz9MAKxA,76
11
+ funcnodes_basic-0.2.1.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.9.1
2
+ Generator: poetry-core 2.0.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -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,,