Skip to content

Commit

Permalink
checkers fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam committed Aug 11, 2023
1 parent 176d85f commit d3c502b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
12 changes: 6 additions & 6 deletions com/win32com/server/exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
"""
import sys

from pythoncom import GetScodeString, com_error
import pythoncom


# Note that we derive from com_error, which derives from exceptions.Exception
# Also note that we dont support "self.args", as we dont support tuple-unpacking
class COMException(com_error):
class COMException(pythoncom.com_error):
"""An Exception object that is understood by the framework.
If the framework is presented with an exception of type class,
Expand Down Expand Up @@ -68,14 +68,14 @@ def __init__(
if scode == 1 and not self.description:
self.description = "S_FALSE"
elif scode and not self.description:
self.description = GetScodeString(scode)
self.description = pythoncom.GetScodeString(scode)

self.source = source
self.helpfile = helpfile
self.helpcontext = helpContext

# todo - fill in the exception value
com_error.__init__(self, scode, self.description, None, -1)
pythoncom.com_error.__init__(self, scode, self.description, None, -1)

def __repr__(self):
return "<COM Exception - scode=%s, desc=%s>" % (self.scode, self.description)
Expand All @@ -91,9 +91,9 @@ def IsCOMException(t=None):
if t is None:
t = sys.exc_info()[0]
try:
return issubclass(t, com_error)
return issubclass(t, pythoncom.com_error)
except TypeError: # 1.5 in -X mode?
return t is com_error
return t is pythoncom.com_error


def IsCOMServerException(t=None):
Expand Down
3 changes: 2 additions & 1 deletion com/win32comext/adsi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
# interface, as well as via IDispatch.
import pythoncom

from .adsi import ( # nopycln: import # win32comext/adsi/adsi.pyd
from .adsi import ( # win32comext/adsi/adsi.pyd
ADsBuildEnumerator as PYD_ADsBuildEnumerator,
ADsEnumerateNext as PYD_ADsEnumerateNext,
ADsGetObject as PYD_ADsGetObject,
Expand Down Expand Up @@ -111,6 +111,7 @@ def QueryInterface(self, iid):
return _get_good_ret(ret)


# We override the adsi.pyd methods to do the right thing.
def ADsGetObject(path, iid=pythoncom.IID_IDispatch):
ret = PYD_ADsGetObject(path, iid)
return _get_good_ret(ret)
Expand Down
1 change: 0 additions & 1 deletion com/win32comext/axdebug/codecontainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import sys
import tokenize
from typing import Any, cast

import win32api
import winerror
Expand Down
3 changes: 2 additions & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ disallow_incomplete_defs = false

; attr-defined: Module has no attribute (modules are dynamic)
; method-assign: Cannot assign to a method (lots of monkey patching)
disable_error_code = attr-defined, method-assign
; name-defined: Name "..." is not defined (dynamic modules will be hard to type without stubs, ie: pythoncom.*, leave undefined/unbound to Flake8/Ruff/pyright)
disable_error_code = attr-defined, method-assign, name-defined
; TODO: adodbapi should be updated and fixed separatly
; Pythonwin/Scintilla and Pythonwin/pywin/idle are vendored
; Ignoring non-public apis for now
Expand Down
2 changes: 0 additions & 2 deletions pyrightconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"typeCheckingMode": "basic",
"pythonVersion": "3.7",
// Ignore shipped types-pywin32
// "typeshedPath": ".",
// Keep it simple for now by allowing both mypy and pyright to use `type: ignore`
"enableTypeIgnoreComments": true,
// Exclude from scanning when running pyright
Expand Down

0 comments on commit d3c502b

Please sign in to comment.