From a7162edd36e4a90bcc40ab28b86e65aa62397530 Mon Sep 17 00:00:00 2001 From: Avasam Date: Tue, 4 Jun 2024 19:41:54 -0400 Subject: [PATCH] pyright turn on reportOptionalCall --- com/win32comext/axscript/client/framework.py | 9 ++++++--- pyrightconfig.json | 1 - 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/com/win32comext/axscript/client/framework.py b/com/win32comext/axscript/client/framework.py index e4c69f7ba..67769d1f8 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 356d749ba..1028665a3 100644 --- a/pyrightconfig.json +++ b/pyrightconfig.json @@ -35,7 +35,6 @@ // 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",