GithubHelp home page GithubHelp logo

Comments (3)

lagru avatar lagru commented on May 27, 2024 2

Thanks for the report @defe007. I can reproduce this, however, I'm not sure that this is an error on scikit-image's side. I can reproduce this without scikit-image being involved with the following minimal example:

# lib/__init__.py

import lazy_loader as lazy
__getattr__, __dir__, __all__ = lazy.attach_stub(__name__, __file__)
# lib/__init__.pyi
__all__ == ["bar"]
from ._foo import bar
# lib/_foo.py
def bar():
    print("I'm happy")
from lib import bar
bar()

Create a virtual environment with lazy_loader and pylint and inside the directory containing lib run

python test.py  # works and prints "I'm happy"
pylint test.py  # fails with 
# test.py:1:0: E0611: No name 'bar' in module 'lib' (no-name-in-module)

As this the code in question is working as intended, I'm guessing that pylint isn't recognizing the PYI file or giving it's content priority over __init__.py. So I'd probably inquire with Pylint first and lazy_loader second if this is a bug on their side.

Therefore, I'm closing this for now. But feel very welcome to add something here if you don't agree or have something to add. :)

from scikit-image.

lagru avatar lagru commented on May 27, 2024 1

No of course not. ;) Also tagging @jarrodmillman because of lazy_loader.

from scikit-image.

defe007 avatar defe007 commented on May 27, 2024

Thank you @lagru for your insight. I've opened an issue with pylint. I hope you don't mind me using your example.

from scikit-image.

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.