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

warning on some imported package #6126

Closed
HadiMoosavi opened this issue Jul 12, 2024 · 1 comment
Closed

warning on some imported package #6126

HadiMoosavi opened this issue Jul 12, 2024 · 1 comment
Assignees

Comments

@HadiMoosavi
Copy link

Environment data

  • Language Server version: v2024.7.1
  • OS and version: Windows 10 Enterprise
  • Python version (& distribution if applicable, e.g. Anaconda): 3.11.0 64 bit

Code Snippet

from openseespy.opensees import *
wipe()

Repro Steps

  1. XXX

Expected behavior

wipe() is part of the package and the code runs well but I still get the warning that the method is not defined.
strangely, when I use:

import openseespy.opensees as ops
ops.wipe()

the warning goes away.

Actual behavior

There should be no warning

Logs

XXX
@github-actions github-actions bot added the needs repro Issue has not been reproduced yet label Jul 12, 2024
@debonte
Copy link
Contributor

debonte commented Jul 12, 2024

With your initial code...

from openseespy.opensees import *
wipe()

...the diagnostic that I see is "wipe" is not defined.

If I make the change you suggested...

import openseespy.opensees as ops
ops.wipe()

...I still see a diagnostic, which is effectively the same thing -- "wipe" is not a known attribute of module "openseespy.opensees"

There are a few issues that are preventing Pylance from handling openseespy well:

  1. openseepy/opensees/__init__.py, which you can get to by "go to def" on opensees, imports the platform-specific module within a sys.platform.startswith check which we do not support. We only support simple equality checks on sys.platform as specified by PEP 484.
  2. Even if that worked, the platform-specific packages are implemented in native code (not Python), so Pylance doesn't understand what symbols are exposed by those packages.

You may want to ask the openseespy maintainers if type stubs are available.

@debonte debonte added by design and removed needs repro Issue has not been reproduced yet labels Jul 12, 2024
@debonte debonte closed this as completed Jul 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants