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
There seems to be some inconsistency with our type annotations that's causing VS Code problems. From David Anderson, who raised this issue here:
David: It would be good to limit the use of the Any type. E.g., self.unit.get_container().exec returns the Any type
Me: In this specific case, exec() does not return Any, but ExecProcess
David: It seems that the reason is that the import fails in VSCode because the ExecProcess is imported from pebble rather than ops.pebble in model.py. When I change the import from pebble to ops.pebble the type hint is correctly identified.
The other thing is that the class for the type hint (ExecProcess) is actually imported on line 63 where line 59 says from pebble import (..., ExecProcess, ...). Thats the line I had to change to from ops.pebble import (..., ExecProcess, ...) (other imports omitted), referring to model.py here
The pebble import is on line 54, I'm not sure how that line interacts with line 59
if the type hint on line 2297 in model.py was changed to "pebble.ExecProcess" VSCode is fine with that too
The text was updated successfully, but these errors were encountered:
There seems to be some inconsistency with our type annotations that's causing VS Code problems. From David Anderson, who raised this issue here:
The text was updated successfully, but these errors were encountered: