You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pyomo declares certain globals in a nontraditional manner, e.g. pyomo.core.base.set.NonNegativeReals. Pylance/Pyright reports a false positive "unknown import symbol" when you try to import them.
To Reproduce
frompyomo.environimportBinary, NonNegativeReals
These two symbols are defined here but Pylance does not recognize this, as "It's manipulating module namespaces in a way that's too dynamic for a static type checker to understand."
Static declarations or hints could be added under an if TYPE_CHECKING conditional, so they are never executed.
Rationale
Type checking catches lots of bugs. It should be encouraged and supported.
The text was updated successfully, but these errors were encountered:
Summary
Pyomo declares certain globals in a nontraditional manner, e.g. pyomo.core.base.set.NonNegativeReals. Pylance/Pyright reports a false positive "unknown import symbol" when you try to import them.
To Reproduce
These two symbols are defined here but Pylance does not recognize this, as "It's manipulating module namespaces in a way that's too dynamic for a static type checker to understand."
Static declarations or hints could be added under an
if TYPE_CHECKING
conditional, so they are never executed.Rationale
Type checking catches lots of bugs. It should be encouraged and supported.
The text was updated successfully, but these errors were encountered: