funcnodes-react-flow 0.3.13__py3-none-any.whl → 0.3.15__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.
@@ -35,9 +35,11 @@ def get_react_plugin_content(key: str) -> ExpandedReactPlugin:
35
35
  if key not in FUNCNODES_REACT_PLUGIN:
36
36
  raise ValueError(f"React plugin {key} not found")
37
37
 
38
- with open(FUNCNODES_REACT_PLUGIN[key]["module"], "rb") as f:
39
- module = f.read()
40
- resp: ExpandedReactPlugin = {"js": [], "module": module, "css": []}
38
+ resp: ExpandedReactPlugin = {
39
+ "js": [],
40
+ "module": FUNCNODES_REACT_PLUGIN[key]["module"],
41
+ "css": [],
42
+ }
41
43
  if "js" in FUNCNODES_REACT_PLUGIN[key]:
42
44
  for js in FUNCNODES_REACT_PLUGIN[key]["js"]:
43
45
  with open(js, "rb") as f:
@@ -1,3 +1,4 @@
1
+ from types import ModuleType
1
2
  from typing import Dict
2
3
  from funcnodes_core import plugins
3
4
 
@@ -17,7 +18,7 @@ class ReactPlugin(plugins.BasePlugin):
17
18
  FUNCNODES_REACT_PLUGIN: Dict[str, ReactPlugin] = {}
18
19
 
19
20
 
20
- def add_react_plugin(name: str, plugin: ReactPlugin):
21
+ def add_react_plugin(module: ModuleType, plugin: ReactPlugin):
21
22
  """
22
23
  Add a React plugin to the FUNCNODES_REACT_PLUGIN dictionary.
23
24
 
@@ -25,7 +26,8 @@ def add_react_plugin(name: str, plugin: ReactPlugin):
25
26
  name (str): The name of the plugin.
26
27
  plugin (ReactPlugin): The plugin to add.
27
28
  """
28
- FUNCNODES_REACT_PLUGIN[str(name)] = plugin
29
+ plugin["module"] = module.__file__
30
+ FUNCNODES_REACT_PLUGIN[str(module)] = plugin
29
31
 
30
32
 
31
33
  def plugin_function(installed_module: plugins.InstalledModule):