Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NeopPixel stub is missing __dunder__ methods #764

Open
Josverl opened this issue Sep 10, 2024 · 2 comments
Open

NeopPixel stub is missing __dunder__ methods #764

Josverl opened this issue Sep 10, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@Josverl
Copy link
Owner

Josverl commented Sep 10, 2024

Should have

class NeoPixel:
    # ...
    def __len__(self) -> int: 
        """
        Returns the number of pixels in the strip.
        """
    
    def __setitem__(self,index, val) -> None: 
        """
        Set the pixel at index to the value, which is an RGB/RGBW tuple.
        """
        ...
    
    def __getitem__(self,index) -> Tuple: 
        """
        Returns the pixel at index as an RGB/RGBW tuple.
        """
    
@DeflateAwning
Copy link

DeflateAwning commented Dec 22, 2024

+1. I encountered this. Would be great to get fixed!

Sample code:

from neopixel import NeoPixel
from machine import I2C, Pin

def set_pixel(onboard_led_pin: Pin, r: int, g: int, b: int) -> None:
    np = NeoPixel(onboard_led_pin, 1)
    np[0] = (r, g, b)
    np.write()

@Josverl
Copy link
Owner Author

Josverl commented Dec 23, 2024

I need to develop the code to selectively copy but not overwrite class methods from one .pyi file to another.

I hope to find time to do that in the coming weeks

@Josverl Josverl added the bug Something isn't working label Dec 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants