From c3d3ae43faf80cb12f22fcd75e7b7121e9999580 Mon Sep 17 00:00:00 2001 From: Avasam Date: Wed, 5 Jun 2024 15:45:22 -0400 Subject: [PATCH] Fixed import issues in ocx and app pywin Demos --- Pythonwin/pywin/Demos/app/demoutils.py | 4 +--- Pythonwin/pywin/Demos/ocx/__init__.py | 0 Pythonwin/pywin/Demos/ocx/demoutils.py | 4 +--- Pythonwin/pywin/Demos/ocx/ocxserialtest.py | 2 +- Pythonwin/pywin/Demos/ocx/ocxtest.py | 2 +- mypy.ini | 14 ++++++++++---- 6 files changed, 14 insertions(+), 12 deletions(-) delete mode 100644 Pythonwin/pywin/Demos/ocx/__init__.py diff --git a/Pythonwin/pywin/Demos/app/demoutils.py b/Pythonwin/pywin/Demos/app/demoutils.py index ee1fefcfad..171549a0eb 100644 --- a/Pythonwin/pywin/Demos/app/demoutils.py +++ b/Pythonwin/pywin/Demos/app/demoutils.py @@ -60,6 +60,4 @@ def NeedApp(): if __name__ == "__main__": - import demoutils - - demoutils.NotAScript() + NotAScript() diff --git a/Pythonwin/pywin/Demos/ocx/__init__.py b/Pythonwin/pywin/Demos/ocx/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/Pythonwin/pywin/Demos/ocx/demoutils.py b/Pythonwin/pywin/Demos/ocx/demoutils.py index 80d8c2450b..171549a0eb 100644 --- a/Pythonwin/pywin/Demos/ocx/demoutils.py +++ b/Pythonwin/pywin/Demos/ocx/demoutils.py @@ -60,6 +60,4 @@ def NeedApp(): if __name__ == "__main__": - from . import demoutils - - demoutils.NotAScript() + NotAScript() diff --git a/Pythonwin/pywin/Demos/ocx/ocxserialtest.py b/Pythonwin/pywin/Demos/ocx/ocxserialtest.py index 326d312c8f..ae17127ec5 100644 --- a/Pythonwin/pywin/Demos/ocx/ocxserialtest.py +++ b/Pythonwin/pywin/Demos/ocx/ocxserialtest.py @@ -127,7 +127,7 @@ def test(): if __name__ == "__main__": - from . import demoutils + import demoutils if demoutils.NeedGoodGUI(): test() diff --git a/Pythonwin/pywin/Demos/ocx/ocxtest.py b/Pythonwin/pywin/Demos/ocx/ocxtest.py index 695f708b88..31a63a3e16 100644 --- a/Pythonwin/pywin/Demos/ocx/ocxtest.py +++ b/Pythonwin/pywin/Demos/ocx/ocxtest.py @@ -238,7 +238,7 @@ def demo(): if __name__ == "__main__": - from . import demoutils + import demoutils if demoutils.NeedGoodGUI(): testall() diff --git a/mypy.ini b/mypy.ini index eb8e23ae9e..feb120eefb 100644 --- a/mypy.ini +++ b/mypy.ini @@ -10,10 +10,15 @@ implicit_reexport = true explicit_package_bases = true ; Must specify top-level packages and scripts folders for mypy to work with explicit_package_bases mypy_path = + $MYPY_CONFIG_FILE_DIR/AutoDuck, $MYPY_CONFIG_FILE_DIR/com, - $MYPY_CONFIG_FILE_DIR/win32/Lib, $MYPY_CONFIG_FILE_DIR/Pythonwin, - $MYPY_CONFIG_FILE_DIR/AutoDuck, + $MYPY_CONFIG_FILE_DIR/Pythonwin/pywin/Demos, + $MYPY_CONFIG_FILE_DIR/win32/Demos, + $MYPY_CONFIG_FILE_DIR/win32/Demos/security, + $MYPY_CONFIG_FILE_DIR/win32/Demos/service, + $MYPY_CONFIG_FILE_DIR/win32/Demos/win32wnet, + $MYPY_CONFIG_FILE_DIR/win32/Lib, $MYPY_CONFIG_FILE_DIR/win32/scripts/VersionStamp, ; TODO: Gradually type classes and functions until we can turn back check_untyped_defs to true. @@ -47,14 +52,15 @@ exclude = (?x)( ) ; C-modules that will need type-stubs -[mypy-adsi.*,dde,exchange,exchdapi,mapi,perfmon,servicemanager,win32api,win32console,win32clipboard,win32comext.adsi.adsi,win32event,win32evtlog,win32file,win32gui,win32help,win32pdh,win32process,win32ras,win32security,win32service,win32trace,win32ui,win32uiole,win32wnet,_win32sysloader,_winxptheme] +[mypy-adsi.*,dde,exchange,exchdapi,mapi,mmapfile,perfmon,servicemanager,timer,win32api,win32console,win32clipboard,win32comext.adsi.adsi,win32cred,win32event,win32evtlog,win32file,win32gui,win32help,win32net,win32pdh,win32pipe,win32print,win32process,win32profile,win32ras,win32security,win32service,win32trace,win32transaction,win32ts,win32ui,win32uiole,win32wnet,_win32sysloader,_winxptheme] ignore_missing_imports = True ; verstamp is installed from win32verstamp.py called in setup.py ; Most of win32com re-exports win32comext ; Test is a local untyped module in win32comext.axdebug ; pywin32_system32 is an empty module created in setup.py to store dlls -[mypy-verstamp,win32com.*,Test,pywin32_system32] +; OpenGL is untyped +[mypy-verstamp,win32com.*,Test,pywin32_system32,OpenGL.*] ignore_missing_imports = True ; Distutils being removed from stdlib currently causes some issues on Python 3.12