Skip to content

Commit

Permalink
Merge branch 'main' into Bump-GitHub-actions-and-checkers
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam authored Oct 25, 2024
2 parents 8dc03bc + 30e3a75 commit 2ddbb22
Show file tree
Hide file tree
Showing 60 changed files with 166 additions and 206 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ jobs:
cache: pip
cache-dependency-path: .github/workflows/main.yml
check-latest: true
- run: pip install types-regex types-setuptools PyOpenGL mypy==1.12.*
- run: pip install types-setuptools PyOpenGL mypy[faster-cache]==1.13.*
- run: mypy . --python-version=${{ matrix.python-version }}

pyright:
Expand All @@ -163,7 +163,7 @@ jobs:
cache-dependency-path: .github/workflows/main.yml
check-latest: true
# pyright vendors typeshed, but let's make sure we have the most up to date stubs
- run: pip install types-regex types-setuptools PyOpenGL
- run: pip install types-setuptools PyOpenGL
- uses: jakebailey/pyright-action@v2
with:
python-version: ${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion AutoDuck/makedfromi.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def GetComments(line, lineNo, lines):
if len(data) != 2:
break
if data[0].strip():
break # Not a continutation!
break # Not a continuation!
if data[1].strip().startswith("@"):
# new command
break
Expand Down
2 changes: 1 addition & 1 deletion AutoDuck/py2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def format_desc(desc):
# 'first_para_of_docstring'
# '@comm next para of docstring'
# '@comm next para of docstring' ... etc
# BUT - also handling enbedded doctests, where we write
# BUT - also handling embedded doctests, where we write
# '@iex >>> etc.'
if not desc:
return ""
Expand Down
6 changes: 4 additions & 2 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ https://mhammond.github.io/pywin32_installers.html.
Coming in build 309, as yet unreleased
--------------------------------------

* Fixed Pythonwin's editor failing due to invalid regex import (#2419, @Avasam)
* Last error wrongly set by some modules (#2302, @CristiFati)
* Dropped support for Python 3.7 (#2207, @Avasam)
* Implement the creation of SAFEARRAY(VT_RECORD) from a sequence of COM Records (#2317, @geppi)
* Implement record pointers as [in, out] method parameters of a Dispatch Interface (#2304, #2310, @geppi)
Expand Down Expand Up @@ -68,7 +70,7 @@ as the .chm file, certain MAPI libraries etc, and .exe installers.
* `win32com.client.build.error`
* `win32com.client.genpy.error`
* Add EnumDesktopWindows (#2219, @CristiFati)
* Marked `exc_type` and `exc_traceback` in `win32comext.axscript.client.error.AXScriptException.__init__` as deprecated. (#2236 , @Avasam)
* Marked `exc_type` and `exc_traceback` in `win32comext.axscript.client.error.AXScriptException.__init__` as deprecated. (#2236, @Avasam)
They are now unused and all information is taken from the `exc_value` parameter.
* Fixed non-overriden `pywin.scintilla.formatter.Formatter.ColorizeString` raising `TypeError` instead of `RuntimeError` due to too many parameters (#2216, @Avasam)
* Fixed broken since Python 3 tokenization in `win32comext.axdebug.codecontainer.pySourceCodeContainer.GetSyntaxColorAttributes` (#2216, @Avasam)
Expand Down Expand Up @@ -189,7 +191,7 @@ as the .chm file, certain MAPI libraries etc, and .exe installers.
* Use byte-string (`b""`) for constant bytes values instead of superfluous `.encode` calls (#2046, @Avasam)
* Cleaned up unused imports (#1986, #2051, #1990, #2124, #2126, @Avasam)
* Removed duplicated declarations, constants and definitions (#2050, #1950, #1990, @Avasam)
* Small generalized optimization by using augmented assignements (in-place operators) where possible (#2274, @Avasam)
* Small generalized optimization by using augmented assignments (in-place operators) where possible (#2274, @Avasam)
* General speed and size improvements due to all the removed code. (#2046, #1986, #2050, #1950, #2085, #2087, #2051, #1990, #2106, #2127, #2124, #2126, #2177, #2218, #2202, #2205, #2217)

### adodbapi
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/contents.d
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ it uses overrides the default. Thus, regardless of your preferences, if the fir
indent in the file is a tab, Pythonwin uses tabs for the entire file (and
similarly, uses spaces if the first block is indented with spaces)
<nl>
Things can appear to get wierd when editing a file with mixed tabs and spaces.
Things can appear to get weird when editing a file with mixed tabs and spaces.
Although mixed tabs and spaces in the same indent is evil, there are a number
of source files that have certain classes/functions indented with spaces, and others
that use tabs. The editor will not correctly adjust to the current block - whatever
Expand Down
14 changes: 7 additions & 7 deletions Pythonwin/pythondoc.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ BOOL CPythonDocTemp<P>::OnSaveDocument(const TCHAR *fileName)
// @pyparm string|fileName||The name of the file being saved.
// @xref <om PyCDocument.OnSaveDocument>
// @comm If a handler is defined for this function, the base (MFC) function will not
// be called. If necessary, the handler must call this function explicitely.
// be called. If necessary, the handler must call this function explicitly.
CVirtualHelper helper("OnSaveDocument", this);
if (helper.call(fileName)) {
int ret;
Expand All @@ -131,7 +131,7 @@ BOOL CPythonDocTemp<P>::OnOpenDocument(const TCHAR *fileName)
// @pyvirtual int|PyCDocument|OnOpenDocument|Called by the MFC architecture.
// @xref <om PyCDocument.OnOpenDocument>
// @comm If a handler is defined for this function, the base (MFC) function will not
// be called. If necessary, the handler must call this function explicitely.
// be called. If necessary, the handler must call this function explicitly.
CVirtualHelper helper("OnOpenDocument", this);
if (!helper.HaveHandler()) {
PyErr_SetString(ui_module_error, "PyCDocument::OnOpenDocument handler does not exist.");
Expand All @@ -155,7 +155,7 @@ BOOL CPythonDocTemp<P>::OnNewDocument()
// @pyvirtual int|PyCDocument|OnNewDocument|Called by the MFC architecture.
// @xref <om PyCDocument.OnNewDocument>
// @comm If a handler is defined for this function, the base (MFC) function will not
// be called. If necessary, the handler must call this function explicitely.
// be called. If necessary, the handler must call this function explicitly.
CVirtualHelper helper("OnNewDocument", this);
if (!helper.HaveHandler()) {
helper.release_full();
Expand All @@ -182,7 +182,7 @@ void CPythonDocTemp<P>::OnCloseDocument()
// @pyvirtual |PyCDocument|OnCloseDocument|Called by the MFC architecture.
// @xref <om PyCDocument.OnCloseDocument>
// @comm If a handler is defined for this function, the base (MFC) function will not
// be called. If necessary, the handler must call this function explicitely.
// be called. If necessary, the handler must call this function explicitly.
CVirtualHelper helper("OnCloseDocument", this);
if (helper.HaveHandler()) {
helper.call();
Expand Down Expand Up @@ -215,15 +215,15 @@ void CPythonDocTemp<P>::DeleteContents()
P::DeleteContents();
}
// @comm If a handler is defined for this function, the base (MFC) function will not
// be called. If necessary, the handler must call this function explicitely.
// be called. If necessary, the handler must call this function explicitly.
}
template <class P>
BOOL CPythonDocTemp<P>::SaveModified()
{
// @pyvirtual int|PyCDocument|SaveModified|Called by the MFC architecture when a document is closed.
// @xref <om PyCDocument.SaveModified>
// @comm If a handler is defined for this function, the base (MFC) function will not
// be called. If necessary, the handler must call this function explicitely.
// be called. If necessary, the handler must call this function explicitly.
CVirtualHelper helper("SaveModified", this);
if (!helper.HaveHandler()) {
helper.release_full();
Expand All @@ -244,7 +244,7 @@ void CPythonDocTemp<P>::OnChangedViewList()
// @pyvirtual int|PyCDocument|OnChangedViewList|Called by the MFC architecture when after a view is attached.
// @xref <om PyCDocument.OnChangedViewList>
// @comm If a handler is defined for this function, the base (MFC) function will not
// be called. If necessary, the handler must call this function explicitely.
// be called. If necessary, the handler must call this function explicitly.
CVirtualHelper helper("OnChangedViewList", this);
if (helper.HaveHandler() && helper.call()) {
return;
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/pywin/debugger/fail.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def b():
b = 1
pywin.debugger.set_trace()
# After importing or running this module, you are likely to be
# sitting at the next line. This is because we explicitely
# sitting at the next line. This is because we explicitly
# broke into the debugger using the "set_trace() function
# "pywin.debugger.brk()" is a shorter alias for this.
c()
Expand Down
12 changes: 6 additions & 6 deletions Pythonwin/pywin/framework/editor/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# We now support reloading of externally modified documented
# (eg, presumably by some other process, such as source control or
# another editor.
# We also suport auto-loading of externally modified files.
# We also support auto-loading of externally modified files.
# - if the current document has not been modified in this
# editor, but has been modified on disk, then the file
# can be automatically reloaded.
Expand All @@ -19,7 +19,6 @@

import re

import regex
import win32api
import win32con
import win32ui
Expand All @@ -36,8 +35,8 @@
# from pywin.mfc.docview import EditView as ParentEditorView
# from pywin.mfc.docview import Document as ParentEditorDocument

patImport = regex.symcomp(r"import \(<name>.*\)")
patIndent = regex.compile(r"^\([ \t]*[~ \t]\)")
patImport = re.compile(r"import (?P<name>.*)")
patIndent = re.compile(r"^([ \t]*[~ \t])")

ID_LOCATE_FILE = 0xE200
ID_GOTO_LINE = 0xE2001
Expand Down Expand Up @@ -364,9 +363,10 @@ def OnRClick(self, params):
# look for a module name
line = self._obj_.GetLine().strip()
flags = win32con.MF_STRING | win32con.MF_ENABLED
if patImport.match(line) == len(line):
matchResult = patImport.match(line)
if matchResult and matchResult[0] == line:
menu.AppendMenu(
flags, ID_LOCATE_FILE, "&Locate %s.py" % patImport.group("name")
flags, ID_LOCATE_FILE, "&Locate %s.py" % matchResult.group("name")
)
menu.AppendMenu(win32con.MF_SEPARATOR)
menu.AppendMenu(flags, win32ui.ID_EDIT_UNDO, "&Undo")
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/pywin/framework/editor/vss.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def CheckoutFile(fileName):
project, vssFname, database = rc
if g_sourceSafe is None:
g_sourceSafe = win32com.client.Dispatch("SourceSafe")
# SS seems a bit wierd. It defaults the arguments as empty strings, but
# SS seems a bit weird. It defaults the arguments as empty strings, but
# then complains when they are used - so we pass "Missing"
if not database:
database = pythoncom.Missing
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/pywin/framework/intpyapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ def OnFileLocate(self, id, code):
else:
win32ui.GetApp().OpenDocumentFile(newName)

# Display all the "options" proprety pages we can find
# Display all the "options" property pages we can find
def OnViewOptions(self, id, code):
win32ui.InitRichEdit()
sheet = dialog.PropertySheet("Pythonwin Options")
Expand Down
3 changes: 1 addition & 2 deletions Pythonwin/pywin/framework/mdi_pychecker.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,7 @@ def __radd__(self, other):


# Group(1) is the filename, group(2) is the lineno.
# regexGrepResult=regex.compile(r"^\([a-zA-Z]:.*\)(\([0-9]+\))")
# regexGrep=re.compile(r"^([a-zA-Z]:[^(]*)\((\d+)\)")
# regexGrep = re.compile(r"^([a-zA-Z]:[^(]*)\((\d+)\)")
regexGrep = re.compile(r"^(..[^\(:]+)?[\(:](\d+)[\):]:?\s*(.*)")

# these are the atom numbers defined by Windows for basic dialog controls
Expand Down
2 changes: 0 additions & 2 deletions Pythonwin/pywin/framework/sgrepmdi.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,6 @@ def __radd__(self, other):


# Group(1) is the filename, group(2) is the lineno.
# regexGrepResult=regex.compile(r"^\([a-zA-Z]:.*\)(\([0-9]+\))")

regexGrep = re.compile(r"^([a-zA-Z]:[^(]*)\(([0-9]+)\)")

# these are the atom numbers defined by Windows for basic dialog controls
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/pywin/framework/startup.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
pywin.__path__[0] = win32ui.FullPath(pywin.__path__[0])
pywin.framework.__path__[0] = win32ui.FullPath(pywin.framework.__path__[0])

# make a few wierd sys values. This is so later we can clobber sys.argv to trick
# make a few weird sys values. This is so later we can clobber sys.argv to trick
# scripts when running under a GUI environment.

moduleName = "pywin.framework.intpyapp"
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/pywin/scintilla/keycodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def get_vk(chardesc):


def parse_key_name(name):
name += "-" # Add a sentinal
name += "-" # Add a sentinel
start = pos = 0
max = len(name)
toks = []
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/pywin/scintilla/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ def CalculatePageRanges(self, dc, pInfo):
pageStart = self.FormatRange(dc, pageStart, textLen, rc, 0)
maxPage += 1
self.starts[maxPage] = pageStart
# And a sentinal for one page past the end
# And a sentinel for one page past the end
self.starts[maxPage + 1] = textLen
# When actually printing, maxPage doesn't have any effect at this late state.
# but is needed to make the Print Preview work correctly.
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/win32bitmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ PyObject *ui_bitmap_load_bitmap_file(PyObject *self, PyObject *args)
return NULL;
}
*/
/* Attempt to load wierd bitmap format.
/* Attempt to load weird bitmap format.
if (bmFileHeader.bfOffBits) {
PyObject *args = Py_BuildValue("(i)", bmFileHeader.bfOffBits);
result = gui_call_object(seeker, args);
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/win32dlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ PyCDialog::~PyCDialog()
GlobalFree(hSaved);
}

ui_assoc_object::SetAssocInvalid(); // must call this explicitely, as I ignore SetAssocInvalid
ui_assoc_object::SetAssocInvalid(); // must call this explicitly, as I ignore SetAssocInvalid
Py_XDECREF(ddlist); // we can not have the pointer deleted at window destruction time
// for a dialog (as MFC still needs it after the dialog has completed
BOOL bManDeleteSave = bManualDelete;
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/win32virt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ CVirtualHelper::CVirtualHelper(const char *iname, void *iassoc, EnumVirtualError
PyErr_Fetch(&t, &v, &tb);
handler = PyObject_GetAttrString(py_bob->virtualInst, (char *)iname);
if (handler) {
// explicitely check a method returned, else the classes
// explicitly check a method returned, else the classes
// delegation may cause a circular call chain.
if (!PyMethod_Check(handler)) {
if (!PyCFunction_Check(handler)) {
Expand Down
4 changes: 2 additions & 2 deletions adodbapi/adodbapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def getIndexedValue(obj, index):
def make_COM_connecter():
try:
pythoncom.CoInitialize() # v2.1 Paj
c = Dispatch("ADODB.Connection") # connect _after_ CoIninialize v2.1.1 adamvan
c = Dispatch("ADODB.Connection") # connect _after_ CoInitialize v2.1.1 adamvan
except:
raise api.InterfaceError(
"Windows COM Error: Dispatch('ADODB.Connection') failed."
Expand Down Expand Up @@ -593,7 +593,7 @@ def _raiseCursorError(self, errorclass, errorvalue):
eh(self.connection, self, errorclass, errorvalue)

def build_column_info(self, recordset):
self.converters = [] # convertion function for each column
self.converters = [] # conversion function for each column
self.columnNames = {} # names of columns {lowercase name : number,...}
self._description = None

Expand Down
2 changes: 1 addition & 1 deletion adodbapi/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Try:
or:
adodbapi.apibase.variantConversions[adodbapi.ado_consts.adNumeric] = adodbapi.apibase.cvtFloat
or:
adodbapi.apibase.variantConversions[adodbapi.ado_consts.adNumeric] = write_your_own_convertion_function
adodbapi.apibase.variantConversions[adodbapi.ado_consts.adNumeric] = write_your_own_conversion_function
............
notes for 2.6.2:
The definitive source has been moved to https://github.com/mhammond/pywin32/tree/master/adodbapi.
Expand Down
4 changes: 2 additions & 2 deletions adodbapi/test/adodbapitest.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def testUserDefinedConversionForExactNumericTypes(self):
# now return strings
adodbapi.variantConversions[ado_consts.adNumeric] = adodbapi.cvtString
self.helpTestDataType("numeric(18,2)", "NUMBER", "3.45")
# now a completly weird user defined convertion
# now a completely weird user defined conversion
adodbapi.variantConversions[ado_consts.adNumeric] = (
lambda x: "!!This function returns a funny unicode string %s!!" % x
)
Expand All @@ -228,7 +228,7 @@ def testUserDefinedConversionForExactNumericTypes(self):
finally:
# now reset the converter to its original function
adodbapi.variantConversions[ado_consts.adNumeric] = (
oldconverter # Restore the original convertion function
oldconverter # Restore the original conversion function
)

def helpTestDataType(
Expand Down
4 changes: 2 additions & 2 deletions adodbapi/test/dbapi20.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
# - Now a subclass of TestCase, to avoid requiring the driver stub
# to use multiple inheritance
# - Reversed the polarity of buggy test in test_description
# - Test exception heirarchy correctly
# - Test exception hierarchy correctly
# - self.populate is now self._populate(), so if a driver stub
# overrides self.ddl1 this change propogates
# - VARCHAR columns now have a width, which will hopefully make the
Expand Down Expand Up @@ -198,7 +198,7 @@ def test_paramstyle(self):

def test_Exceptions(self):
# Make sure required exceptions exist, and are in the
# defined heirarchy.
# defined hierarchy.
if sys.version[0] == "3": # under Python 3 StardardError no longer exists
self.assertTrue(issubclass(self.driver.Warning, Exception))
self.assertTrue(issubclass(self.driver.Error, Exception))
Expand Down
2 changes: 1 addition & 1 deletion adodbapi/test/setuptestframework.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def makeadopackage(testfolder):
shutil.copy(os.path.join(adoPath, f), newpackage)
return testfolder
else:
raise OSError("Connot find source of adodbapi to test.")
raise OSError("Cannot find source of adodbapi to test.")


def makemdb(testfolder, mdb_name):
Expand Down
2 changes: 1 addition & 1 deletion build_env.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ where mc
```

(Note that the above process for 'mc' doesn't appear necessary for VS2017, but
markh hasn't tried with VS2019 - please share your experiences!)
@mhammond hasn't tried with VS2019 - please share your experiences!)

# Build

Expand Down
2 changes: 1 addition & 1 deletion com/changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ Dec 1, 96
win32com.pythoncom works (and is the "official" way!).
- Connection point support added. makepy will now generate code suitable
to be used as an OCX, or as a connection point sink.
Slightly wierd connection point demo (client and server!) is in demos\connect.py
Slightly weird connection point demo (client and server!) is in demos\connect.py
Note - All old OCX code will be broken. You must regenerate all
.py files, AND CHANGE ALL SUPPORT CODE (sorry!). Specifically, the
name of the class you should sub-class from will have changed - it
Expand Down
2 changes: 1 addition & 1 deletion com/win32com/changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Dec 1, 96
win32com.pythoncom works (and is the "official" way!).
- Connection point support added. makepy will now generate code suitable
to be used as an OCX, or as a connection point sink.
Slightly wierd connection point demo (client and server!) is in demos\connect.py
Slightly weird connection point demo (client and server!) is in demos\connect.py
Note - All old OCX code will be broken. You must regenerate all
.py files, AND CHANGE ALL SUPPORT CODE (sorry!). Specifically, the
name of the class you should sub-class from will have changed - it
Expand Down
2 changes: 1 addition & 1 deletion com/win32com/server/policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ def _getidsofnames_(self, names, lcid):

# IDispatchEx support for policies. Most of the IDispathEx functionality
# by default will raise E_NOTIMPL. Thus it is not necessary for derived
# policies to explicitely implement all this functionality just to not implement it!
# policies to explicitly implement all this functionality just to not implement it!

def _GetDispID_(self, name, fdex):
return self._getdispid_(name, fdex)
Expand Down
Loading

0 comments on commit 2ddbb22

Please sign in to comment.