diff --git a/Pythonwin/pywin/framework/scriptutils.py b/Pythonwin/pywin/framework/scriptutils.py index a04ed7bbee..2f9c56e2de 100644 --- a/Pythonwin/pywin/framework/scriptutils.py +++ b/Pythonwin/pywin/framework/scriptutils.py @@ -1,6 +1,7 @@ """ Various utilities for running/importing a script """ + import bdb import linecache import os diff --git a/Pythonwin/pywin/mfc/activex.py b/Pythonwin/pywin/mfc/activex.py index a9828e78dc..f3d9939a4b 100644 --- a/Pythonwin/pywin/mfc/activex.py +++ b/Pythonwin/pywin/mfc/activex.py @@ -1,5 +1,6 @@ """Support for ActiveX control hosting in Pythonwin. """ + import win32ui import win32uiole diff --git a/Pythonwin/pywin/mfc/dialog.py b/Pythonwin/pywin/mfc/dialog.py index 280c025aa1..41107e54d3 100644 --- a/Pythonwin/pywin/mfc/dialog.py +++ b/Pythonwin/pywin/mfc/dialog.py @@ -1,6 +1,7 @@ """ \ Base class for Dialogs. Also contains a few useful utility functions """ + # dialog.py # Python class for Dialog Boxes in PythonWin. diff --git a/adodbapi/__init__.py b/adodbapi/__init__.py index 428bdf432a..94a04bee36 100644 --- a/adodbapi/__init__.py +++ b/adodbapi/__init__.py @@ -3,6 +3,7 @@ Copyright (C) 2002 Henrik Ekelund, version 2.1 by Vernon Cole * http://sourceforge.net/projects/adodbapi """ + import time # Re-exports to keep backward compatibility with existing code diff --git a/adodbapi/examples/db_table_names.py b/adodbapi/examples/db_table_names.py index 2d7bf9df0d..907bdb85ea 100644 --- a/adodbapi/examples/db_table_names.py +++ b/adodbapi/examples/db_table_names.py @@ -1,4 +1,5 @@ """ db_table_names.py -- a simple demo for ADO database table listing.""" + import sys import adodbapi diff --git a/adodbapi/is64bit.py b/adodbapi/is64bit.py index 911c61931e..36a8c63e48 100644 --- a/adodbapi/is64bit.py +++ b/adodbapi/is64bit.py @@ -1,4 +1,5 @@ """is64bit.Python() --> boolean value of detected Python word size. is64bit.os() --> os build version""" + import sys diff --git a/adodbapi/process_connect_string.py b/adodbapi/process_connect_string.py index 3c3f9e7afa..806c0954e8 100644 --- a/adodbapi/process_connect_string.py +++ b/adodbapi/process_connect_string.py @@ -1,4 +1,5 @@ """ a clumsy attempt at a macro language to let the programmer execute code on the server (ex: determine 64bit)""" + from . import is64bit as is64bit diff --git a/adodbapi/schema_table.py b/adodbapi/schema_table.py index 21ad37e31d..636766bba5 100644 --- a/adodbapi/schema_table.py +++ b/adodbapi/schema_table.py @@ -1,4 +1,5 @@ """call using an open ADO connection --> list of table names""" + from . import adodbapi diff --git a/adodbapi/setup.py b/adodbapi/setup.py index d25869adf9..51c999e5b4 100644 --- a/adodbapi/setup.py +++ b/adodbapi/setup.py @@ -3,6 +3,7 @@ Adodbapi can be run on CPython 3.5 and later. or IronPython version 2.6 and later (in theory, possibly no longer in practice!) """ + CLASSIFIERS = """\ Development Status :: 5 - Production/Stable Intended Audience :: Developers diff --git a/adodbapi/test/adodbapitest.py b/adodbapi/test/adodbapitest.py index e27bcaede1..a5d4fce867 100644 --- a/adodbapi/test/adodbapitest.py +++ b/adodbapi/test/adodbapitest.py @@ -1,4 +1,5 @@ """ Unit tests version 2.6.1.0 for adodbapi""" + """ adodbapi - A python DB API 2.0 interface to Microsoft ADO @@ -251,9 +252,9 @@ def testUserDefinedConversionForExactNumericTypes(self): ) finally: # now reset the converter to its original function - adodbapi.variantConversions[ - ado_consts.adNumeric - ] = oldconverter # Restore the original convertion function + adodbapi.variantConversions[ado_consts.adNumeric] = ( + oldconverter # Restore the original convertion function + ) def helpTestDataType( self, diff --git a/adodbapi/test/is64bit.py b/adodbapi/test/is64bit.py index ed390fad00..33d0244302 100644 --- a/adodbapi/test/is64bit.py +++ b/adodbapi/test/is64bit.py @@ -1,4 +1,5 @@ """is64bit.Python() --> boolean value of detected Python word size. is64bit.os() --> os build version""" + import sys diff --git a/adodbapi/test/test_adodbapi_dbapi20.py b/adodbapi/test/test_adodbapi_dbapi20.py index b90844bf6a..ccf7e7cbf5 100644 --- a/adodbapi/test/test_adodbapi_dbapi20.py +++ b/adodbapi/test/test_adodbapi_dbapi20.py @@ -51,9 +51,9 @@ else: conn_kws["host"] = host -conn_kws[ - "provider" -] = "Provider=MSOLEDBSQL;DataTypeCompatibility=80;MARS Connection=True;" +conn_kws["provider"] = ( + "Provider=MSOLEDBSQL;DataTypeCompatibility=80;MARS Connection=True;" +) connStr = "%(provider)s; %(security)s; Initial Catalog=%(name)s;Data Source=%(host)s" if onWindows and node != "z-PC": diff --git a/com/win32com/client/CLSIDToClass.py b/com/win32com/client/CLSIDToClass.py index fde3274332..88b742e0ac 100644 --- a/com/win32com/client/CLSIDToClass.py +++ b/com/win32com/client/CLSIDToClass.py @@ -16,6 +16,7 @@ This obviously applies to all cooperating objects, not just DAO and Access. """ + mapCLSIDToClass = {} diff --git a/com/win32com/client/combrowse.py b/com/win32com/client/combrowse.py index 18576251ee..a5e76a85ba 100644 --- a/com/win32com/client/combrowse.py +++ b/com/win32com/client/combrowse.py @@ -22,6 +22,7 @@ work. """ + import sys import pythoncom diff --git a/com/win32com/client/connect.py b/com/win32com/client/connect.py index 24788204ec..7cb3969464 100644 --- a/com/win32com/client/connect.py +++ b/com/win32com/client/connect.py @@ -1,4 +1,5 @@ """Utilities for working with Connections""" + import pythoncom import win32com.server.util diff --git a/com/win32com/client/dynamic.py b/com/win32com/client/dynamic.py index 4c38ba3b1b..51d4702f8a 100644 --- a/com/win32com/client/dynamic.py +++ b/com/win32com/client/dynamic.py @@ -15,6 +15,7 @@ >>> xl.Visible = 1 # The Excel window becomes visible. """ + import traceback import types diff --git a/com/win32com/client/gencache.py b/com/win32com/client/gencache.py index 7512e7cc87..cc23afdf7d 100644 --- a/com/win32com/client/gencache.py +++ b/com/win32com/client/gencache.py @@ -20,6 +20,7 @@ Currently just uses a pickled dictionary, but should used some sort of indexed file. Maybe an OLE2 compound file, or a bsddb file? """ + import glob import os import sys diff --git a/com/win32com/client/util.py b/com/win32com/client/util.py index 1925843ab3..33f5763367 100644 --- a/com/win32com/client/util.py +++ b/com/win32com/client/util.py @@ -3,6 +3,7 @@ This module contains utility functions, used primarily by advanced COM programmers, or other COM modules. """ + import pythoncom from win32com.client import Dispatch, _get_good_object_ diff --git a/com/win32com/makegw/makegw.py b/com/win32com/makegw/makegw.py index 5b7484c073..44050bcfc1 100644 --- a/com/win32com/makegw/makegw.py +++ b/com/win32com/makegw/makegw.py @@ -210,11 +210,9 @@ def _write_ifc_cpp(f, interface): **strdict ) ) - argsParseTuple = ( - argsCOM - ) = ( - formatChars - ) = codePost = codePobjects = codeCobjects = cleanup = cleanup_gil = "" + argsParseTuple = argsCOM = formatChars = codePost = codePobjects = ( + codeCobjects + ) = cleanup = cleanup_gil = "" needConversion = 0 # if method.name=="Stat": import win32dbg;win32dbg.brk() for arg in method.args: diff --git a/com/win32com/makegw/makegwenum.py b/com/win32com/makegw/makegwenum.py index a35940c90a..662dff4b67 100644 --- a/com/win32com/makegw/makegwenum.py +++ b/com/win32com/makegw/makegwenum.py @@ -7,6 +7,7 @@ This module is notmally not used directly - the @makegw@ module automatically calls this. """ + # # INTERNAL FUNCTIONS # diff --git a/com/win32com/makegw/makegwparse.py b/com/win32com/makegw/makegwparse.py index e4db7b29e9..63b4692b8a 100644 --- a/com/win32com/makegw/makegwparse.py +++ b/com/win32com/makegw/makegwparse.py @@ -11,6 +11,7 @@ See the @win32com.makegw@ module for information in building a COM interface """ + import re import traceback diff --git a/com/win32com/server/connect.py b/com/win32com/server/connect.py index 5c9a2dfe4a..f9ffcd29ae 100644 --- a/com/win32com/server/connect.py +++ b/com/win32com/server/connect.py @@ -2,6 +2,7 @@ A collection of helpers for server side connection points. """ + import pythoncom import win32com.server.util import winerror diff --git a/com/win32com/server/dispatcher.py b/com/win32com/server/dispatcher.py index eb0eaaaecd..88c1fa0218 100644 --- a/com/win32com/server/dispatcher.py +++ b/com/win32com/server/dispatcher.py @@ -2,6 +2,7 @@ Please see policy.py for a discussion on dispatchers and policies """ + import traceback from sys import exc_info diff --git a/com/win32com/server/exception.py b/com/win32com/server/exception.py index 50da77b5f4..47e0368506 100644 --- a/com/win32com/server/exception.py +++ b/com/win32com/server/exception.py @@ -12,6 +12,7 @@ This module provides a class which provides the necessary attributes. """ + import sys import pythoncom diff --git a/com/win32com/server/policy.py b/com/win32com/server/policy.py index 7d46d83d02..a36213eb9c 100644 --- a/com/win32com/server/policy.py +++ b/com/win32com/server/policy.py @@ -66,6 +66,7 @@ problem, rather than a COM error. """ + __author__ = "Greg Stein and Mark Hammond" import sys diff --git a/com/win32com/server/register.py b/com/win32com/server/register.py index 211e7428b6..c7694a2418 100644 --- a/com/win32com/server/register.py +++ b/com/win32com/server/register.py @@ -6,6 +6,7 @@ construct the necessary Python object, and dispatch COM events. """ + import os import sys diff --git a/com/win32com/server/util.py b/com/win32com/server/util.py index 853f03a2b1..d8682460a9 100644 --- a/com/win32com/server/util.py +++ b/com/win32com/server/util.py @@ -1,5 +1,6 @@ """ General Server side utilities """ + import pythoncom import winerror diff --git a/com/win32com/servers/dictionary.py b/com/win32com/servers/dictionary.py index 72b405937e..12cd3be5b1 100644 --- a/com/win32com/servers/dictionary.py +++ b/com/win32com/servers/dictionary.py @@ -31,7 +31,6 @@ next """ - import pythoncom import pywintypes import winerror diff --git a/com/win32com/servers/perfmon.py b/com/win32com/servers/perfmon.py index 362a6ac815..0a0aaaf812 100644 --- a/com/win32com/servers/perfmon.py +++ b/com/win32com/servers/perfmon.py @@ -4,6 +4,7 @@ set ob = CreateObject("Python.PerfmonQuery") freeBytes = ob.Query("Memory", "Available Bytes") """ + import pythoncom import win32pdhutil import winerror diff --git a/com/win32com/util.py b/com/win32com/util.py index 767e34a7cb..0a5748f1e1 100644 --- a/com/win32com/util.py +++ b/com/win32com/util.py @@ -2,6 +2,7 @@ This module contains a collection of general purpose utility functions. """ + import pythoncom import win32api import win32con diff --git a/com/win32comext/axdebug/adb.py b/com/win32comext/axdebug/adb.py index 7f0984535d..2345ce5d69 100644 --- a/com/win32comext/axdebug/adb.py +++ b/com/win32comext/axdebug/adb.py @@ -1,5 +1,6 @@ """The glue between the Python debugger interface and the Active Debugger interface """ + import _thread import bdb import os diff --git a/com/win32comext/axdebug/contexts.py b/com/win32comext/axdebug/contexts.py index 8953f5ab9c..08443b2515 100644 --- a/com/win32comext/axdebug/contexts.py +++ b/com/win32comext/axdebug/contexts.py @@ -1,6 +1,7 @@ """ A module for managing the AXDebug I*Contexts """ + from . import adb, axdebug, gateways # Utility function for wrapping object created by this module. diff --git a/com/win32comext/axdebug/documents.py b/com/win32comext/axdebug/documents.py index 4b93e8c1d0..560901fb42 100644 --- a/com/win32comext/axdebug/documents.py +++ b/com/win32comext/axdebug/documents.py @@ -1,7 +1,6 @@ """ Management of documents for AXDebugging. """ - import pythoncom import win32api from win32com.server.util import unwrap diff --git a/com/win32comext/axscript/client/framework.py b/com/win32comext/axscript/client/framework.py index 93f9d53741..9dbdfd5533 100644 --- a/com/win32comext/axscript/client/framework.py +++ b/com/win32comext/axscript/client/framework.py @@ -6,6 +6,7 @@ There are classes defined for the engine itself, and for ScriptItems """ + import re import sys diff --git a/com/win32comext/axscript/client/pyscript.py b/com/win32comext/axscript/client/pyscript.py index 0ce08fc35e..dfa52e9b9a 100644 --- a/com/win32comext/axscript/client/pyscript.py +++ b/com/win32comext/axscript/client/pyscript.py @@ -252,9 +252,9 @@ def RegisterNamedItem(self, item): if item.IsGlobal(): # Global items means sub-items are also added... for subitem in item.subItems.values(): - self.globalNameSpaceModule.__dict__[ - subitem.name - ] = subitem.attributeObject + self.globalNameSpaceModule.__dict__[subitem.name] = ( + subitem.attributeObject + ) # Also add all methods for name, entry in item.dispatchContainer._olerepr_.mapFuncs.items(): if not entry.hidden: diff --git a/isapi/isapicon.py b/isapi/isapicon.py index 20de1a44c2..d4c16a5459 100644 --- a/isapi/isapicon.py +++ b/isapi/isapicon.py @@ -1,4 +1,5 @@ """Constants needed by ISAPI filters and extensions.""" + # ====================================================================== # Copyright 2002-2003 by Blackdog Software Pty Ltd. # diff --git a/isapi/threaded_extension.py b/isapi/threaded_extension.py index 12a1191df6..daa2ebd9ae 100644 --- a/isapi/threaded_extension.py +++ b/isapi/threaded_extension.py @@ -1,4 +1,5 @@ """An ISAPI extension base class implemented using a thread-pool.""" + # $Id$ import sys diff --git a/pywin32_testall.py b/pywin32_testall.py index e6c4b7c8c6..9071549174 100644 --- a/pywin32_testall.py +++ b/pywin32_testall.py @@ -1,4 +1,5 @@ """A test runner for pywin32""" + import os import site import subprocess diff --git a/win32/Demos/security/sspi/socket_server.py b/win32/Demos/security/sspi/socket_server.py index d1ac70b22c..6bf3806bb4 100644 --- a/win32/Demos/security/sspi/socket_server.py +++ b/win32/Demos/security/sspi/socket_server.py @@ -19,7 +19,6 @@ See the SSPI documentation for more details. """ - import http.client # sorry, this demo needs 2.3+ import optparse import socketserver diff --git a/win32/Demos/win32ts_logoff_disconnected.py b/win32/Demos/win32ts_logoff_disconnected.py index be61e5d1f3..2a8bcc9403 100644 --- a/win32/Demos/win32ts_logoff_disconnected.py +++ b/win32/Demos/win32ts_logoff_disconnected.py @@ -1,4 +1,5 @@ """ Finds any disconnected terminal service sessions and logs them off""" + import pywintypes import win32ts import winerror diff --git a/win32/Lib/sspi.py b/win32/Lib/sspi.py index 657577831d..d1e76e7f8b 100644 --- a/win32/Lib/sspi.py +++ b/win32/Lib/sspi.py @@ -11,6 +11,7 @@ If you need finer control than offered here, just use the win32security functions directly. """ + # Based on Roger Upole's sspi demos. # $Id$ import sspicon diff --git a/win32/Lib/win32pdhquery.py b/win32/Lib/win32pdhquery.py index f47aa148e0..75f019a773 100644 --- a/win32/Lib/win32pdhquery.py +++ b/win32/Lib/win32pdhquery.py @@ -123,6 +123,7 @@ if you use it, you accept the risk of using it, etceteras. """ + # Feb 12, 98 - MH added "rawaddcounter" so caller can get exception details. import _thread diff --git a/win32/Lib/winerror.py b/win32/Lib/winerror.py index d7697dbd65..e9e047a12f 100644 --- a/win32/Lib/winerror.py +++ b/win32/Lib/winerror.py @@ -2,6 +2,7 @@ Generated by h2py from winerror.h """ + # Few extras added manually... TRUST_E_PROVIDER_UNKNOWN = -2146762751 TRUST_E_ACTION_UNKNOWN = -2146762750 diff --git a/win32/Lib/winxptheme.py b/win32/Lib/winxptheme.py index 3f61c3de58..e147eda58f 100644 --- a/win32/Lib/winxptheme.py +++ b/win32/Lib/winxptheme.py @@ -4,4 +4,5 @@ be available. In 2022, it's safe to assume they are, so this is just a wrapper around _winxptheme. """ + from _winxptheme import * diff --git a/win32/test/test_exceptions.py b/win32/test/test_exceptions.py index ad956abf66..984d7271ba 100644 --- a/win32/test/test_exceptions.py +++ b/win32/test/test_exceptions.py @@ -1,4 +1,5 @@ """Test pywin32's error semantics""" + import unittest import pythoncom diff --git a/win32/test/test_win32crypt.py b/win32/test/test_win32crypt.py index 4d1fa712e4..145a3df96f 100644 --- a/win32/test/test_win32crypt.py +++ b/win32/test/test_win32crypt.py @@ -56,9 +56,11 @@ def open_windows_certstore(store_name: str, store_location: str) -> Iterator[Any CERT_STORE_PROV_SYSTEM, 0, None, - CERT_SYSTEM_STORE_LOCAL_MACHINE - if store_location == _LOCAL_MACHINE - else CERT_SYSTEM_STORE_CURRENT_USER, + ( + CERT_SYSTEM_STORE_LOCAL_MACHINE + if store_location == _LOCAL_MACHINE + else CERT_SYSTEM_STORE_CURRENT_USER + ), store_name, ) yield handle diff --git a/win32/test/test_win32profile.py b/win32/test/test_win32profile.py index 84dc83bc9d..71432363fd 100644 --- a/win32/test/test_win32profile.py +++ b/win32/test/test_win32profile.py @@ -1,4 +1,5 @@ """Test win32profile""" + import os import unittest