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.
Files changed (50) hide show
  1. {funcnodes-0.2.1 → funcnodes-0.2.2}/PKG-INFO +1 -1
  2. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/__init__.py +3 -1
  3. funcnodes-0.2.2/funcnodes/data.py +47 -0
  4. {funcnodes-0.2.1 → funcnodes-0.2.2}/pyproject.toml +1 -1
  5. {funcnodes-0.2.1 → funcnodes-0.2.2}/LICENSE +0 -0
  6. {funcnodes-0.2.1 → funcnodes-0.2.2}/README.md +0 -0
  7. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/__main__.py +0 -0
  8. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/_logging.py +0 -0
  9. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/basic_nodes/__init__.py +0 -0
  10. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/basic_nodes/files.py +0 -0
  11. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/basic_nodes/logic.py +0 -0
  12. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/basic_nodes/math.py +0 -0
  13. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/config.py +0 -0
  14. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/eventmanager.py +0 -0
  15. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/exceptions.py +0 -0
  16. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/frontends/__init__.py +0 -0
  17. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/frontends/funcnodes_react/__init__.py +0 -0
  18. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/frontends/funcnodes_react/asset-manifest.json +0 -0
  19. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/frontends/funcnodes_react/css/style.css +0 -0
  20. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/frontends/funcnodes_react/favicon.ico +0 -0
  21. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/frontends/funcnodes_react/index.html +0 -0
  22. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/frontends/funcnodes_react/js/424.js +0 -0
  23. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/frontends/funcnodes_react/js/424.js.LICENSE.txt +0 -0
  24. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/frontends/funcnodes_react/js/main.js +0 -0
  25. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/frontends/funcnodes_react/js/main.js.LICENSE.txt +0 -0
  26. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/frontends/funcnodes_react/logo192.png +0 -0
  27. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/frontends/funcnodes_react/logo512.png +0 -0
  28. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/frontends/funcnodes_react/manifest.json +0 -0
  29. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/frontends/funcnodes_react/robots.txt +0 -0
  30. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/frontends/funcnodes_react/run.py +0 -0
  31. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/io.py +0 -0
  32. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/lib/__init__.py +0 -0
  33. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/lib/lib.py +0 -0
  34. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/lib/libfinder.py +0 -0
  35. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/lib/libparser.py +0 -0
  36. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/node.py +0 -0
  37. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/nodemaker.py +0 -0
  38. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/nodespace.py +0 -0
  39. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/triggerstack.py +0 -0
  40. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/utils/__init__.py +0 -0
  41. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/utils/data.py +0 -0
  42. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/utils/nodeutils.py +0 -0
  43. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/utils/serialization.py +0 -0
  44. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/worker/__init__.py +0 -0
  45. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/worker/external_worker.py +0 -0
  46. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/worker/loop.py +0 -0
  47. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/worker/remote_worker.py +0 -0
  48. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/worker/websocket.py +0 -0
  49. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/worker/worker.py +0 -0
  50. {funcnodes-0.2.1 → funcnodes-0.2.2}/funcnodes/worker/worker_manager.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: funcnodes
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: funcnodes
5
5
  Author: Julian Kimmig
6
6
  Author-email: julian.kimmig@linkdlab.de
@@ -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.1"
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
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "funcnodes"
3
- version = "0.2.1"
3
+ version = "0.2.2"
4
4
  description = "funcnodes"
5
5
  authors = ["Julian Kimmig <julian.kimmig@linkdlab.de>"]
6
6
  readme = "README.md"
File without changes
File without changes
File without changes
File without changes
File without changes