'PyCharm warning with Cython: Expected type 'Type[typeName]', got 'typeName' instead

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 'Type[str]', got 'str' instead

Expected type 'collections.Iterable', got 'Type[list]' instead: Expected type 'Type[str]', got 'str' instead

Or with other libcpp iterables, not just list: vector iterable warning



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source