Spaces:
Running
Running
Make all NetworkX ops async for progress indication.
Browse files
lynxkite-graph-analytics/src/lynxkite_graph_analytics/networkx_ops.py
CHANGED
@@ -152,11 +152,11 @@ def types_from_doc(doc: str) -> dict[str, type]:
|
|
152 |
|
153 |
def wrapped(name: str, func):
|
154 |
@functools.wraps(func)
|
155 |
-
def wrapper(*args, **kwargs):
|
156 |
for k, v in kwargs.items():
|
157 |
if v == "None":
|
158 |
kwargs[k] = None
|
159 |
-
res = func(*args, **kwargs)
|
160 |
# Figure out what the returned value is.
|
161 |
if isinstance(res, nx.Graph):
|
162 |
return res
|
|
|
152 |
|
153 |
def wrapped(name: str, func):
|
154 |
@functools.wraps(func)
|
155 |
+
async def wrapper(*args, **kwargs):
|
156 |
for k, v in kwargs.items():
|
157 |
if v == "None":
|
158 |
kwargs[k] = None
|
159 |
+
res = await ops.slow(func)(*args, **kwargs)
|
160 |
# Figure out what the returned value is.
|
161 |
if isinstance(res, nx.Graph):
|
162 |
return res
|