Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mypy: fix all name-defined #2335

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Pythonwin/pywin/docking/DockingBar.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,6 @@ def EditCreator(parent):


def test():
global bar
bar = DockingBar()
creator = EditCreator
bar.CreateWindow(win32ui.GetMainFrame(), creator, "Coolbar Demo", 0xFFFFF)
Expand Down
6 changes: 2 additions & 4 deletions Pythonwin/pywin/framework/intpyapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import win32api
import win32con
import win32ui
from pywin.mfc import afxres, dialog
from pywin.mfc import afxres, dialog, docview

from . import app, dbgcommands

Expand All @@ -27,9 +27,7 @@ def _SetupSharedMenu_(self):
help.SetHelpMenuOtherHelp(sharedMenu)


from pywin.mfc import docview

docview.DocTemplate._SetupSharedMenu_ = _SetupSharedMenu_
docview.DocTemplate._SetupSharedMenu_ = _SetupSharedMenu_ # type: ignore[method-assign]


class MainFrame(app.MainFrame):
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/pywin/framework/intpydde.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import win32api
import win32ui
from dde import *
from dde import CreateServer, CreateServerSystemTopic
from pywin.mfc import object


Expand Down
2 changes: 1 addition & 1 deletion com/win32com/server/exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

# Note that we derive from com_error, which derives from builtin Exception
# Also note that we don't support "self.args", as we don't support tuple-unpacking
class COMException(pythoncom.com_error):
class COMException(pythoncom.com_error): # type: ignore[name-defined] # Dynamic module
"""An Exception object that is understood by the framework.

If the framework is presented with an exception of type class,
Expand Down
26 changes: 21 additions & 5 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,26 @@ disable_error_code =
; Class cannot subclass "..." (has type "Any"); (IDEM)
; TODO: Use typeshed's types-pywin32 stubs after a few more fixes there
misc,
; Name "..." is not defined; (IDEM, leave undefined/unbound to Flake8/Ruff/pyright)
name-defined,
; Cannot assign to a method (we do lots of monkey patching)
method-assign,
; These are the other error codes that would currently fail with check_untyped_defs = true
; TODO: Gradually fix them until we can turn on check_untyped_defs
; arg-type,
; assignment,
; call-arg,
; comparison-overlap,
; has-type,
; index,
; list-item,
; operator,
; override,
; str-format,
; type-var,
; union-attr,
; valid-type,
; var-annotated,
; ; And these only happen when checking against types-pywin32
; func-returns-value,
; call-overload,
; no-redef,
exclude = (?x)(
^build/
; Vendored
Expand All @@ -45,7 +61,7 @@ exclude = (?x)(
)

; C-modules that will need type-stubs
[mypy-adsi.*,dde,exchange,exchdapi,mapi,perfmon,servicemanager,win32api,win32console,win32clipboard,win32comext.adsi.adsi,win32event,win32evtlog,win32file,win32gui,win32help,win32pdh,win32process,win32ras,win32security,win32service,win32trace,win32ui,win32uiole,win32wnet,_win32sysloader,_winxptheme]
[mypy-adsi.*,dde,exchange,exchdapi,mapi,perfmon,servicemanager,win32api,win32console,win32clipboard,win32comext.adsi.adsi,win32comext.mapi.mapi,win32event,win32evtlog,win32file,win32gui,win32help,win32pdh,win32process,win32ras,win32security,win32service,win32trace,win32ui,win32uiole,win32wnet,_win32sysloader,_winxptheme]
ignore_missing_imports = True

; verstamp is installed from win32verstamp.py called in setup.py
Expand Down
Loading