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
cat macros.py main.py > main_compiled.py
(macros gets pasted at the end of main)
Normally I'd just use import.tools or some monstrosity in macros.py like:
try:
fromtypingimportDictexceptImportError:
# noop because imported in main.py already# oh but it gets better you need to import EVERY type separately because it may fail on the first and wont import the nexttry:
fromtypingimportListexceptImportError:
# noop# madness continue
but the issue is that I lose all kinds of type hinting and semantics and autocomplete in macros.py because Pylance assumes try/imports are not resolved/unbound (and import.tools are runtime).
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
main.py
macros.py
cat macros.py main.py > main_compiled.py
(macros gets pasted at the end of main)
Normally I'd just use
import.tools
or some monstrosity inmacros.py
like:but the issue is that I lose all kinds of type hinting and semantics and autocomplete in
macros.py
because Pylance assumes try/imports are not resolved/unbound (andimport.tools
are runtime).Beta Was this translation helpful? Give feedback.
All reactions