Giter VIP home page Giter VIP logo

Comments (7)

willmcgugan avatar willmcgugan commented on May 18, 2024 1

To be honest, I think you're better off ignore those errors with "type: ignore" or equivalent. The PyCharm tooling is in error here, and by the looks of it they might fix it soon enough.

from textual.

willmcgugan avatar willmcgugan commented on May 18, 2024

I don't get that error in my code. The Reactive descriptor is typed so it should allow Mypy to understand the reactive attributes.

Perhaps you have an older version of Mypy? Or maybe its because your on_mount method isn't typed?

Issues are probably the best place to track bugs. One bug per issues works best.

Although sometimes it will be hard to know what is a bug and what isn't. Usually my benchmark is when behavior contradicts the docs, but since there aren't any docs, it might not be clear! In that case you might want to bring it up on Discussions first. Twitter DMs would be fine for odd questions.

from textual.

cmckain avatar cmckain commented on May 18, 2024

PyCharm's lack of support for non-standard or non-class types has been a problem for a while (see https://youtrack.jetbrains.com/issue/PY-27627) but, to stop the annoying warnings, I just changed the type of Reactive objects to 'Reactive[str] | str' (or 'Union[Reactive[str], str]' for those who aren't crazy enough to use 3.10). That technically happens because "BAXI" isn't typed as Reactive[str] but as str.

from textual.

kkanekii avatar kkanekii commented on May 18, 2024

what's that font bro 0_0 it looks sick

from textual.

abey79 avatar abey79 commented on May 18, 2024

@willmcgugan Indeed mypy is fine. As @cmckain suggests, this is probably a PyCharm issue (it uses its own analyser it seems). I'm not sure if there is something that could be done about it on Textual side.

@cmckain Just so I understand it right, you made that change in Textual source? I'll probably just disable the PyCharm warning for those lines when/if that project becomes serious enough for my "green mark" OCD to take over.

@kkanekii if you are referring to my screenshot, this is JetBrains Mono, which JetBrains made for their IDEs. I do like it indeed.

from textual.

cmckain avatar cmckain commented on May 18, 2024

@abey79 No, just on the variables listed when the subclassed class is created. If the Reactive type does sometimes special, you could always make it so every interaction with the variables in question is done via the Reactive function (so no normal str or ints would be there to cause the warning).

from textual.

abey79 avatar abey79 commented on May 18, 2024

Indeed.

from textual.

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.