py2docfx 0.1.13rc2012291__py3-none-any.whl → 0.1.13rc2022156__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/_modified.py +26 -4
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/_msvccompiler.py +2 -603
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/archive_util.py +48 -18
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/ccompiler.py +17 -1257
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/cmd.py +133 -41
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/command/bdist.py +19 -8
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/command/bdist_dumb.py +2 -1
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/command/bdist_rpm.py +6 -5
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/command/build.py +8 -4
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/command/build_clib.py +8 -7
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/command/build_ext.py +32 -13
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/command/build_py.py +10 -9
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/command/build_scripts.py +3 -14
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/command/check.py +1 -1
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/command/clean.py +2 -1
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/command/config.py +1 -8
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/command/install.py +22 -19
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/command/install_data.py +4 -3
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/command/install_headers.py +1 -1
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/command/install_lib.py +11 -7
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/command/install_scripts.py +4 -3
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/command/sdist.py +22 -16
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/compat/__init__.py +6 -1
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/compilers/C/base.py +1391 -0
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/compilers/C/cygwin.py +340 -0
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/compilers/C/errors.py +24 -0
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/compilers/C/msvc.py +614 -0
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/{tests/test_ccompiler.py → compilers/C/tests/test_base.py} +9 -19
- py2docfx/venv/{venv1/Lib/site-packages/setuptools/_distutils/tests/test_cygwinccompiler.py → basevenv/Lib/site-packages/setuptools/_distutils/compilers/C/tests/test_cygwin.py} +7 -12
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/{tests/test_mingwccompiler.py → compilers/C/tests/test_mingw.py} +12 -20
- py2docfx/venv/{venv1/Lib/site-packages/setuptools/_distutils/tests/test_msvccompiler.py → basevenv/Lib/site-packages/setuptools/_distutils/compilers/C/tests/test_msvc.py} +11 -12
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/{tests/test_unixccompiler.py → compilers/C/tests/test_unix.py} +5 -5
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/compilers/C/unix.py +409 -0
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/compilers/C/zos.py +230 -0
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/cygwinccompiler.py +20 -328
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/dist.py +148 -80
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/errors.py +11 -27
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/extension.py +19 -16
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/filelist.py +80 -15
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/spawn.py +22 -5
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/sysconfig.py +32 -7
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/tests/test_build_ext.py +13 -0
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/tests/test_sdist.py +1 -1
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/unixccompiler.py +2 -401
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/util.py +38 -23
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_distutils/zosccompiler.py +2 -228
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/_static.py +1 -1
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/command/editable_wheel.py +3 -3
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/command/install.py +1 -1
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/tests/config/test_setupcfg.py +2 -0
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/tests/test_build_py.py +1 -1
- py2docfx/venv/basevenv/Lib/site-packages/setuptools/unicode_utils.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/adodbapi/__init__.py +2 -1
- py2docfx/venv/venv1/Lib/site-packages/adodbapi/ado_consts.py +3 -1
- py2docfx/venv/venv1/Lib/site-packages/adodbapi/adodbapi.py +22 -26
- py2docfx/venv/venv1/Lib/site-packages/adodbapi/apibase.py +3 -4
- py2docfx/venv/venv1/Lib/site-packages/adodbapi/examples/db_print.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/adodbapi/examples/db_table_names.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/adodbapi/process_connect_string.py +7 -7
- py2docfx/venv/venv1/Lib/site-packages/adodbapi/setup.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/adodbapi/test/adodbapitest.py +21 -73
- py2docfx/venv/venv1/Lib/site-packages/adodbapi/test/adodbapitestconfig.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/adodbapi/test/dbapi20.py +11 -17
- py2docfx/venv/venv1/Lib/site-packages/adodbapi/test/setuptestframework.py +2 -1
- py2docfx/venv/venv1/Lib/site-packages/isapi/install.py +8 -11
- py2docfx/venv/venv1/Lib/site-packages/isapi/samples/redirector.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/isapi/samples/redirector_asynch.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/isapi/samples/redirector_with_filter.py +2 -1
- py2docfx/venv/venv1/Lib/site-packages/isapi/simple.py +1 -0
- py2docfx/venv/venv1/Lib/site-packages/isapi/threaded_extension.py +1 -0
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/Demos/app/basictimerapp.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/Demos/app/customprint.py +1 -3
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/Demos/app/demoutils.py +1 -3
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/Demos/cmdserver.py +2 -5
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/Demos/guidemo.py +14 -41
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/Demos/objdoc.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/Demos/ocx/demoutils.py +1 -3
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/Demos/ocx/flash.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/Demos/ocx/ocxserialtest.py +1 -2
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/Demos/ocx/ocxtest.py +1 -2
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/Demos/ocx/webbrowser.py +3 -3
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/Demos/openGLDemo.py +57 -12
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/Demos/toolbar.py +0 -1
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/debugger/configui.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/debugger/dbgcon.py +0 -1
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/debugger/debugger.py +7 -8
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/debugger/fail.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/dialogs/ideoptions.py +7 -10
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/dialogs/list.py +11 -8
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/dialogs/login.py +0 -1
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/docking/DockingBar.py +0 -1
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/framework/app.py +19 -22
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/framework/dbgcommands.py +2 -3
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/framework/editor/ModuleBrowser.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/framework/editor/__init__.py +3 -1
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/framework/editor/document.py +0 -1
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/framework/editor/editor.py +6 -6
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/framework/editor/vss.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/framework/help.py +2 -1
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/framework/interact.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/framework/intpyapp.py +5 -7
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/framework/intpydde.py +7 -2
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/framework/scriptutils.py +4 -6
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/framework/sgrepmdi.py +13 -22
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/framework/startup.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/framework/stdin.py +1 -0
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/framework/toolmenu.py +0 -2
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/idle/AutoIndent.py +3 -3
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/idle/CallTips.py +1 -3
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/mfc/activex.py +1 -2
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/mfc/dialog.py +7 -10
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/scintilla/IDLEenvironment.py +1 -5
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/scintilla/bindings.py +4 -2
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/scintilla/config.py +3 -5
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/scintilla/configui.py +2 -3
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/scintilla/document.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/scintilla/formatter.py +3 -3
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/scintilla/keycodes.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/scintilla/scintillacon.py +1178 -78
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/scintilla/view.py +17 -21
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/tools/browser.py +6 -18
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/tools/hierlist.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/_modified.py +26 -4
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/_msvccompiler.py +2 -603
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/archive_util.py +48 -18
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/ccompiler.py +17 -1257
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/cmd.py +133 -41
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/command/bdist.py +19 -8
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/command/bdist_dumb.py +2 -1
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/command/bdist_rpm.py +6 -5
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/command/build.py +8 -4
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/command/build_clib.py +8 -7
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/command/build_ext.py +32 -13
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/command/build_py.py +10 -9
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/command/build_scripts.py +3 -14
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/command/check.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/command/clean.py +2 -1
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/command/config.py +1 -8
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/command/install.py +22 -19
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/command/install_data.py +4 -3
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/command/install_headers.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/command/install_lib.py +11 -7
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/command/install_scripts.py +4 -3
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/command/sdist.py +22 -16
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/compat/__init__.py +6 -1
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/compilers/C/base.py +1391 -0
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/compilers/C/cygwin.py +340 -0
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/compilers/C/errors.py +24 -0
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/compilers/C/msvc.py +614 -0
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/{tests/test_ccompiler.py → compilers/C/tests/test_base.py} +9 -19
- py2docfx/venv/{basevenv/Lib/site-packages/setuptools/_distutils/tests/test_cygwinccompiler.py → venv1/Lib/site-packages/setuptools/_distutils/compilers/C/tests/test_cygwin.py} +7 -12
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/{tests/test_mingwccompiler.py → compilers/C/tests/test_mingw.py} +12 -20
- py2docfx/venv/{basevenv/Lib/site-packages/setuptools/_distutils/tests/test_msvccompiler.py → venv1/Lib/site-packages/setuptools/_distutils/compilers/C/tests/test_msvc.py} +11 -12
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/{tests/test_unixccompiler.py → compilers/C/tests/test_unix.py} +5 -5
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/compilers/C/unix.py +409 -0
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/compilers/C/zos.py +230 -0
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/cygwinccompiler.py +20 -328
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/dist.py +148 -80
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/errors.py +11 -27
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/extension.py +19 -16
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/filelist.py +80 -15
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/spawn.py +22 -5
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/sysconfig.py +32 -7
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/tests/test_build_ext.py +13 -0
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/tests/test_sdist.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/unixccompiler.py +2 -401
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/util.py +38 -23
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_distutils/zosccompiler.py +2 -228
- py2docfx/venv/venv1/Lib/site-packages/setuptools/_static.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/setuptools/command/editable_wheel.py +3 -3
- py2docfx/venv/venv1/Lib/site-packages/setuptools/command/install.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/setuptools/tests/config/test_setupcfg.py +2 -0
- py2docfx/venv/venv1/Lib/site-packages/setuptools/tests/test_build_py.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/setuptools/unicode_utils.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/win32/Demos/EvtFormatMessage.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/win32/Demos/EvtSubscribe_push.py +8 -1
- py2docfx/venv/venv1/Lib/site-packages/win32/Demos/GetSaveFileName.py +8 -8
- py2docfx/venv/venv1/Lib/site-packages/win32/Demos/c_extension/setup.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/win32/Demos/dde/ddeclient.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/win32/Demos/dde/ddeserver.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/win32/Demos/getfilever.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/win32/Demos/pipes/runproc.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/win32/Demos/rastest.py +4 -6
- py2docfx/venv/venv1/Lib/site-packages/win32/Demos/security/GetTokenInformation.py +4 -4
- py2docfx/venv/venv1/Lib/site-packages/win32/Demos/security/account_rights.py +0 -2
- py2docfx/venv/venv1/Lib/site-packages/win32/Demos/security/explicit_entries.py +0 -1
- py2docfx/venv/venv1/Lib/site-packages/win32/Demos/security/get_policy_info.py +0 -3
- py2docfx/venv/venv1/Lib/site-packages/win32/Demos/security/list_rights.py +0 -2
- py2docfx/venv/venv1/Lib/site-packages/win32/Demos/security/localized_names.py +7 -2
- py2docfx/venv/venv1/Lib/site-packages/win32/Demos/security/query_information.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/win32/Demos/security/set_file_audit.py +1 -2
- py2docfx/venv/venv1/Lib/site-packages/win32/Demos/security/set_file_owner.py +0 -1
- py2docfx/venv/venv1/Lib/site-packages/win32/Demos/security/set_policy_info.py +0 -3
- py2docfx/venv/venv1/Lib/site-packages/win32/Demos/security/setkernelobjectsecurity.py +0 -1
- py2docfx/venv/venv1/Lib/site-packages/win32/Demos/security/setsecurityinfo.py +0 -1
- py2docfx/venv/venv1/Lib/site-packages/win32/Demos/security/setuserobjectsecurity.py +0 -1
- py2docfx/venv/venv1/Lib/site-packages/win32/Demos/security/sspi/fetch_url.py +3 -3
- py2docfx/venv/venv1/Lib/site-packages/win32/Demos/security/sspi/simple_auth.py +3 -3
- py2docfx/venv/venv1/Lib/site-packages/win32/Demos/security/sspi/socket_server.py +1 -2
- py2docfx/venv/venv1/Lib/site-packages/win32/Demos/service/pipeTestService.py +10 -9
- py2docfx/venv/venv1/Lib/site-packages/win32/Demos/service/pipeTestServiceClient.py +6 -3
- py2docfx/venv/venv1/Lib/site-packages/win32/Demos/win32clipboardDemo.py +17 -5
- py2docfx/venv/venv1/Lib/site-packages/win32/Demos/win32comport_demo.py +32 -2
- py2docfx/venv/venv1/Lib/site-packages/win32/Demos/win32console_demo.py +1 -4
- py2docfx/venv/venv1/Lib/site-packages/win32/Demos/win32gui_devicenotify.py +0 -1
- py2docfx/venv/venv1/Lib/site-packages/win32/Demos/win32gui_menu.py +60 -5
- py2docfx/venv/venv1/Lib/site-packages/win32/Demos/win32gui_taskbar.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/win32/Demos/win32netdemo.py +2 -5
- py2docfx/venv/venv1/Lib/site-packages/win32/Demos/win32ts_logoff_disconnected.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/win32/Demos/win32wnet/testwnet.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/win32/lib/commctrl.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/win32/lib/netbios.py +8 -10
- py2docfx/venv/venv1/Lib/site-packages/win32/lib/pywin32_bootstrap.py +2 -10
- py2docfx/venv/venv1/Lib/site-packages/win32/lib/pywin32_testutil.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/win32/lib/pywintypes.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/win32/lib/regutil.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/win32/lib/sspi.py +3 -3
- py2docfx/venv/venv1/Lib/site-packages/win32/lib/win2kras.py +14 -7
- py2docfx/venv/venv1/Lib/site-packages/win32/lib/win32con.py +16 -35
- py2docfx/venv/venv1/Lib/site-packages/win32/lib/win32cryptcon.py +1 -4
- py2docfx/venv/venv1/Lib/site-packages/win32/lib/win32evtlogutil.py +1 -2
- py2docfx/venv/venv1/Lib/site-packages/win32/lib/win32gui_struct.py +6 -6
- py2docfx/venv/venv1/Lib/site-packages/win32/lib/win32pdhquery.py +10 -11
- py2docfx/venv/venv1/Lib/site-packages/win32/lib/win32pdhutil.py +5 -5
- py2docfx/venv/venv1/Lib/site-packages/win32/lib/win32rcparser.py +1 -0
- py2docfx/venv/venv1/Lib/site-packages/win32/lib/win32serviceutil.py +4 -6
- py2docfx/venv/venv1/Lib/site-packages/win32/lib/win32timezone.py +304 -121
- py2docfx/venv/venv1/Lib/site-packages/win32/lib/win32verstamp.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/win32/lib/winerror.py +4926 -604
- py2docfx/venv/venv1/Lib/site-packages/win32/lib/winxptheme.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/win32/scripts/h2py.py +194 -0
- py2docfx/venv/venv1/Lib/site-packages/win32/scripts/pywin32_postinstall.py +733 -0
- py2docfx/venv/venv1/Lib/site-packages/win32/scripts/pywin32_testall.py +120 -0
- py2docfx/venv/venv1/Lib/site-packages/win32/scripts/regsetup.py +4 -7
- py2docfx/venv/venv1/Lib/site-packages/win32/scripts/setup_d.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/win32/test/handles.py +13 -5
- py2docfx/venv/venv1/Lib/site-packages/win32/test/test_clipboard.py +12 -1
- py2docfx/venv/venv1/Lib/site-packages/win32/test/test_sspi.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/win32/test/test_win32api.py +8 -4
- py2docfx/venv/venv1/Lib/site-packages/win32/test/test_win32clipboard.py +2 -3
- py2docfx/venv/venv1/Lib/site-packages/win32/test/test_win32cred.py +0 -1
- py2docfx/venv/venv1/Lib/site-packages/win32/test/test_win32crypt.py +16 -3
- py2docfx/venv/venv1/Lib/site-packages/win32/test/test_win32file.py +24 -8
- py2docfx/venv/venv1/Lib/site-packages/win32/test/test_win32gui.py +0 -1
- py2docfx/venv/venv1/Lib/site-packages/win32/test/test_win32guistruct.py +2 -5
- py2docfx/venv/venv1/Lib/site-packages/win32/test/test_win32inet.py +23 -6
- py2docfx/venv/venv1/Lib/site-packages/win32/test/test_win32net.py +0 -1
- py2docfx/venv/venv1/Lib/site-packages/win32/test/test_win32ts.py +19 -0
- py2docfx/venv/venv1/Lib/site-packages/win32/winxpgui.py +3 -11
- py2docfx/venv/venv1/Lib/site-packages/win32com/client/CLSIDToClass.py +3 -1
- py2docfx/venv/venv1/Lib/site-packages/win32com/client/__init__.py +97 -65
- py2docfx/venv/venv1/Lib/site-packages/win32com/client/build.py +24 -24
- py2docfx/venv/venv1/Lib/site-packages/win32com/client/combrowse.py +17 -33
- py2docfx/venv/venv1/Lib/site-packages/win32com/client/dynamic.py +14 -14
- py2docfx/venv/venv1/Lib/site-packages/win32com/client/gencache.py +30 -12
- py2docfx/venv/venv1/Lib/site-packages/win32com/client/genpy.py +50 -98
- py2docfx/venv/venv1/Lib/site-packages/win32com/client/makepy.py +12 -8
- py2docfx/venv/venv1/Lib/site-packages/win32com/client/selecttlb.py +3 -4
- py2docfx/venv/venv1/Lib/site-packages/win32com/client/util.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/win32com/demos/dump_clipboard.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/win32com/demos/excelAddin.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/win32com/demos/excelRTDServer.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/win32com/demos/iebutton.py +0 -3
- py2docfx/venv/venv1/Lib/site-packages/win32com/demos/ietoolbar.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/win32com/demos/outlookAddin.py +1 -3
- py2docfx/venv/venv1/Lib/site-packages/win32com/makegw/makegw.py +48 -56
- py2docfx/venv/venv1/Lib/site-packages/win32com/makegw/makegwenum.py +2 -6
- py2docfx/venv/venv1/Lib/site-packages/win32com/makegw/makegwparse.py +9 -11
- py2docfx/venv/venv1/Lib/site-packages/win32com/olectl.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/win32com/server/connect.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/win32com/server/dispatcher.py +20 -24
- py2docfx/venv/venv1/Lib/site-packages/win32com/server/exception.py +8 -8
- py2docfx/venv/venv1/Lib/site-packages/win32com/server/policy.py +4 -18
- py2docfx/venv/venv1/Lib/site-packages/win32com/server/register.py +5 -6
- py2docfx/venv/venv1/Lib/site-packages/win32com/servers/dictionary.py +2 -5
- py2docfx/venv/venv1/Lib/site-packages/win32com/servers/interp.py +7 -7
- py2docfx/venv/venv1/Lib/site-packages/win32com/servers/test_pycomtest.py +0 -1
- py2docfx/venv/venv1/Lib/site-packages/win32com/test/GenTestScripts.py +2 -4
- py2docfx/venv/venv1/Lib/site-packages/win32com/test/errorSemantics.py +3 -3
- py2docfx/venv/venv1/Lib/site-packages/win32com/test/pippo_server.py +1 -4
- py2docfx/venv/venv1/Lib/site-packages/win32com/test/testADOEvents.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/win32com/test/testAXScript.py +1 -2
- py2docfx/venv/venv1/Lib/site-packages/win32com/test/testDictionary.py +4 -3
- py2docfx/venv/venv1/Lib/site-packages/win32com/test/testDynamic.py +3 -5
- py2docfx/venv/venv1/Lib/site-packages/win32com/test/testExchange.py +2 -7
- py2docfx/venv/venv1/Lib/site-packages/win32com/test/testGatewayAddresses.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/win32com/test/testIterators.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/win32com/test/testMSOffice.py +40 -57
- py2docfx/venv/venv1/Lib/site-packages/win32com/test/testMSOfficeEvents.py +3 -3
- py2docfx/venv/venv1/Lib/site-packages/win32com/test/testPersist.py +7 -7
- py2docfx/venv/venv1/Lib/site-packages/win32com/test/testPippo.py +2 -3
- py2docfx/venv/venv1/Lib/site-packages/win32com/test/testPyComTest.py +143 -7
- py2docfx/venv/venv1/Lib/site-packages/win32com/test/testServers.py +1 -2
- py2docfx/venv/venv1/Lib/site-packages/win32com/test/testall.py +1 -2
- py2docfx/venv/venv1/Lib/site-packages/win32com/test/testmakepy.py +1 -2
- py2docfx/venv/venv1/Lib/site-packages/win32com/test/testvb.py +12 -8
- py2docfx/venv/venv1/Lib/site-packages/win32com/test/util.py +1 -3
- py2docfx/venv/venv1/Lib/site-packages/win32com/universal.py +1 -3
- py2docfx/venv/venv1/Lib/site-packages/win32com/util.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/win32comext/adsi/demos/scp.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/win32comext/adsi/demos/search.py +0 -1
- py2docfx/venv/venv1/Lib/site-packages/win32comext/authorization/demos/EditSecurity.py +1 -24
- py2docfx/venv/venv1/Lib/site-packages/win32comext/authorization/demos/EditServiceSecurity.py +0 -20
- py2docfx/venv/venv1/Lib/site-packages/win32comext/axdebug/adb.py +2 -8
- py2docfx/venv/venv1/Lib/site-packages/win32comext/axdebug/codecontainer.py +16 -12
- py2docfx/venv/venv1/Lib/site-packages/win32comext/axdebug/contexts.py +1 -3
- py2docfx/venv/venv1/Lib/site-packages/win32comext/axdebug/debugger.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/win32comext/axdebug/documents.py +2 -3
- py2docfx/venv/venv1/Lib/site-packages/win32comext/axdebug/dump.py +2 -4
- py2docfx/venv/venv1/Lib/site-packages/win32comext/axdebug/expressions.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/win32comext/axdebug/util.py +7 -14
- py2docfx/venv/venv1/Lib/site-packages/win32comext/axscript/client/debug.py +2 -14
- py2docfx/venv/venv1/Lib/site-packages/win32comext/axscript/client/error.py +4 -5
- py2docfx/venv/venv1/Lib/site-packages/win32comext/axscript/client/framework.py +5 -5
- py2docfx/venv/venv1/Lib/site-packages/win32comext/axscript/client/pydumper.py +0 -1
- py2docfx/venv/venv1/Lib/site-packages/win32comext/axscript/client/pyscript.py +5 -10
- py2docfx/venv/venv1/Lib/site-packages/win32comext/axscript/client/scriptdispatch.py +3 -4
- py2docfx/venv/venv1/Lib/site-packages/win32comext/axscript/server/axsite.py +1 -2
- py2docfx/venv/venv1/Lib/site-packages/win32comext/axscript/test/leakTest.py +2 -3
- py2docfx/venv/venv1/Lib/site-packages/win32comext/axscript/test/testHost4Dbg.py +0 -3
- py2docfx/venv/venv1/Lib/site-packages/win32comext/bits/test/test_bits.py +3 -3
- py2docfx/venv/venv1/Lib/site-packages/win32comext/ifilter/demo/filterDemo.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/win32comext/mapi/demos/mapisend.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/win32comext/mapi/emsabtags.py +1 -0
- py2docfx/venv/venv1/Lib/site-packages/win32comext/mapi/mapitags.py +1 -3
- py2docfx/venv/venv1/Lib/site-packages/win32comext/mapi/mapiutil.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/win32comext/propsys/test/testpropsys.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/win32comext/shell/demos/IFileOperationProgressSink.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/win32comext/shell/demos/ITransferAdviseSink.py +5 -3
- py2docfx/venv/venv1/Lib/site-packages/win32comext/shell/demos/servers/column_provider.py +0 -1
- py2docfx/venv/venv1/Lib/site-packages/win32comext/shell/demos/servers/copy_hook.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/win32comext/shell/demos/servers/empty_volume_cache.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/win32comext/shell/demos/servers/folder_view.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/win32comext/shell/demos/servers/icon_handler.py +1 -2
- py2docfx/venv/venv1/Lib/site-packages/win32comext/shell/demos/servers/shell_view.py +4 -5
- py2docfx/venv/venv1/Lib/site-packages/win32comext/taskscheduler/test/test_addtask_2.py +0 -1
- py2docfx/venv/venv1/Scripts/pywin32_postinstall.py +77 -122
- py2docfx/venv/venv1/Scripts/pywin32_testall.py +4 -9
- {py2docfx-0.1.13rc2012291.dist-info → py2docfx-0.1.13rc2022156.dist-info}/METADATA +1 -1
- {py2docfx-0.1.13rc2012291.dist-info → py2docfx-0.1.13rc2022156.dist-info}/RECORD +342 -329
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/Demos/ocx/__init__.py +0 -0
- py2docfx/venv/venv1/Lib/site-packages/pythonwin/pywin/framework/mdi_pychecker.py +0 -850
- py2docfx/venv/venv1/Lib/site-packages/win32com/test/testNetscape.py +0 -24
- {py2docfx-0.1.13rc2012291.dist-info → py2docfx-0.1.13rc2022156.dist-info}/WHEEL +0 -0
- {py2docfx-0.1.13rc2012291.dist-info → py2docfx-0.1.13rc2022156.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,3 @@
|
|
1
|
-
# -*- coding: UTF-8 -*-
|
2
|
-
from __future__ import annotations
|
3
|
-
|
4
1
|
"""
|
5
2
|
win32timezone:
|
6
3
|
Module for handling datetime.tzinfo time zones using the windows
|
@@ -33,7 +30,7 @@ True
|
|
33
30
|
(note that the result of utcoffset call will be different based on when now was
|
34
31
|
generated, unless standard time is always used)
|
35
32
|
|
36
|
-
>>> now = datetime.datetime.now(TimeZoneInfo('Mountain Standard Time', True))
|
33
|
+
>>> now = datetime.datetime.now(win32timezone.TimeZoneInfo('Mountain Standard Time', True))
|
37
34
|
>>> now.utcoffset()
|
38
35
|
datetime.timedelta(days=-1, seconds=61200)
|
39
36
|
|
@@ -77,10 +74,15 @@ True
|
|
77
74
|
|
78
75
|
It's possible to construct a TimeZoneInfo from a TimeZoneDescription
|
79
76
|
including the currently-defined zone.
|
80
|
-
>>>
|
77
|
+
>>> code, info = win32timezone.TimeZoneDefinition.current()
|
78
|
+
>>> tz = win32timezone.TimeZoneInfo(info, not code)
|
81
79
|
>>> tz == pickle.loads(pickle.dumps(tz))
|
82
80
|
True
|
83
81
|
|
82
|
+
Although it's easier to use TimeZoneInfo.local() to get the local info
|
83
|
+
>>> tz == TimeZoneInfo.local()
|
84
|
+
True
|
85
|
+
|
84
86
|
>>> aest = win32timezone.TimeZoneInfo('AUS Eastern Standard Time')
|
85
87
|
>>> est = win32timezone.TimeZoneInfo('E. Australia Standard Time')
|
86
88
|
>>> dt = datetime.datetime(2006, 11, 11, 1, 0, 0, tzinfo = aest)
|
@@ -99,7 +101,7 @@ True
|
|
99
101
|
'2007-06-13 01:00:00'
|
100
102
|
|
101
103
|
Microsoft now has a patch for handling time zones in 2007 (see
|
102
|
-
|
104
|
+
https://learn.microsoft.com/en-us/troubleshoot/windows-client/system-management-components/daylight-saving-time-help-support)
|
103
105
|
|
104
106
|
As a result, patched systems will give an incorrect result for
|
105
107
|
dates prior to the designated year except for Vista and its
|
@@ -233,28 +235,53 @@ datetime.datetime(2011, 11, 6, 1, 0, tzinfo=TimeZoneInfo('Pacific Standard Time'
|
|
233
235
|
|
234
236
|
"""
|
235
237
|
|
238
|
+
from __future__ import annotations
|
239
|
+
|
236
240
|
import datetime
|
241
|
+
import functools
|
237
242
|
import logging
|
238
243
|
import operator
|
239
244
|
import re
|
240
245
|
import struct
|
241
246
|
import winreg
|
242
247
|
from itertools import count
|
243
|
-
from typing import
|
248
|
+
from typing import (
|
249
|
+
TYPE_CHECKING,
|
250
|
+
Any,
|
251
|
+
Callable,
|
252
|
+
ClassVar,
|
253
|
+
Dict,
|
254
|
+
Generator,
|
255
|
+
Iterable,
|
256
|
+
Mapping,
|
257
|
+
TypeVar,
|
258
|
+
overload,
|
259
|
+
)
|
244
260
|
|
245
261
|
import win32api
|
246
262
|
|
263
|
+
if TYPE_CHECKING:
|
264
|
+
from _operator import _SupportsComparison
|
265
|
+
|
266
|
+
from _typeshed import SupportsKeysAndGetItem
|
267
|
+
from typing_extensions import Self
|
268
|
+
|
247
269
|
__author__ = "Jason R. Coombs <jaraco@jaraco.com>"
|
248
270
|
|
271
|
+
_RangeMapKT = TypeVar("_RangeMapKT", bound="_SupportsComparison")
|
272
|
+
|
273
|
+
_T = TypeVar("_T")
|
274
|
+
_VT = TypeVar("_VT")
|
275
|
+
|
249
276
|
log = logging.getLogger(__file__)
|
250
277
|
|
251
278
|
|
252
279
|
# A couple of objects for working with objects as if they were native C-type
|
253
280
|
# structures.
|
254
281
|
class _SimpleStruct:
|
255
|
-
_fields_: list[tuple[str, type]] = [] # must be overridden by subclasses
|
282
|
+
_fields_: ClassVar[list[tuple[str, type]]] = [] # must be overridden by subclasses
|
256
283
|
|
257
|
-
def __init__(self, *args, **kw):
|
284
|
+
def __init__(self, *args, **kw) -> None:
|
258
285
|
for i, (name, typ) in enumerate(self._fields_):
|
259
286
|
def_arg = None
|
260
287
|
if i < len(args):
|
@@ -274,10 +301,10 @@ class _SimpleStruct:
|
|
274
301
|
def_val = typ(*def_arg)
|
275
302
|
setattr(self, name, def_val)
|
276
303
|
|
277
|
-
def field_names(self):
|
304
|
+
def field_names(self) -> list[str]:
|
278
305
|
return [f[0] for f in self._fields_]
|
279
306
|
|
280
|
-
def __eq__(self, other):
|
307
|
+
def __eq__(self, other) -> bool:
|
281
308
|
if not hasattr(other, "_fields_"):
|
282
309
|
return False
|
283
310
|
if self._fields_ != other._fields_:
|
@@ -287,7 +314,7 @@ class _SimpleStruct:
|
|
287
314
|
return False
|
288
315
|
return True
|
289
316
|
|
290
|
-
def __ne__(self, other):
|
317
|
+
def __ne__(self, other: object) -> bool:
|
291
318
|
return not self.__eq__(other)
|
292
319
|
|
293
320
|
|
@@ -316,7 +343,7 @@ class TIME_ZONE_INFORMATION(_SimpleStruct):
|
|
316
343
|
]
|
317
344
|
|
318
345
|
|
319
|
-
class DYNAMIC_TIME_ZONE_INFORMATION(
|
346
|
+
class DYNAMIC_TIME_ZONE_INFORMATION(TIME_ZONE_INFORMATION):
|
320
347
|
_fields_ = TIME_ZONE_INFORMATION._fields_ + [
|
321
348
|
("key_name", str),
|
322
349
|
("dynamic_daylight_time_disabled", bool),
|
@@ -332,12 +359,27 @@ class TimeZoneDefinition(DYNAMIC_TIME_ZONE_INFORMATION):
|
|
332
359
|
additional bias applies (standard_bias and daylight_bias).
|
333
360
|
"""
|
334
361
|
|
335
|
-
def __init__(self, *args, **kwargs):
|
362
|
+
def __init__(self, *args, **kwargs) -> None:
|
336
363
|
"""
|
337
|
-
|
364
|
+
>>> test_args = [1] * 44
|
365
|
+
|
366
|
+
Try to construct a TimeZoneDefinition from:
|
367
|
+
|
338
368
|
a) [DYNAMIC_]TIME_ZONE_INFORMATION args
|
339
|
-
|
369
|
+
>>> TimeZoneDefinition(*test_args).bias
|
370
|
+
datetime.timedelta(seconds=60)
|
371
|
+
|
372
|
+
b) another TimeZoneDefinition or [DYNAMIC_]TIME_ZONE_INFORMATION
|
373
|
+
>>> TimeZoneDefinition(TimeZoneDefinition(*test_args)).bias
|
374
|
+
datetime.timedelta(seconds=60)
|
375
|
+
>>> TimeZoneDefinition(DYNAMIC_TIME_ZONE_INFORMATION(*test_args)).bias
|
376
|
+
datetime.timedelta(seconds=60)
|
377
|
+
>>> TimeZoneDefinition(TIME_ZONE_INFORMATION(*test_args)).bias
|
378
|
+
datetime.timedelta(seconds=60)
|
379
|
+
|
340
380
|
c) a byte structure (using _from_bytes)
|
381
|
+
>>> TimeZoneDefinition(bytes(test_args)).bias
|
382
|
+
datetime.timedelta(days=11696, seconds=46140)
|
341
383
|
"""
|
342
384
|
try:
|
343
385
|
super().__init__(*args, **kwargs)
|
@@ -357,7 +399,7 @@ class TimeZoneDefinition(DYNAMIC_TIME_ZONE_INFORMATION):
|
|
357
399
|
except TypeError:
|
358
400
|
pass
|
359
401
|
|
360
|
-
raise TypeError("Invalid arguments for
|
402
|
+
raise TypeError(f"Invalid arguments for {self.__class__}")
|
361
403
|
|
362
404
|
def __init_from_bytes(
|
363
405
|
self,
|
@@ -384,45 +426,55 @@ class TimeZoneDefinition(DYNAMIC_TIME_ZONE_INFORMATION):
|
|
384
426
|
daylight_disabled,
|
385
427
|
)
|
386
428
|
|
387
|
-
def __init_from_other(self, other):
|
429
|
+
def __init_from_other(self, other: TIME_ZONE_INFORMATION) -> None:
|
388
430
|
if not isinstance(other, TIME_ZONE_INFORMATION):
|
389
431
|
raise TypeError("Not a TIME_ZONE_INFORMATION")
|
390
432
|
for name in other.field_names():
|
391
433
|
# explicitly get the value from the underlying structure
|
392
|
-
value = super(
|
434
|
+
value = super(TIME_ZONE_INFORMATION, other).__getattribute__(name)
|
393
435
|
setattr(self, name, value)
|
394
436
|
# consider instead of the loop above just copying the memory directly
|
395
437
|
# size = max(ctypes.sizeof(DYNAMIC_TIME_ZONE_INFO), ctypes.sizeof(other))
|
396
438
|
# ctypes.memmove(ctypes.addressof(self), other, size)
|
397
439
|
|
398
|
-
|
440
|
+
if TYPE_CHECKING:
|
441
|
+
# TIME_ZONE_INFORMATION fields as obtained by __getattribute__
|
442
|
+
bias: datetime.timedelta
|
443
|
+
standard_name: str
|
444
|
+
standard_start: SYSTEMTIME
|
445
|
+
standard_bias: datetime.timedelta
|
446
|
+
daylight_name: str
|
447
|
+
daylight_start: SYSTEMTIME
|
448
|
+
daylight_bias: datetime.timedelta
|
449
|
+
|
450
|
+
def __getattribute__(self, attr: str) -> Any:
|
399
451
|
value = super().__getattribute__(attr)
|
400
452
|
if "bias" in attr:
|
401
453
|
value = datetime.timedelta(minutes=value)
|
402
454
|
return value
|
403
455
|
|
404
456
|
@classmethod
|
405
|
-
def current(
|
457
|
+
def current(cls):
|
406
458
|
"Windows Platform SDK GetTimeZoneInformation"
|
407
459
|
code, tzi = win32api.GetTimeZoneInformation(True)
|
408
|
-
return code,
|
460
|
+
return code, cls(*tzi)
|
409
461
|
|
410
|
-
def set(self):
|
462
|
+
def set(self) -> None:
|
411
463
|
tzi = tuple(getattr(self, n) for n, t in self._fields_)
|
412
464
|
win32api.SetTimeZoneInformation(tzi)
|
413
465
|
|
414
|
-
def copy(self):
|
466
|
+
def copy(self) -> Self:
|
415
467
|
# XXX - this is no longer a copy!
|
416
468
|
return self.__class__(self)
|
417
469
|
|
418
|
-
def locate_daylight_start(self, year):
|
470
|
+
def locate_daylight_start(self, year) -> datetime.datetime:
|
419
471
|
return self._locate_day(year, self.daylight_start)
|
420
472
|
|
421
|
-
def locate_standard_start(self, year):
|
473
|
+
def locate_standard_start(self, year) -> datetime.datetime:
|
422
474
|
return self._locate_day(year, self.standard_start)
|
423
475
|
|
424
476
|
@staticmethod
|
425
|
-
def _locate_day(year, cutoff):
|
477
|
+
def _locate_day(year, cutoff) -> datetime.datetime:
|
426
478
|
"""
|
427
479
|
Takes a SYSTEMTIME object, such as retrieved from a TIME_ZONE_INFORMATION
|
428
480
|
structure or call to GetTimeZoneInformation and interprets it based on the given
|
@@ -442,7 +494,7 @@ class TimeZoneDefinition(DYNAMIC_TIME_ZONE_INFORMATION):
|
|
442
494
|
"""
|
443
495
|
# MS stores Sunday as 0, Python datetime stores Monday as zero
|
444
496
|
target_weekday = (cutoff.day_of_week + 6) % 7
|
445
|
-
# For SYSTEMTIMEs relating to time zone
|
497
|
+
# For SYSTEMTIMEs relating to time zone information, cutoff.day
|
446
498
|
# is the week of the month
|
447
499
|
week_of_month = cutoff.day
|
448
500
|
# so the following is the first day of that week
|
@@ -489,20 +541,42 @@ class TimeZoneInfo(datetime.tzinfo):
|
|
489
541
|
>>> offsets = set(tzi.utcoffset(year) for year in subsequent_years)
|
490
542
|
>>> len(offsets)
|
491
543
|
1
|
544
|
+
|
545
|
+
Cannot create a `TimeZoneInfo` with an invalid name.
|
546
|
+
>>> TimeZoneInfo('Does not exist')
|
547
|
+
Traceback (most recent call last):
|
548
|
+
...
|
549
|
+
ValueError: Timezone Name 'Does not exist' not found
|
550
|
+
>>> TimeZoneInfo(None)
|
551
|
+
Traceback (most recent call last):
|
552
|
+
...
|
553
|
+
ValueError: subkey name cannot be empty
|
554
|
+
>>> TimeZoneInfo("")
|
555
|
+
Traceback (most recent call last):
|
556
|
+
...
|
557
|
+
ValueError: subkey name cannot be empty
|
492
558
|
"""
|
493
559
|
|
494
560
|
# this key works for WinNT+, but not for the Win95 line.
|
495
561
|
tzRegKey = r"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones"
|
496
562
|
|
497
|
-
def __init__(
|
563
|
+
def __init__(
|
564
|
+
self,
|
565
|
+
param: str | TimeZoneDefinition,
|
566
|
+
fix_standard_time: bool = False,
|
567
|
+
) -> None:
|
498
568
|
if isinstance(param, TimeZoneDefinition):
|
499
569
|
self._LoadFromTZI(param)
|
500
|
-
|
570
|
+
else:
|
501
571
|
self.timeZoneName = param
|
502
572
|
self._LoadInfoFromKey()
|
503
573
|
self.fixedStandardTime = fix_standard_time
|
504
574
|
|
505
|
-
|
575
|
+
# For tzinfo pickle support
|
576
|
+
def __getinitargs__(self) -> tuple[TimeZoneDefinition, bool]:
|
577
|
+
return (self.staticInfo, self.fixedStandardTime)
|
578
|
+
|
579
|
+
def _FindTimeZoneKey(self) -> _RegKeyDict:
|
506
580
|
"""Find the registry key for the time zone name (self.timeZoneName)."""
|
507
581
|
# for multi-language compatability, match the time zone name in the
|
508
582
|
# "Std" key of the time zone key.
|
@@ -513,11 +587,12 @@ class TimeZoneInfo(datetime.tzinfo):
|
|
513
587
|
key = _RegKeyDict.open(winreg.HKEY_LOCAL_MACHINE, self.tzRegKey)
|
514
588
|
try:
|
515
589
|
result = key.subkey(timeZoneName)
|
516
|
-
except
|
517
|
-
|
590
|
+
except FileNotFoundError:
|
591
|
+
# Don't catch ValueError, keep the original error message
|
592
|
+
raise ValueError(f"Timezone Name {timeZoneName!r} not found")
|
518
593
|
return result
|
519
594
|
|
520
|
-
def _LoadInfoFromKey(self):
|
595
|
+
def _LoadInfoFromKey(self) -> None:
|
521
596
|
"""Loads the information from an opened time zone registry key
|
522
597
|
into relevant fields of this TZI object"""
|
523
598
|
key = self._FindTimeZoneKey()
|
@@ -527,20 +602,20 @@ class TimeZoneInfo(datetime.tzinfo):
|
|
527
602
|
self.staticInfo = TimeZoneDefinition(key["TZI"])
|
528
603
|
self._LoadDynamicInfoFromKey(key)
|
529
604
|
|
530
|
-
def _LoadFromTZI(self, tzi):
|
605
|
+
def _LoadFromTZI(self, tzi: TimeZoneDefinition):
|
531
606
|
self.timeZoneName = tzi.standard_name
|
532
607
|
self.displayName = "Unknown"
|
533
608
|
self.standardName = tzi.standard_name
|
534
609
|
self.daylightName = tzi.daylight_name
|
535
610
|
self.staticInfo = tzi
|
536
611
|
|
537
|
-
def _LoadDynamicInfoFromKey(self, key):
|
612
|
+
def _LoadDynamicInfoFromKey(self, key) -> None:
|
538
613
|
"""
|
539
614
|
>>> tzi = TimeZoneInfo('Central Standard Time')
|
540
615
|
|
541
616
|
Here's how the RangeMap is supposed to work:
|
542
617
|
>>> m = RangeMap(zip([2006,2007], 'BC'),
|
543
|
-
... sort_params =
|
618
|
+
... sort_params = {"reverse": True},
|
544
619
|
... key_match_comparator=operator.ge)
|
545
620
|
>>> m.get(2000, 'A')
|
546
621
|
'A'
|
@@ -571,44 +646,73 @@ class TimeZoneInfo(datetime.tzinfo):
|
|
571
646
|
"""
|
572
647
|
try:
|
573
648
|
info = key.subkey("Dynamic DST")
|
574
|
-
except
|
649
|
+
except FileNotFoundError:
|
575
650
|
return
|
576
651
|
del info["FirstEntry"]
|
577
652
|
del info["LastEntry"]
|
578
|
-
|
579
|
-
|
653
|
+
|
654
|
+
infos = [
|
655
|
+
(int(year), TimeZoneDefinition(values)) for year, values in info.items()
|
656
|
+
]
|
580
657
|
# create a range mapping that searches by descending year and matches
|
581
658
|
# if the target year is greater or equal.
|
582
659
|
self.dynamicInfo = RangeMap(
|
583
|
-
|
660
|
+
infos,
|
584
661
|
sort_params={"reverse": True},
|
585
662
|
key_match_comparator=operator.ge,
|
586
663
|
)
|
587
664
|
|
588
|
-
def __repr__(self):
|
589
|
-
result = f"{self.__class__.__name__}({
|
665
|
+
def __repr__(self) -> str:
|
666
|
+
result = f"{self.__class__.__name__}({self.timeZoneName!r}"
|
590
667
|
if self.fixedStandardTime:
|
591
668
|
result += ", True"
|
592
669
|
result += ")"
|
593
670
|
return result
|
594
671
|
|
595
|
-
def __str__(self):
|
672
|
+
def __str__(self) -> str:
|
596
673
|
return self.displayName
|
597
674
|
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
675
|
+
@overload # type: ignore[override] # Split definition into overrides
|
676
|
+
def tzname(self, dt: datetime.datetime) -> str: ...
|
677
|
+
@overload
|
678
|
+
def tzname(self, dt: None) -> None: ...
|
679
|
+
def tzname(self, dt: datetime.datetime | None) -> str | None:
|
680
|
+
"""
|
681
|
+
>>> MST = TimeZoneInfo('Mountain Standard Time')
|
682
|
+
>>> MST.tzname(datetime.datetime(2003, 8, 2))
|
683
|
+
'Mountain Daylight Time'
|
684
|
+
>>> MST.tzname(datetime.datetime(2003, 11, 25))
|
685
|
+
'Mountain Standard Time'
|
686
|
+
>>> MST.tzname(None)
|
687
|
+
|
688
|
+
"""
|
689
|
+
# https://docs.python.org/3/library/datetime.html#datetime.tzinfo.tzname
|
690
|
+
# > [...] returning `None` is appropriate if the class wishes to say
|
691
|
+
# > that `time` objects don’t participate in the `tzinfo` protocols.
|
692
|
+
if dt is None:
|
693
|
+
return None
|
694
|
+
|
695
|
+
dst = self.dst(dt)
|
696
|
+
winInfo = self.getWinInfo(dt.year)
|
697
|
+
if dst == -winInfo.daylight_bias:
|
698
|
+
return self.daylightName
|
699
|
+
elif dst == -winInfo.standard_bias:
|
700
|
+
return self.standardName
|
701
|
+
|
702
|
+
raise ValueError(
|
703
|
+
"Unexpected daylight bias",
|
704
|
+
dt,
|
705
|
+
dst,
|
706
|
+
winInfo.daylight_bias,
|
707
|
+
winInfo.standard_bias,
|
708
|
+
)
|
605
709
|
|
606
|
-
def getWinInfo(self, targetYear):
|
710
|
+
def getWinInfo(self, targetYear: int) -> TimeZoneDefinition:
|
607
711
|
"""
|
608
712
|
Return the most relevant "info" for this time zone
|
609
713
|
in the target year.
|
610
714
|
"""
|
611
|
-
if not
|
715
|
+
if not getattr(self, "dynamicInfo", {}):
|
612
716
|
return self.staticInfo
|
613
717
|
# Find the greatest year entry in self.dynamicInfo which is for
|
614
718
|
# a year greater than or equal to our targetYear. If not found,
|
@@ -623,20 +727,28 @@ class TimeZoneInfo(datetime.tzinfo):
|
|
623
727
|
winInfo = self.getWinInfo(dt.year)
|
624
728
|
return winInfo.bias + winInfo.daylight_bias
|
625
729
|
|
626
|
-
|
730
|
+
@overload # type: ignore[override] # False-positive, our overload covers all base types
|
731
|
+
def utcoffset(self, dt: None) -> None: ...
|
732
|
+
@overload
|
733
|
+
def utcoffset(self, dt: datetime.datetime) -> datetime.timedelta: ...
|
734
|
+
def utcoffset(self, dt: datetime.datetime | None) -> datetime.timedelta | None:
|
627
735
|
"Calculates the utcoffset according to the datetime.tzinfo spec"
|
628
736
|
if dt is None:
|
629
|
-
return
|
737
|
+
return None
|
630
738
|
winInfo = self.getWinInfo(dt.year)
|
631
739
|
return -winInfo.bias + self.dst(dt)
|
632
740
|
|
633
|
-
|
741
|
+
@overload # type: ignore[override] # False-positive, our overload covers all base types
|
742
|
+
def dst(self, dt: None) -> None: ...
|
743
|
+
@overload
|
744
|
+
def dst(self, dt: datetime.datetime) -> datetime.timedelta: ...
|
745
|
+
def dst(self, dt: datetime.datetime | None) -> datetime.timedelta | None:
|
634
746
|
"""
|
635
747
|
Calculate the daylight savings offset according to the
|
636
748
|
datetime.tzinfo spec.
|
637
749
|
"""
|
638
750
|
if dt is None:
|
639
|
-
return
|
751
|
+
return None
|
640
752
|
winInfo = self.getWinInfo(dt.year)
|
641
753
|
if not self.fixedStandardTime and self._inDaylightSavings(dt):
|
642
754
|
result = winInfo.daylight_bias
|
@@ -673,30 +785,27 @@ class TimeZoneInfo(datetime.tzinfo):
|
|
673
785
|
|
674
786
|
return in_dst
|
675
787
|
|
676
|
-
def GetDSTStartTime(self, year):
|
788
|
+
def GetDSTStartTime(self, year: int) -> datetime.datetime:
|
677
789
|
"Given a year, determines the time when daylight savings time starts"
|
678
790
|
return self.getWinInfo(year).locate_daylight_start(year)
|
679
791
|
|
680
|
-
def GetDSTEndTime(self, year):
|
792
|
+
def GetDSTEndTime(self, year: int) -> datetime.datetime:
|
681
793
|
"Given a year, determines the time when daylight savings ends."
|
682
794
|
return self.getWinInfo(year).locate_standard_start(year)
|
683
795
|
|
684
|
-
def
|
685
|
-
return self.__dict__ < other.__dict__
|
686
|
-
|
687
|
-
def __eq__(self, other):
|
796
|
+
def __eq__(self, other: object) -> bool:
|
688
797
|
return self.__dict__ == other.__dict__
|
689
798
|
|
690
|
-
def __ne__(self, other):
|
799
|
+
def __ne__(self, other: object) -> bool:
|
691
800
|
return self.__dict__ != other.__dict__
|
692
801
|
|
693
802
|
@classmethod
|
694
|
-
def local(
|
803
|
+
def local(cls) -> Self:
|
695
804
|
"""Returns the local time zone as defined by the operating system in the
|
696
805
|
registry.
|
697
806
|
>>> localTZ = TimeZoneInfo.local()
|
698
807
|
>>> now_local = datetime.datetime.now(localTZ)
|
699
|
-
>>> now_UTC = datetime.datetime.utcnow()
|
808
|
+
>>> now_UTC = datetime.datetime.utcnow() # deprecated
|
700
809
|
>>> (now_UTC - now_local) < datetime.timedelta(seconds = 5)
|
701
810
|
Traceback (most recent call last):
|
702
811
|
...
|
@@ -707,6 +816,11 @@ class TimeZoneInfo(datetime.tzinfo):
|
|
707
816
|
Now one can compare the results of the two offset aware values
|
708
817
|
>>> (now_UTC - now_local) < datetime.timedelta(seconds = 5)
|
709
818
|
True
|
819
|
+
|
820
|
+
Or use the newer `datetime.timezone.utc`
|
821
|
+
>>> now_UTC = datetime.datetime.now(datetime.timezone.utc)
|
822
|
+
>>> (now_UTC - now_local) < datetime.timedelta(seconds = 5)
|
823
|
+
True
|
710
824
|
"""
|
711
825
|
code, info = TimeZoneDefinition.current()
|
712
826
|
# code is 0 if daylight savings is disabled or not defined
|
@@ -717,10 +831,12 @@ class TimeZoneInfo(datetime.tzinfo):
|
|
717
831
|
# not sufficient to represent the time zone in which
|
718
832
|
# the current user is operating due
|
719
833
|
# to dynamic time zones.
|
720
|
-
return
|
834
|
+
return cls(info, fix_standard_time)
|
835
|
+
|
836
|
+
_tzutc: ClassVar[Self | None] = None
|
721
837
|
|
722
838
|
@classmethod
|
723
|
-
def utc(
|
839
|
+
def utc(cls) -> Self:
|
724
840
|
"""Returns a time-zone representing UTC.
|
725
841
|
|
726
842
|
Same as TimeZoneInfo('GMT Standard Time', True) but caches the result
|
@@ -729,9 +845,9 @@ class TimeZoneInfo(datetime.tzinfo):
|
|
729
845
|
>>> isinstance(TimeZoneInfo.utc(), TimeZoneInfo)
|
730
846
|
True
|
731
847
|
"""
|
732
|
-
if
|
733
|
-
|
734
|
-
return
|
848
|
+
if not cls._tzutc:
|
849
|
+
cls._tzutc = cls("GMT Standard Time", True)
|
850
|
+
return cls._tzutc
|
735
851
|
|
736
852
|
# helper methods for accessing the timezone info from the registry
|
737
853
|
@staticmethod
|
@@ -766,7 +882,7 @@ class TimeZoneInfo(datetime.tzinfo):
|
|
766
882
|
)
|
767
883
|
|
768
884
|
@staticmethod
|
769
|
-
def get_sorted_time_zone_names():
|
885
|
+
def get_sorted_time_zone_names() -> list[str]:
|
770
886
|
"""
|
771
887
|
Return a list of time zone names that can
|
772
888
|
be used to initialize TimeZoneInfo instances.
|
@@ -775,17 +891,17 @@ class TimeZoneInfo(datetime.tzinfo):
|
|
775
891
|
return [tz.standardName for tz in tzs]
|
776
892
|
|
777
893
|
@staticmethod
|
778
|
-
def get_all_time_zones():
|
894
|
+
def get_all_time_zones() -> list[TimeZoneInfo]:
|
779
895
|
return [TimeZoneInfo(n) for n in TimeZoneInfo._get_time_zone_key_names()]
|
780
896
|
|
781
897
|
@staticmethod
|
782
|
-
def get_sorted_time_zones(key=None):
|
898
|
+
def get_sorted_time_zones(key=None) -> list[TimeZoneInfo]:
|
783
899
|
"""
|
784
900
|
Return the time zones sorted by some key.
|
785
901
|
key must be a function that takes a TimeZoneInfo object and returns
|
786
902
|
a value suitable for sorting on.
|
787
903
|
The key defaults to the bias (descending), as is done in Windows
|
788
|
-
(see http://blogs.msdn.com/michkap/archive/2006/12/22/1350684.aspx)
|
904
|
+
(see https://web.archive.org/web/20130723075340/http://blogs.msdn.com/b/michkap/archive/2006/12/22/1350684.aspx)
|
789
905
|
"""
|
790
906
|
key = key or (lambda tzi: -tzi.staticInfo.bias)
|
791
907
|
zones = TimeZoneInfo.get_all_time_zones()
|
@@ -793,17 +909,21 @@ class TimeZoneInfo(datetime.tzinfo):
|
|
793
909
|
return zones
|
794
910
|
|
795
911
|
|
796
|
-
class _RegKeyDict(Dict[str,
|
797
|
-
def __init__(self, key: winreg.
|
912
|
+
class _RegKeyDict(Dict[str, str]):
|
913
|
+
def __init__(self, key: winreg._KeyType):
|
798
914
|
dict.__init__(self)
|
799
915
|
self.key = key
|
800
916
|
self.__load_values()
|
801
917
|
|
802
918
|
@classmethod
|
803
|
-
def open(
|
804
|
-
|
805
|
-
|
806
|
-
|
919
|
+
def open(
|
920
|
+
cls, key: winreg._KeyType, sub_key: str, reserved: int = 0, access: int = 131097
|
921
|
+
) -> _RegKeyDict:
|
922
|
+
return _RegKeyDict(winreg.OpenKeyEx(key, sub_key, reserved, access))
|
923
|
+
|
924
|
+
def subkey(self, name: str) -> _RegKeyDict:
|
925
|
+
if not name:
|
926
|
+
raise ValueError("subkey name cannot be empty")
|
807
927
|
return _RegKeyDict(winreg.OpenKeyEx(self.key, name))
|
808
928
|
|
809
929
|
def __load_values(self):
|
@@ -822,7 +942,9 @@ class _RegKeyDict(Dict[str, int]):
|
|
822
942
|
return _RegKeyDict._enumerate_reg(key, winreg.EnumKey)
|
823
943
|
|
824
944
|
@staticmethod
|
825
|
-
def _enumerate_reg(
|
945
|
+
def _enumerate_reg(
|
946
|
+
key: _T, func: Callable[[_T, int], _VT]
|
947
|
+
) -> Generator[_VT, None, None]:
|
826
948
|
"Enumerates an open registry key as an iterable generator"
|
827
949
|
try:
|
828
950
|
for index in count():
|
@@ -831,27 +953,35 @@ class _RegKeyDict(Dict[str, int]):
|
|
831
953
|
pass
|
832
954
|
|
833
955
|
|
834
|
-
def utcnow():
|
956
|
+
def utcnow() -> datetime.datetime:
|
835
957
|
"""
|
836
958
|
Return the UTC time now with timezone awareness as enabled
|
837
959
|
by this module
|
838
960
|
>>> now = utcnow()
|
961
|
+
|
962
|
+
>>> (now - datetime.datetime.now(datetime.timezone.utc)) < datetime.timedelta(seconds = 5)
|
963
|
+
True
|
964
|
+
>>> type(now.tzinfo) is TimeZoneInfo
|
965
|
+
True
|
839
966
|
"""
|
840
|
-
|
841
|
-
now = now.replace(tzinfo=TimeZoneInfo.utc())
|
842
|
-
return now
|
967
|
+
return datetime.datetime.now(TimeZoneInfo.utc())
|
843
968
|
|
844
969
|
|
845
|
-
def now():
|
970
|
+
def now() -> datetime.datetime:
|
846
971
|
"""
|
847
972
|
Return the local time now with timezone awareness as enabled
|
848
973
|
by this module
|
849
974
|
>>> now_local = now()
|
975
|
+
|
976
|
+
>>> (now_local - datetime.datetime.now(datetime.timezone.utc)) < datetime.timedelta(seconds = 5)
|
977
|
+
True
|
978
|
+
>>> type(now_local.tzinfo) is TimeZoneInfo
|
979
|
+
True
|
850
980
|
"""
|
851
981
|
return datetime.datetime.now(TimeZoneInfo.local())
|
852
982
|
|
853
983
|
|
854
|
-
def GetTZCapabilities():
|
984
|
+
def GetTZCapabilities() -> dict[str, bool]:
|
855
985
|
"""
|
856
986
|
Run a few known tests to determine the capabilities of
|
857
987
|
the time zone database on this machine.
|
@@ -878,10 +1008,10 @@ def GetTZCapabilities():
|
|
878
1008
|
|
879
1009
|
|
880
1010
|
class DLLHandleCache:
|
881
|
-
def __init__(self):
|
882
|
-
self.__cache = {}
|
1011
|
+
def __init__(self) -> None:
|
1012
|
+
self.__cache: dict[str, int] = {}
|
883
1013
|
|
884
|
-
def __getitem__(self, filename):
|
1014
|
+
def __getitem__(self, filename: str) -> int:
|
885
1015
|
key = filename.lower()
|
886
1016
|
return self.__cache.setdefault(key, win32api.LoadLibrary(key))
|
887
1017
|
|
@@ -889,27 +1019,34 @@ class DLLHandleCache:
|
|
889
1019
|
DLLCache = DLLHandleCache()
|
890
1020
|
|
891
1021
|
|
892
|
-
def resolveMUITimeZone(spec):
|
1022
|
+
def resolveMUITimeZone(spec: str) -> str | None:
|
893
1023
|
"""Resolve a multilingual user interface resource for the time zone name
|
894
1024
|
|
895
1025
|
spec should be of the format @path,-stringID[;comment]
|
896
|
-
see
|
1026
|
+
see https://learn.microsoft.com/en-ca/windows/win32/api/timezoneapi/ns-timezoneapi-time_zone_information
|
1027
|
+
for details
|
1028
|
+
|
1029
|
+
>>> import sys
|
1030
|
+
>>> result = resolveMUITimeZone('@tzres.dll,-110')
|
1031
|
+
>>> expectedResultType = [type(None),str][sys.getwindowsversion() >= (6,)]
|
1032
|
+
>>> type(result) is expectedResultType
|
1033
|
+
True
|
897
1034
|
"""
|
898
1035
|
pattern = re.compile(r"@(?P<dllname>.*),-(?P<index>\d+)(?:;(?P<comment>.*))?")
|
899
1036
|
matcher = pattern.match(spec)
|
900
1037
|
assert matcher, "Could not parse MUI spec"
|
901
1038
|
|
1039
|
+
groupdict = matcher.groupdict()
|
902
1040
|
try:
|
903
|
-
handle = DLLCache[
|
904
|
-
result = win32api.LoadString(handle, int(
|
1041
|
+
handle = DLLCache[groupdict["dllname"]]
|
1042
|
+
result: str | None = win32api.LoadString(handle, int(groupdict["index"]))
|
905
1043
|
except win32api.error:
|
906
1044
|
result = None
|
907
1045
|
return result
|
908
1046
|
|
909
1047
|
|
910
|
-
# from jaraco.
|
911
|
-
|
912
|
-
class RangeMap(dict): # type: ignore[type-arg] # Source code is untyped :/ TODO: Add generics!
|
1048
|
+
# from jaraco.collections 5.1
|
1049
|
+
class RangeMap(Dict[_RangeMapKT, _VT]):
|
913
1050
|
"""
|
914
1051
|
A dictionary-like object that uses the keys as bounds for a range.
|
915
1052
|
Inclusion of the value for that range is determined by the
|
@@ -918,25 +1055,30 @@ class RangeMap(dict): # type: ignore[type-arg] # Source code is untyped :/ TODO
|
|
918
1055
|
the sorted list of keys.
|
919
1056
|
|
920
1057
|
One may supply keyword parameters to be passed to the sort function used
|
921
|
-
to sort keys (i.e.
|
1058
|
+
to sort keys (i.e. key, reverse) as sort_params.
|
1059
|
+
|
1060
|
+
Create a map that maps 1-3 -> 'a', 4-6 -> 'b'
|
922
1061
|
|
923
|
-
Let's create a map that maps 1-3 -> 'a', 4-6 -> 'b'
|
924
1062
|
>>> r = RangeMap({3: 'a', 6: 'b'}) # boy, that was easy
|
925
1063
|
>>> r[1], r[2], r[3], r[4], r[5], r[6]
|
926
1064
|
('a', 'a', 'a', 'b', 'b', 'b')
|
927
1065
|
|
928
1066
|
Even float values should work so long as the comparison operator
|
929
1067
|
supports it.
|
1068
|
+
|
930
1069
|
>>> r[4.5]
|
931
1070
|
'b'
|
932
1071
|
|
933
|
-
|
1072
|
+
Notice that the way rangemap is defined, it must be open-ended
|
1073
|
+
on one side.
|
1074
|
+
|
934
1075
|
>>> r[0]
|
935
1076
|
'a'
|
936
1077
|
>>> r[-1]
|
937
1078
|
'a'
|
938
1079
|
|
939
1080
|
One can close the open-end of the RangeMap by using undefined_value
|
1081
|
+
|
940
1082
|
>>> r = RangeMap({0: RangeMap.undefined_value, 3: 'a', 6: 'b'})
|
941
1083
|
>>> r[0]
|
942
1084
|
Traceback (most recent call last):
|
@@ -944,34 +1086,72 @@ class RangeMap(dict): # type: ignore[type-arg] # Source code is untyped :/ TODO
|
|
944
1086
|
KeyError: 0
|
945
1087
|
|
946
1088
|
One can get the first or last elements in the range by using RangeMap.Item
|
1089
|
+
|
947
1090
|
>>> last_item = RangeMap.Item(-1)
|
948
1091
|
>>> r[last_item]
|
949
1092
|
'b'
|
950
1093
|
|
951
1094
|
.last_item is a shortcut for Item(-1)
|
1095
|
+
|
952
1096
|
>>> r[RangeMap.last_item]
|
953
1097
|
'b'
|
954
1098
|
|
955
1099
|
Sometimes it's useful to find the bounds for a RangeMap
|
1100
|
+
|
956
1101
|
>>> r.bounds()
|
957
1102
|
(0, 6)
|
958
1103
|
|
959
1104
|
RangeMap supports .get(key, default)
|
1105
|
+
|
960
1106
|
>>> r.get(0, 'not found')
|
961
1107
|
'not found'
|
962
1108
|
|
963
1109
|
>>> r.get(7, 'not found')
|
964
1110
|
'not found'
|
965
1111
|
|
1112
|
+
One often wishes to define the ranges by their left-most values,
|
1113
|
+
which requires use of sort params and a key_match_comparator.
|
1114
|
+
|
1115
|
+
>>> r = RangeMap({1: 'a', 4: 'b'},
|
1116
|
+
... sort_params=dict(reverse=True),
|
1117
|
+
... key_match_comparator=operator.ge)
|
1118
|
+
>>> r[1], r[2], r[3], r[4], r[5], r[6]
|
1119
|
+
('a', 'a', 'a', 'b', 'b', 'b')
|
1120
|
+
|
1121
|
+
That wasn't nearly as easy as before, so an alternate constructor
|
1122
|
+
is provided:
|
1123
|
+
|
1124
|
+
>>> r = RangeMap.left({1: 'a', 4: 'b', 7: RangeMap.undefined_value})
|
1125
|
+
>>> r[1], r[2], r[3], r[4], r[5], r[6]
|
1126
|
+
('a', 'a', 'a', 'b', 'b', 'b')
|
1127
|
+
|
966
1128
|
"""
|
967
1129
|
|
968
|
-
def __init__(
|
1130
|
+
def __init__(
|
1131
|
+
self,
|
1132
|
+
source: (
|
1133
|
+
SupportsKeysAndGetItem[_RangeMapKT, _VT] | Iterable[tuple[_RangeMapKT, _VT]]
|
1134
|
+
),
|
1135
|
+
sort_params: Mapping[str, Any] = {},
|
1136
|
+
key_match_comparator: Callable[[_RangeMapKT, _RangeMapKT], bool] = operator.le,
|
1137
|
+
) -> None:
|
969
1138
|
dict.__init__(self, source)
|
970
1139
|
self.sort_params = sort_params
|
971
1140
|
self.match = key_match_comparator
|
972
1141
|
|
973
|
-
|
974
|
-
|
1142
|
+
@classmethod
|
1143
|
+
def left(
|
1144
|
+
cls,
|
1145
|
+
source: (
|
1146
|
+
SupportsKeysAndGetItem[_RangeMapKT, _VT] | Iterable[tuple[_RangeMapKT, _VT]]
|
1147
|
+
),
|
1148
|
+
) -> Self:
|
1149
|
+
return cls(
|
1150
|
+
source, sort_params={"reverse": True}, key_match_comparator=operator.ge
|
1151
|
+
)
|
1152
|
+
|
1153
|
+
def __getitem__(self, item: _RangeMapKT) -> _VT:
|
1154
|
+
sorted_keys = sorted(self, **self.sort_params)
|
975
1155
|
if isinstance(item, RangeMap.Item):
|
976
1156
|
result = self.__getitem__(sorted_keys[item])
|
977
1157
|
else:
|
@@ -981,38 +1161,41 @@ class RangeMap(dict): # type: ignore[type-arg] # Source code is untyped :/ TODO
|
|
981
1161
|
raise KeyError(key)
|
982
1162
|
return result
|
983
1163
|
|
984
|
-
|
1164
|
+
@overload # type: ignore[override] # Signature simplified over dict and Mapping
|
1165
|
+
def get(self, key: _RangeMapKT, default: _T) -> _VT | _T: ...
|
1166
|
+
@overload
|
1167
|
+
def get(self, key: _RangeMapKT, default: None = None) -> _VT | None: ...
|
1168
|
+
def get(self, key: _RangeMapKT, default: _T | None = None) -> _VT | _T | None:
|
985
1169
|
"""
|
986
1170
|
Return the value for key if key is in the dictionary, else default.
|
987
1171
|
If default is not given, it defaults to None, so that this method
|
988
1172
|
never raises a KeyError.
|
989
1173
|
"""
|
1174
|
+
# Necessary to use our own __getitem__ and not dict's
|
990
1175
|
try:
|
991
1176
|
return self[key]
|
992
1177
|
except KeyError:
|
993
1178
|
return default
|
994
1179
|
|
995
|
-
def _find_first_match_(
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
matches =
|
1000
|
-
|
1001
|
-
return matches
|
1002
|
-
|
1180
|
+
def _find_first_match_(
|
1181
|
+
self, keys: Iterable[_RangeMapKT], item: _RangeMapKT
|
1182
|
+
) -> _RangeMapKT:
|
1183
|
+
is_match = functools.partial(self.match, item)
|
1184
|
+
matches = filter(is_match, keys)
|
1185
|
+
try:
|
1186
|
+
return next(matches)
|
1187
|
+
except StopIteration:
|
1188
|
+
raise KeyError(item) from None
|
1003
1189
|
|
1004
|
-
def bounds(self):
|
1005
|
-
sorted_keys = sorted(self
|
1006
|
-
return (
|
1007
|
-
sorted_keys[RangeMap.first_item],
|
1008
|
-
sorted_keys[RangeMap.last_item],
|
1009
|
-
)
|
1190
|
+
def bounds(self) -> tuple[_RangeMapKT, _RangeMapKT]:
|
1191
|
+
sorted_keys = sorted(self, **self.sort_params)
|
1192
|
+
return (sorted_keys[RangeMap.first_item], sorted_keys[RangeMap.last_item])
|
1010
1193
|
|
1011
1194
|
# some special values for the RangeMap
|
1012
|
-
undefined_value = type("RangeValueUndefined", (
|
1195
|
+
undefined_value = type("RangeValueUndefined", (), {})()
|
1013
1196
|
|
1014
1197
|
class Item(int):
|
1015
|
-
|
1198
|
+
"""RangeMap Item"""
|
1016
1199
|
|
1017
1200
|
first_item = Item(0)
|
1018
1201
|
last_item = Item(-1)
|