在使用Pycharm 2021.3.2(专业版)编写Cython代码时,我不知道如何使这些警告消失,或者如何在不禁用整个打字检查或添加评论的情况下禁用这些特定实例。
以下是在.pyx文件中使用Cython v3.0.0a10产生警告的两种简单方法:
cdef my_def_that_takes_a_str(str arg):
pass
cdef my_def(list pairs):
for pair in pairs:
my_def_that_takes_a_str('hi')
预期类型'type'type [str]',get'str'而不是
:
预期类型'collections.iter',got'type [list]'而不是
:
或与其他libcpp迭代物,不仅是列表:
While writing Cython code using Pycharm 2021.3.2 (Professional Edition), I can't figure how to make these warnings go away or how to disable those specific instances without disabling the entire typing check or adding comments.
Here are two easy ways to produce the warnings with Cython v3.0.0a10 in a .pyx file:
cdef my_def_that_takes_a_str(str arg):
pass
cdef my_def(list pairs):
for pair in pairs:
my_def_that_takes_a_str('hi')
Expected type 'Type[str]', got 'str' instead
:
Expected type 'collections.Iterable', got 'Type[list]' instead
:
Or with other libcpp iterables, not just list:
发布评论