Giter Club home page Giter Club logo

Comments (6)

kedder avatar kedder commented on June 7, 2024 1

Super happy to be getting real typing via mypy-zope, by the way. It's great. And thanks for the quick replies to these tickets.

Thanks! I'm glad mypy exists and it was possible to marry zope with it. Interfaces become so much more meaningful with it! :)

from mypy-zope.

wsanchez avatar wsanchez commented on June 7, 2024

I think the actual issue is that @provider isn't handled, unlike @implementer.

from mypy-zope.

kedder avatar kedder commented on June 7, 2024

Yes, mypy-zope doesn't know anything about @provider. That said, I think your declaration is not quite correct? If instance of RequestURL implements IDependencyInjector, as registerInjector suggests, shouldn't RequestURL be declared with @implementer instead?

from mypy-zope.

wsanchez avatar wsanchez commented on June 7, 2024

Heh… I had to ask @glyph about this also. @implementer says that instances of the class will provide the interface. @provider says that the class itself does so. (Note that the methods are all class methods.)

from mypy-zope.

wsanchez avatar wsanchez commented on June 7, 2024

Super happy to be getting real typing via mypy-zope, by the way. It's great. And thanks for the quick replies to these tickets.

from mypy-zope.

kedder avatar kedder commented on June 7, 2024

Heh… I had to ask @glyph about this also. @implementer says that instances of the class will provide the interface. @provider says that the class itself does so. (Note that the methods are all class methods.)

Right, but registerInjector returns an instance of RequestURL. So, in order for registerInjector return type to be correct, an instance of RequestURL must provide the IDependencyInjector . However, it does not provide that interface. Only the class itself does, according to @provider declaration.

So, even though @provider is currently not supported by mypy-zope, I suspect the type hint on registerInjector is not entirely correct. I'd say registerInjector has to return cls, not cls(). Or, alterntively, RequestURL must implement IDependencyInjector, not provide it.

from mypy-zope.

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.