Giter Club home page Giter Club logo

Comments (6)

brianreinhold avatar brianreinhold commented on September 27, 2024

Maybe the solution is to install the source (at least on my PC as the PICO is being accessed remotely) which would provide pylance with the needed information. That seems like a good solution if the actual values exist in the source. That would really help me understand the code and how to use it.

That aside, if Incomplete were changed to int, would that cause a problem?

from micropython-stubber.

Josverl avatar Josverl commented on September 27, 2024

I agree that int would be better, it's just that the tools that turn the source into stubs do not seem to understand the micropython const directive.

And manual edits across 150+ boards is not something I aspire.

For understanding, the source is better than the stubs, as the stubs never have the implementation.

from micropython-stubber.

Josverl avatar Josverl commented on September 27, 2024

Added stubs QA test

  • pyright/pylance : Pass
  • mypy : has an issue resolving import aioble.client
from typing import assert_type

import aioble.client  # stubs-ignore: linter=="mypy"

assert_type(aioble.client._ADV_TYPE_SHORT_NAME , int) # stubs-ignore: linter=="mypy"

from micropython-stubber.

Josverl avatar Josverl commented on September 27, 2024

@brianreinhold,
Thanks for the report.
I updated the stubber tool to allow the types of almost all consts to be preserved during the stubbing process.
That in turn improves the typing across all port and frozen modules.

Updates have been published to PyPI as micropython-rp2-rpi_pico_w-stubs v1.22.1.post2
If you have modified your local stubs, make sure they do not get overwritten by an automatic update.

from micropython-stubber.

brianreinhold avatar brianreinhold commented on September 27, 2024

That is really helpful. I have replaced the stubs with the source in the .vscode directory (aioble only) such that pylance references the source. The source still has a lot of Nones where a typing would be much more helpful. As I figure out what they are, I update them.

from micropython-stubber.

Josverl avatar Josverl commented on September 27, 2024

Some parts are sparsely documented, or in a way that I currently can't parse.
If you have a set that you think is useful I'd be happy to take a copy (in a gist or something) and try to find a way to integrate them.

from micropython-stubber.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.