from graspologic.partition import hierarchical_leiden
File "/data/newssd/anaconda3/envs/graphrag/lib/python3.9/site-packages/graspologic/init.py", line 6, in
import graspologic.datasets
File "/data/newssd/anaconda3/envs/graphrag/lib/python3.9/site-packages/graspologic/datasets/init.py", line 4, in
from .base import load_drosophila_left, load_drosophila_right, load_mice
File "/data/newssd/anaconda3/envs/graphrag/lib/python3.9/site-packages/graspologic/datasets/base.py", line 14, in
from ..utils import import_edgelist
File "/data/newssd/anaconda3/envs/graphrag/lib/python3.9/site-packages/graspologic/utils/init.py", line 4, in
from .ptr import pass_to_ranks
File "/data/newssd/anaconda3/envs/graphrag/lib/python3.9/site-packages/graspologic/utils/ptr.py", line 8, in
from .utils import import_graph, is_loopless, is_symmetric, is_unweighted, symmetrize
File "/data/newssd/anaconda3/envs/graphrag/lib/python3.9/site-packages/graspologic/utils/utils.py", line 13, in
from beartype import beartype
File "/data/newssd/anaconda3/envs/graphrag/lib/python3.9/site-packages/beartype/init.py", line 58, in
from beartype._decor.decormain import (
File "/data/newssd/anaconda3/envs/graphrag/lib/python3.9/site-packages/beartype/_decor/decormain.py", line 26, in
from beartype._conf.confcls import (
File "/data/newssd/anaconda3/envs/graphrag/lib/python3.9/site-packages/beartype/_conf/confcls.py", line 46, in
from beartype._conf.confoverrides import (
File "/data/newssd/anaconda3/envs/graphrag/lib/python3.9/site-packages/beartype/_conf/confoverrides.py", line 15, in
from beartype._data.hint.datahinttyping import (
File "/data/newssd/anaconda3/envs/graphrag/lib/python3.9/site-packages/beartype/_data/hint/datahinttyping.py", line 290, in
BeartypeReturn = Union[BeartypeableT, BeartypeConfedDecorator]
File "/data/newssd/anaconda3/envs/graphrag/lib/python3.9/typing.py", line 244, in inner
return func(*args, **kwds)
File "/data/newssd/anaconda3/envs/graphrag/lib/python3.9/typing.py", line 317, in getitem
return self._getitem(self, parameters)
File "/data/newssd/anaconda3/envs/graphrag/lib/python3.9/typing.py", line 422, in Union
parameters = _remove_dups_flatten(parameters)
File "/data/newssd/anaconda3/envs/graphrag/lib/python3.9/typing.py", line 216, in _remove_dups_flatten
all_params = set(params)
TypeError: unhashable type: 'list'
对应代码:
def _remove_dups_flatten(parameters):
"""An internal helper for Union creation and substitution: flatten Unions
among parameters, then remove duplicates.
"""
Flatten out Union[Union[...], ...].
params = []
for p in parameters:
if isinstance(p, _UnionGenericAlias):
params.extend(p.__args__)
elif isinstance(p, tuple) and len(p) > 0 and p[0] is Union:
params.extend(p[1:])
else:
params.append(p)
# Weed out strict duplicates, preserving the first of each occurrence.
all_params = set(params) # 应该是这一句?
if len(all_params) < len(params):
new_params = []
for t in params:
if t in all_params:
new_params.append(t)
all_params.remove(t)
params = new_params
assert not all_params, all_params
return tuple(params)
在执行到await self._clustering_algorithms[algorithm]()的时候出现报错:
from graspologic.partition import hierarchical_leiden File "/data/newssd/anaconda3/envs/graphrag/lib/python3.9/site-packages/graspologic/init.py", line 6, in
import graspologic.datasets
File "/data/newssd/anaconda3/envs/graphrag/lib/python3.9/site-packages/graspologic/datasets/init.py", line 4, in
from .base import load_drosophila_left, load_drosophila_right, load_mice
File "/data/newssd/anaconda3/envs/graphrag/lib/python3.9/site-packages/graspologic/datasets/base.py", line 14, in
from ..utils import import_edgelist
File "/data/newssd/anaconda3/envs/graphrag/lib/python3.9/site-packages/graspologic/utils/init.py", line 4, in
from .ptr import pass_to_ranks
File "/data/newssd/anaconda3/envs/graphrag/lib/python3.9/site-packages/graspologic/utils/ptr.py", line 8, in
from .utils import import_graph, is_loopless, is_symmetric, is_unweighted, symmetrize
File "/data/newssd/anaconda3/envs/graphrag/lib/python3.9/site-packages/graspologic/utils/utils.py", line 13, in
from beartype import beartype
File "/data/newssd/anaconda3/envs/graphrag/lib/python3.9/site-packages/beartype/init.py", line 58, in
from beartype._decor.decormain import (
File "/data/newssd/anaconda3/envs/graphrag/lib/python3.9/site-packages/beartype/_decor/decormain.py", line 26, in
from beartype._conf.confcls import (
File "/data/newssd/anaconda3/envs/graphrag/lib/python3.9/site-packages/beartype/_conf/confcls.py", line 46, in
from beartype._conf.confoverrides import (
File "/data/newssd/anaconda3/envs/graphrag/lib/python3.9/site-packages/beartype/_conf/confoverrides.py", line 15, in
from beartype._data.hint.datahinttyping import (
File "/data/newssd/anaconda3/envs/graphrag/lib/python3.9/site-packages/beartype/_data/hint/datahinttyping.py", line 290, in
BeartypeReturn = Union[BeartypeableT, BeartypeConfedDecorator]
File "/data/newssd/anaconda3/envs/graphrag/lib/python3.9/typing.py", line 244, in inner
return func(*args, **kwds)
File "/data/newssd/anaconda3/envs/graphrag/lib/python3.9/typing.py", line 317, in getitem
return self._getitem(self, parameters)
File "/data/newssd/anaconda3/envs/graphrag/lib/python3.9/typing.py", line 422, in Union
parameters = _remove_dups_flatten(parameters)
File "/data/newssd/anaconda3/envs/graphrag/lib/python3.9/typing.py", line 216, in _remove_dups_flatten
all_params = set(params)
TypeError: unhashable type: 'list'
当前params为:[~BeartypeableT, collections.abc.Callable[[~BeartypeableT], ~BeartypeableT]]
params一共在下面几种场景下会出现错误: wrong!!!!! [~BeartypeableT, collections.abc.Callable[[~BeartypeableT], ~BeartypeableT]] unhashable type: 'list'
wrong!!!!! [<class 'type'>, collections.abc.Callable[[], object]] unhashable type: 'list'
wrong!!!!! [collections.abc.Callable[[<class 'int'>], typing.Optional[frame]], <class 'NoneType'>]
对应代码: def _remove_dups_flatten(parameters): """An internal helper for Union creation and substitution: flatten Unions among parameters, then remove duplicates. """
Flatten out Union[Union[...], ...].
报错忽略直接返回tuple(params)似乎也能继续跑下去