From 9e1111a8be469f1903df3c04bf12b2858c2610a9 Mon Sep 17 00:00:00 2001 From: Avasam Date: Mon, 25 Mar 2024 13:26:18 -0400 Subject: [PATCH] Manual fixes --- Pythonwin/pywin/framework/intpyapp.py | 4 ++-- Pythonwin/pywin/framework/mdi_pychecker.py | 2 +- Pythonwin/pywin/scintilla/IDLEenvironment.py | 4 ++-- com/win32com/client/__init__.py | 4 ++-- com/win32com/client/build.py | 4 ++-- com/win32com/server/policy.py | 2 +- com/win32comext/adsi/demos/scp.py | 2 +- com/win32comext/shell/demos/explorer_browser.py | 3 +-- com/win32comext/shell/demos/servers/folder_view.py | 4 ++-- com/win32comext/shell/demos/servers/shell_view.py | 8 ++++---- isapi/install.py | 2 +- pywin32_postinstall.py | 8 ++++---- setup.py | 8 ++++---- win32/Demos/NetValidatePasswordPolicy.py | 6 +++--- win32/Lib/win32gui_struct.py | 8 ++++---- win32/test/test_win32trace.py | 3 +-- 16 files changed, 35 insertions(+), 37 deletions(-) diff --git a/Pythonwin/pywin/framework/intpyapp.py b/Pythonwin/pywin/framework/intpyapp.py index 4b44b18fb5..54b4c6e59a 100644 --- a/Pythonwin/pywin/framework/intpyapp.py +++ b/Pythonwin/pywin/framework/intpyapp.py @@ -298,8 +298,8 @@ def ProcessArgs(self, args, dde=None): if dde: dde.Exec( "from pywin.framework import scriptutils\n" - "ed = scriptutils.GetActiveEditControl()\n" - "if ed: ed.SetSel(ed.LineIndex(%s - 1))" % gotoline + + "ed = scriptutils.GetActiveEditControl()\n" + + "if ed: ed.SetSel(ed.LineIndex(%s - 1))" % gotoline ) else: from . import scriptutils diff --git a/Pythonwin/pywin/framework/mdi_pychecker.py b/Pythonwin/pywin/framework/mdi_pychecker.py index 6bd34905f9..d5a350dfec 100644 --- a/Pythonwin/pywin/framework/mdi_pychecker.py +++ b/Pythonwin/pywin/framework/mdi_pychecker.py @@ -364,7 +364,7 @@ def threadPycheckerRun(self): elif not os.path.isfile(pychecker): result = ( "Can't find checker.py - please install pychecker " - "(or run 'setup.py install' if you have the source version)\n" + + "(or run 'setup.py install' if you have the source version)\n" ) else: cmd = f'{py} "{pychecker}" {options} {files} 2>&1' diff --git a/Pythonwin/pywin/scintilla/IDLEenvironment.py b/Pythonwin/pywin/scintilla/IDLEenvironment.py index 702382db5b..79048d65f5 100644 --- a/Pythonwin/pywin/scintilla/IDLEenvironment.py +++ b/Pythonwin/pywin/scintilla/IDLEenvironment.py @@ -29,8 +29,8 @@ def GetIDLEModule(module): except ImportError as details: msg = ( f"The IDLE extension '{module}' can not be located.\r\n\r\n" - "Please correct the installation and restart the" - f" application.\r\n\r\n{details}" + + "Please correct the installation and restart the" + + f" application.\r\n\r\n{details}" ) win32ui.MessageBox(msg) return None diff --git a/com/win32com/client/__init__.py b/com/win32com/client/__init__.py index 4cc903d506..4c86d011de 100644 --- a/com/win32com/client/__init__.py +++ b/com/win32com/client/__init__.py @@ -171,7 +171,7 @@ def CastTo(ob, target, typelib=None): if not hasattr(mod, target): raise ValueError( f"The interface name '{target}' does not appear in the " - f"specified library {typelib.ver_desc!r}" + + f"specified library {typelib.ver_desc!r}" ) elif hasattr(target, "index"): # string like @@ -199,7 +199,7 @@ def CastTo(ob, target, typelib=None): if target_clsid is None: raise ValueError( f"The interface name '{target}' does not appear in the " - f"same library as object '{ob!r}'" + + f"same library as object '{ob!r}'" ) mod = gencache.GetModuleForCLSID(target_clsid) if mod is not None: diff --git a/com/win32com/client/build.py b/com/win32com/client/build.py index d19a36d1fd..fc43c5bccc 100644 --- a/com/win32com/client/build.py +++ b/com/win32com/client/build.py @@ -103,8 +103,8 @@ def __init__( def __repr__(self): return ( f"MapEntry(dispid={self.dispid}, desc={self.desc}, names={self.names}, doc={self.doc!r}, " - f"resultCLSID={self.resultCLSID}, resultDocumentation={self.resultDocumentation}, " - f"wasProperty={self.wasProperty}, hidden={self.hidden}" + + f"resultCLSID={self.resultCLSID}, resultDocumentation={self.resultDocumentation}, " + + f"wasProperty={self.wasProperty}, hidden={self.hidden}" ) def GetResultCLSID(self): diff --git a/com/win32com/server/policy.py b/com/win32com/server/policy.py index a66fc0ca5f..493ae69503 100644 --- a/com/win32com/server/policy.py +++ b/com/win32com/server/policy.py @@ -225,7 +225,7 @@ def _CreateInstance_(self, clsid, reqIID): desc = ( f"The object '{myob!r}' was created, but does not support the " - f"interface '{IIDToInterfaceName(reqIID)}'({reqIID}): {desc}" + + f"interface '{IIDToInterfaceName(reqIID)}'({reqIID}): {desc}" ) raise pythoncom.com_error(hr, desc, exc, arg) diff --git a/com/win32comext/adsi/demos/scp.py b/com/win32comext/adsi/demos/scp.py index 6f2c252839..b2ff016ec9 100644 --- a/com/win32comext/adsi/demos/scp.py +++ b/com/win32comext/adsi/demos/scp.py @@ -199,7 +199,7 @@ def AllowAccessToScpProperties( setattr(scpObject, attribute, sd) # SetInfo updates the SCP object in the directory. scpObject.SetInfo() - logger.info(f"Set security on object for account '{trustee}'") + logger.info("Set security on object for account %r", trustee) # Service Principal Names functions from the same sample. diff --git a/com/win32comext/shell/demos/explorer_browser.py b/com/win32comext/shell/demos/explorer_browser.py index dbbd76b160..e95221a2d9 100644 --- a/com/win32comext/shell/demos/explorer_browser.py +++ b/com/win32comext/shell/demos/explorer_browser.py @@ -103,8 +103,7 @@ def __init__(self): except pythoncom.com_error as exc: # this should really only fail if no "nav" frame exists... print( - "Strange - failed to get the tree control even though " - "we asked for a EBO_SHOWFRAMES" + "Strange - failed to get the tree control even though we asked for a EBO_SHOWFRAMES" ) print(exc) else: diff --git a/com/win32comext/shell/demos/servers/folder_view.py b/com/win32comext/shell/demos/servers/folder_view.py index 28640f2c5b..d41ce39761 100644 --- a/com/win32comext/shell/demos/servers/folder_view.py +++ b/com/win32comext/shell/demos/servers/folder_view.py @@ -805,8 +805,8 @@ def DllRegisterServer(): key = winreg.CreateKey( winreg.HKEY_LOCAL_MACHINE, - "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\" - "Explorer\\Desktop\\Namespace\\" + ShellFolder._reg_clsid_, + "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Desktop\\Namespace\\" + + ShellFolder._reg_clsid_, ) winreg.SetValueEx(key, None, 0, winreg.REG_SZ, ShellFolder._reg_desc_) # And special shell keys under our CLSID diff --git a/com/win32comext/shell/demos/servers/shell_view.py b/com/win32comext/shell/demos/servers/shell_view.py index 17ee015621..0d620b98d9 100644 --- a/com/win32comext/shell/demos/servers/shell_view.py +++ b/com/win32comext/shell/demos/servers/shell_view.py @@ -924,8 +924,8 @@ def DllRegisterServer(): key = winreg.CreateKey( winreg.HKEY_LOCAL_MACHINE, - "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\" - "Explorer\\Desktop\\Namespace\\" + ShellFolderRoot._reg_clsid_, + "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Desktop\\Namespace\\" + + ShellFolderRoot._reg_clsid_, ) winreg.SetValueEx(key, None, 0, winreg.REG_SZ, ShellFolderRoot._reg_desc_) # And special shell keys under our CLSID @@ -950,8 +950,8 @@ def DllUnregisterServer(): try: key = winreg.DeleteKey( winreg.HKEY_LOCAL_MACHINE, - "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\" - "Explorer\\Desktop\\Namespace\\" + ShellFolderRoot._reg_clsid_, + "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Desktop\\Namespace\\" + + ShellFolderRoot._reg_clsid_, ) except OSError as details: import errno diff --git a/isapi/install.py b/isapi/install.py index b89c521dfa..b88e78941e 100644 --- a/isapi/install.py +++ b/isapi/install.py @@ -792,7 +792,7 @@ def HandleCommandLine( "--server", action="store", help="Specifies the IIS server to install/uninstall on." - f" Default is '{_IIS_OBJECT}/1'", + + f" Default is '{_IIS_OBJECT}/1'", ) (options, args) = parser.parse_args(argv[1:]) diff --git a/pywin32_postinstall.py b/pywin32_postinstall.py index f4a1898081..28cbdc7537 100644 --- a/pywin32_postinstall.py +++ b/pywin32_postinstall.py @@ -153,8 +153,8 @@ def CopyTo(desc, src, dest): raise full_desc = ( f"Error {desc}\n\n" - "If you have any Python applications running, " - f"please close them now\nand select 'Retry'\n\n{details.strerror}" + + "If you have any Python applications running, " + + f"please close them now\nand select 'Retry'\n\n{details.strerror}" ) rc = win32api.MessageBox( 0, full_desc, "Installation Error", win32con.MB_ABORTRETRYIGNORE @@ -472,8 +472,8 @@ def install(lib_dir): if os.path.exists(dst): msg = ( "The file '%s' exists, but can not be replaced " - "due to insufficient permissions. You must " - "reinstall this software as an Administrator" % dst + + "due to insufficient permissions. You must " + + "reinstall this software as an Administrator" % dst ) print(msg) raise RuntimeError(msg) diff --git a/setup.py b/setup.py index 54fcc555e4..69ab4f77e4 100644 --- a/setup.py +++ b/setup.py @@ -2179,7 +2179,7 @@ def convert_optional_data_files(files): except RuntimeError as details: if not str(details.args[0]).startswith("No file"): raise - logging.info("NOTE: Optional file %s not found - skipping" % file) + logging.info("NOTE: Optional file %s not found - skipping", file) else: ret.append(temp[0]) return ret @@ -2285,9 +2285,9 @@ def maybe_fixup_exes(): # keep it short and sweet as it's the first thing shown by the UI. long_description = ( "Python extensions for Microsoft Windows\n" - "Provides access to much of the Win32 API, the\n" - "ability to create and use COM objects, and the\n" - "Pythonwin environment." + + "Provides access to much of the Win32 API, the\n" + + "ability to create and use COM objects, and the\n" + + "Pythonwin environment." ) long_description_content_type = "text/plain" else: diff --git a/win32/Demos/NetValidatePasswordPolicy.py b/win32/Demos/NetValidatePasswordPolicy.py index 026f1e5cc9..7d3f28040f 100644 --- a/win32/Demos/NetValidatePasswordPolicy.py +++ b/win32/Demos/NetValidatePasswordPolicy.py @@ -51,7 +51,7 @@ def main(): "--password", action="store", help="The clear-text password to pass to the function " - "(only for the 'change' command)", + + "(only for the 'change' command)", ) parser.add_option( @@ -60,8 +60,8 @@ def main(): action="store_false", default=True, help="Used to specify the password does NOT match (ie, " - "uses False for the PasswordMatch/PasswordMatched " - "arg, both 'auth' and 'change' commands)", + + "uses False for the PasswordMatch/PasswordMatched " + + "arg, both 'auth' and 'change' commands)", ) parser.add_option( diff --git a/win32/Lib/win32gui_struct.py b/win32/Lib/win32gui_struct.py index bf4c9c6bec..522580db29 100644 --- a/win32/Lib/win32gui_struct.py +++ b/win32/Lib/win32gui_struct.py @@ -225,7 +225,7 @@ def UnpackMENUITEMINFO(s): text = None return _MakeResult( "MENUITEMINFO fType fState wID hSubMenu hbmpChecked " - "hbmpUnchecked dwItemData text hbmpItem", + + "hbmpUnchecked dwItemData text hbmpItem", ( fType, fState, @@ -502,7 +502,7 @@ def UnpackTVITEM(buffer): text = None return _MakeResult( "TVITEM item_hItem item_state item_stateMask " - "text item_image item_selimage item_cChildren item_param", + + "text item_image item_selimage item_cChildren item_param", ( item_hItem, item_state, @@ -642,7 +642,7 @@ def UnpackLVITEM(buffer): text = None return _MakeResult( "LVITEM item_item item_subItem item_state " - "item_stateMask text item_image item_param item_indent", + + "item_stateMask text item_image item_param item_indent", ( item_item, item_subItem, @@ -687,7 +687,7 @@ def UnpackLVNOTIFY(lparam): ) = struct.unpack(format, buf) return _MakeResult( "UnpackLVNOTIFY hwndFrom id code item subitem " - "newstate oldstate changed pt lparam", + + "newstate oldstate changed pt lparam", ( hwndFrom, id, diff --git a/win32/test/test_win32trace.py b/win32/test/test_win32trace.py index 79a08539f1..fed3d58d6f 100644 --- a/win32/test/test_win32trace.py +++ b/win32/test/test_win32trace.py @@ -29,8 +29,7 @@ def CheckNoOtherReaders(): win32trace.TermRead() win32trace.TermWrite() raise RuntimeError( - "An existing win32trace reader appears to be " - "running - please stop this process and try again" + "An existing win32trace reader appears to be running - please stop this process and try again" )