tonysimpson / nanomsg-python

nanomsg wrapper for python with multiple backends (CPython and ctypes) should support 2/3 and Pypy
MIT License
382 stars 85 forks source link

PAIR, SUB, etc. imports not found #60

Open lab313ru opened 7 years ago

lab313ru commented 7 years ago

PyCharm cannot find declaration of PAIR, SUB and other protocol types.

ghost commented 7 years ago

I'm seeing the same issue. Did you find a solution?

[pylint] E0611:No name 'SUB_SUBSCRIBE' in module 'nanomsg' [pylint] E0611:No name 'SUB' in module 'nanomsg' [pylint] E0611:No name 'PUB' in module 'nanomsg'

tonysimpson commented 7 years ago

This is a result of the (questionable) design decision in nanomsg to provide an API for dynamic languages like python to get contants are runtime (see nn_symbol). Static analysis tools will not find these because they only exist when you run the module.

A fix could be to put the constants we know exist above line 16 in nanomsg/init.py but set them to None. Then lines 16->20 will set their real values at runtime. Not perfect but it'll fix your issues.