diff --git a/adodbapi/apibase.py b/adodbapi/apibase.py index 40aeb9447f..7190541897 100644 --- a/adodbapi/apibase.py +++ b/adodbapi/apibase.py @@ -551,9 +551,8 @@ def __getitem__(self, key): # used for row[key] type of value access return self._getValue( self.rows.columnNames[key.lower()] ) # extension row[columnName] designation - except (KeyError, TypeError): - er, st, tr = sys.exc_info() - raise er(f'No such key as "{key!r}" in {self!r}').with_traceback(tr) + except (KeyError, TypeError) as er: + raise type(er)(f'No such key as "{key!r}" in {self!r}') from er def __iter__(self): return iter(self.__next__()) diff --git a/com/win32comext/axscript/client/framework.py b/com/win32comext/axscript/client/framework.py index 69e8cc5543..b0d3eb09ef 100644 --- a/com/win32comext/axscript/client/framework.py +++ b/com/win32comext/axscript/client/framework.py @@ -11,7 +11,8 @@ import re import sys -from typing import NoReturn +from collections.abc import Callable +from typing import Any, NoReturn import pythoncom # Need simple connection point support import win32api @@ -192,7 +193,9 @@ def __init__(self, myItem, coDispatch): self.connection = None self.coDispatch = coDispatch self.myScriptItem = myItem - self.myInvokeMethod = myItem.GetEngine().ProcessScriptItemEvent + self.myInvokeMethod: Callable[[Any, Any, Any, Any, Any], Any] = ( + myItem.GetEngine().ProcessScriptItemEvent + ) # Incomplete type self.iid = None def Reset(self): @@ -218,7 +221,7 @@ def _invoke_(self, dispid, lcid, wFlags, args): event = self.events[dispid] except: raise COMException(scode=winerror.DISP_E_MEMBERNOTFOUND) - # print("Invoke for ", event, "on", self.myScriptItem, " - calling", self.myInvokeMethod) + # print("Invoke for", event, "on", self.myScriptItem, "- calling", self.myInvokeMethod) return self.myInvokeMethod(self.myScriptItem, event, lcid, wFlags, args) def GetSourceTypeInfo(self, typeinfo): diff --git a/pyrightconfig.json b/pyrightconfig.json index 7cd19c5db0..bf65e809cb 100644 --- a/pyrightconfig.json +++ b/pyrightconfig.json @@ -32,10 +32,8 @@ "reportArgumentType": "none", "reportAttributeAccessIssue": "none", // FIXE: These all need to be fixed first and turned back to error - // some of the fixes need to be done in types-pywin32 from typeshed "reportCallIssue": "warning", "reportOperatorIssue": "warning", - "reportOptionalCall": "warning", "reportOptionalIterable": "warning", "reportOptionalMemberAccess": "warning", "reportOptionalSubscript": "warning",