Menu

#178 linter problems

New
nobody
Low
Defect
2024-03-13
2020-04-11
No

hello,
I would like just to note that pylint compains with the library with this error message:

Module 'RPi.GPIO' has no 'LOW' member

Python 3.7.3 (default, Dec 20 2019, 18:57:59) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import RPi
>>> dir(RPi)
['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__']
>>> dir(RPi.GPIO)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'RPi' has no attribute 'GPIO'
>>> import RPi.GPIO
>>> dir(RPi.GPIO)
['BCM', 'BOARD', 'BOTH', 'FALLING', 'HARD_PWM', 'HIGH', 'I2C', 'IN', 'LOW', 'OUT', 'PUD_DOWN', 'PUD_OFF', 'PUD_UP', 'PWM', 'RISING', 'RPI_INFO', 'RPI_REVISION', 'SERIAL', 'SPI', 'UNKNOWN', 'VERSION', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', 'add_event_callback', 'add_event_detect', 'cleanup', 'event_detected', 'getmode', 'gpio_function', 'input', 'output', 'remove_event_detect', 'setmode', 'setup', 'setwarnings', 'wait_for_edge']

A funny behaviour

Discussion

  • Avasam

    Avasam - 2023-10-01

    Adding type stubs would help teach linting and type-checking tools about possible imports, symbols and class/methods definitions.
    See https://peps.python.org/pep-0561/#specification
    If the maintainer(s) of this project does not want to provide and maintain type-stubs, you can create your own package and distribute it on PyPI. Or request and/or add it to https://github.com/python/typeshed .
    This also relates to the following stub-request Pylance issue: https://github.com/microsoft/python-type-stubs/issues/207

     
    • Avasam

      Avasam - 2024-03-13

      RPi.GPIO stubs are on typeshed as of https://github.com/python/typeshed/pull/11345

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.