Skip to content

Commit ae65bf8

Browse files
authored
Extracted annotations only changes from #2102 (#2175)
1 parent bd65ce8 commit ae65bf8

24 files changed

Lines changed: 58 additions & 29 deletions

File tree

.github/workflows/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ jobs:
9595
path: |
9696
dist/*.whl
9797
98+
# This job can be run locally with the `format_all.bat` script
9899
checkers:
99100
runs-on: ubuntu-latest
100101
steps:

Pythonwin/pywin/framework/bitmap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def MatchDocType(self, fileName, fileType):
128128

129129
# For debugging purposes, when this module may be reloaded many times.
130130
try:
131-
win32ui.GetApp().RemoveDocTemplate(bitmapTemplate)
131+
win32ui.GetApp().RemoveDocTemplate(bitmapTemplate) # type: ignore[has-type, used-before-def]
132132
except NameError:
133133
pass
134134

Pythonwin/pywin/framework/editor/color/coloreditor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ def GetPythonPropertyPages(self):
638638

639639
# For debugging purposes, when this module may be reloaded many times.
640640
try:
641-
win32ui.GetApp().RemoveDocTemplate(editorTemplate)
641+
win32ui.GetApp().RemoveDocTemplate(editorTemplate) # type: ignore[has-type, used-before-def]
642642
except NameError:
643643
pass
644644

Pythonwin/pywin/framework/editor/editor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ def Create(fileName=None, title=None, template=None):
503503
if __name__ == prefModule:
504504
# For debugging purposes, when this module may be reloaded many times.
505505
try:
506-
win32ui.GetApp().RemoveDocTemplate(editorTemplate)
506+
win32ui.GetApp().RemoveDocTemplate(editorTemplate) # type: ignore[has-type, used-before-def]
507507
except (NameError, win32ui.error):
508508
pass
509509

Pythonwin/pywin/framework/mdi_pychecker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,7 @@ def getNew(self):
842842

843843

844844
try:
845-
win32ui.GetApp().RemoveDocTemplate(greptemplate)
845+
win32ui.GetApp().RemoveDocTemplate(greptemplate) # type: ignore[has-type, used-before-def]
846846
except NameError:
847847
pass
848848

Pythonwin/pywin/framework/sgrepmdi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ def getNew(self):
751751

752752

753753
try:
754-
win32ui.GetApp().RemoveDocTemplate(greptemplate)
754+
win32ui.GetApp().RemoveDocTemplate(greptemplate) # type: ignore[has-type, used-before-def]
755755
except NameError:
756756
pass
757757

Pythonwin/pywin/scintilla/bindings.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import traceback
24

35
import win32api
@@ -13,8 +15,8 @@
1315

1416
next_id = 5000
1517

16-
event_to_commands = {} # dict of integer IDs to event names.
17-
command_to_events = {} # dict of event names to int IDs
18+
event_to_commands: dict[str, int] = {} # dict of event names to IDs
19+
command_to_events: dict[int, str] = {} # dict of IDs to event names
1820

1921

2022
def assign_command_id(event, id=0):

Pythonwin/pywin/scintilla/find.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# find.py - Find and Replace
2+
from __future__ import annotations
3+
24
import afxres
35
import win32api
46
import win32con
@@ -35,7 +37,7 @@ def __setattr__(self, attr, val):
3537

3638
curDialog = None
3739
lastSearch = defaultSearch = SearchParams()
38-
searchHistory = []
40+
searchHistory: list[str] = []
3941

4042

4143
def ShowFindDialog():

Pythonwin/pywin/tools/browseProjects.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def GetText(self):
2424

2525

2626
class HLICLBRItem(hierlist.HierListItem):
27-
def __init__(self, name, file, lineno, suffix=""):
27+
def __init__(self, name: str, file, lineno, suffix=""):
2828
# If the 'name' object itself has a .name, use it. Not sure
2929
# how this happens, but seems pyclbr related.
3030
# See PyWin32 bug 817035

com/win32com/client/gencache.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,14 @@
2121
Maybe an OLE2 compound file, or a bsddb file?
2222
"""
2323

24+
from __future__ import annotations
25+
2426
import glob
2527
import os
2628
import sys
2729
from importlib import reload
30+
from types import ModuleType
31+
from typing import Any
2832

2933
import pythoncom
3034
import pywintypes
@@ -36,11 +40,11 @@
3640
bForDemandDefault = 0 # Default value of bForDemand - toggle this to change the world - see also makepy.py
3741

3842
# The global dictionary
39-
clsidToTypelib = {}
43+
clsidToTypelib: dict[str, tuple[str, int, int, int]] = {}
4044

4145
# If we have a different version of the typelib generated, this
4246
# maps the "requested version" to the "generated version".
43-
versionRedirectMap = {}
47+
versionRedirectMap: dict[tuple[str, int, int, int], ModuleType | None] = {}
4448

4549
# There is no reason we *must* be readonly in a .zip, but we are now,
4650
# Rather than check for ".zip" or other tricks, PEP302 defines
@@ -53,7 +57,8 @@
5357

5458
# A dictionary of ITypeLibrary objects for demand generation explicitly handed to us
5559
# Keyed by usual clsid, lcid, major, minor
56-
demandGeneratedTypeLibraries = {}
60+
# Typing as Any because PyITypeLib is not exposed
61+
demandGeneratedTypeLibraries: dict[tuple[str, int, int, int], Any] = {}
5762

5863
import pickle as pickle
5964

0 commit comments

Comments
 (0)