funcnodes 0.2.1__tar.gz → 0.2.2__tar.gz
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-0.2.1 → funcnodes-0.2.2}/PKG-INFO +1 -1
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/__init__.py +3 -1
- funcnodes-0.2.2/funcnodes/data.py +47 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/pyproject.toml +1 -1
- {funcnodes-0.2.1 → funcnodes-0.2.2}/LICENSE +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/README.md +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/__main__.py +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/_logging.py +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/basic_nodes/__init__.py +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/basic_nodes/files.py +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/basic_nodes/logic.py +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/basic_nodes/math.py +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/config.py +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/eventmanager.py +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/exceptions.py +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/frontends/__init__.py +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/frontends/funcnodes_react/__init__.py +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/frontends/funcnodes_react/asset-manifest.json +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/frontends/funcnodes_react/css/style.css +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/frontends/funcnodes_react/favicon.ico +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/frontends/funcnodes_react/index.html +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/frontends/funcnodes_react/js/424.js +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/frontends/funcnodes_react/js/424.js.LICENSE.txt +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/frontends/funcnodes_react/js/main.js +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/frontends/funcnodes_react/js/main.js.LICENSE.txt +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/frontends/funcnodes_react/logo192.png +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/frontends/funcnodes_react/logo512.png +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/frontends/funcnodes_react/manifest.json +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/frontends/funcnodes_react/robots.txt +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/frontends/funcnodes_react/run.py +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/io.py +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/lib/__init__.py +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/lib/lib.py +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/lib/libfinder.py +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/lib/libparser.py +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/node.py +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/nodemaker.py +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/nodespace.py +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/triggerstack.py +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/utils/__init__.py +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/utils/data.py +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/utils/nodeutils.py +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/utils/serialization.py +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/worker/__init__.py +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/worker/external_worker.py +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/worker/loop.py +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/worker/remote_worker.py +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/worker/websocket.py +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/worker/worker.py +0 -0
- {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/worker/worker_manager.py +0 -0
|
@@ -22,6 +22,7 @@ from .worker import (
|
|
|
22
22
|
WorkerManager,
|
|
23
23
|
assert_worker_manager_running,
|
|
24
24
|
)
|
|
25
|
+
from .data import DataEnum
|
|
25
26
|
|
|
26
27
|
from . import config
|
|
27
28
|
from .config import RenderOptions
|
|
@@ -62,8 +63,9 @@ __all__ = [
|
|
|
62
63
|
"config",
|
|
63
64
|
"RenderOptions",
|
|
64
65
|
"NoValue",
|
|
66
|
+
"DataEnum",
|
|
65
67
|
]
|
|
66
68
|
|
|
67
|
-
__version__ = "0.2.
|
|
69
|
+
__version__ = "0.2.2"
|
|
68
70
|
|
|
69
71
|
DEBUG = True
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
import enum
|
|
3
|
+
from exposedfunctionality.function_parser.types import add_type
|
|
4
|
+
from typing import Union, Any, TypeVar, Type, Generic
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
ET = TypeVar("ET", bound="DataEnum")
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class DataEnum(enum.Enum):
|
|
11
|
+
"""
|
|
12
|
+
Base class for data enums. They should be used as a type hint for a function argument for funcnodes.
|
|
13
|
+
In the function the value can be accessed by using the v method.
|
|
14
|
+
The reson for this is to be more robust that the values to the function can be
|
|
15
|
+
passed as the Enum, as a value or as a enum key.
|
|
16
|
+
|
|
17
|
+
Example:
|
|
18
|
+
```python
|
|
19
|
+
class TestEnum(DataEnum):
|
|
20
|
+
A = 1
|
|
21
|
+
B = 2
|
|
22
|
+
C = 3
|
|
23
|
+
|
|
24
|
+
@NodeDecorator(node_id="test_enum")
|
|
25
|
+
def test_enum_node(a: TestEnum) -> int:
|
|
26
|
+
a = TestEnum.v(a)
|
|
27
|
+
return a
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
def __init_subclass__(cls) -> None:
|
|
31
|
+
add_type(
|
|
32
|
+
cls,
|
|
33
|
+
cls.__name__,
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
@classmethod
|
|
37
|
+
def interfere(cls: Type[ET], a: Union[ET, str, Any]) -> ET:
|
|
38
|
+
if isinstance(a, str) and a in cls.__members__:
|
|
39
|
+
return cls[a]
|
|
40
|
+
elif isinstance(a, cls):
|
|
41
|
+
return a
|
|
42
|
+
else:
|
|
43
|
+
return cls(a)
|
|
44
|
+
|
|
45
|
+
@classmethod
|
|
46
|
+
def v(cls: Type[ET], a: Union[ET, str, Any]) -> Any:
|
|
47
|
+
return cls.interfere(a).value
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/frontends/funcnodes_react/js/424.js.LICENSE.txt
RENAMED
|
File without changes
|
|
File without changes
|
{funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/frontends/funcnodes_react/js/main.js.LICENSE.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|