Skip to content

Commit

Permalink
Run ruff format
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam committed Oct 18, 2024
1 parent b9256ff commit b74bfdc
Show file tree
Hide file tree
Showing 47 changed files with 202 additions and 268 deletions.
28 changes: 7 additions & 21 deletions AutoDuck/Dump2HHC.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,7 @@ def _genItemsFromDict(dict, cat, output, target, do_children=1):
<param name="ImageNumber" value="1">
<param name="Local" value="{CHM}{context}">
</OBJECT>
""".format(
**locals()
)
""".format(**locals())
)
if not do_children:
continue
Expand Down Expand Up @@ -339,9 +337,7 @@ def genTOC(cats, output, title, target):
<param name="Local" value="{CHM}{target}.html">
</OBJECT>
<UL>
""".format(
**locals()
)
""".format(**locals())
)

for cat in cats:
Expand All @@ -355,9 +351,7 @@ def genTOC(cats, output, title, target):
<param name="Local" value="{CHM}{cat_id}.html">
</OBJECT>
<UL>
""".format(
**locals()
)
""".format(**locals())
)
# Next write the overviews for this category
output.write(
Expand All @@ -368,9 +362,7 @@ def genTOC(cats, output, title, target):
<param name="Local" value="{CHM}{cat_id}_overview.html">
</OBJECT>
<UL>
""".format(
**locals()
)
""".format(**locals())
)
_genItemsFromDict(cat.overviewTopics, cat, output, target)
_genItemsFromDict(cat.extOverviewTopics, cat, output, target)
Expand All @@ -387,9 +379,7 @@ def genTOC(cats, output, title, target):
<param name="Local" value="{CHM}{cat_id}_modules.html">
</OBJECT>
<UL>
""".format(
**locals()
)
""".format(**locals())
)
_genItemsFromDict(cat.modules, cat, output, target)
output.write(
Expand All @@ -404,9 +394,7 @@ def genTOC(cats, output, title, target):
<param name="ImageNumber" value="1">
<param name="Local" value="{CHM}{cat_id}_objects.html">
</OBJECT>
<UL>""".format(
**locals()
)
<UL>""".format(**locals())
)
# Don't show 'children' for objects - params etc don't need their own child nodes!
_genItemsFromDict(cat.objects, cat, output, target, do_children=0)
Expand All @@ -423,9 +411,7 @@ def genTOC(cats, output, title, target):
<param name="Local" value="{CHM}{cat_id}_constants.html">
</OBJECT>
<UL>
""".format(
**locals()
)
""".format(**locals())
)
_genItemsFromDict(cat.constants, cat, output, target)
output.write(
Expand Down
19 changes: 11 additions & 8 deletions Pythonwin/pywin/dialogs/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,17 @@ def OnListClick(self, id, code):
return 1

def OnListItemChange(self, std, extra):
(hwndFrom, idFrom, code), (
itemNotify,
sub,
newState,
oldState,
change,
point,
lparam,
(
(hwndFrom, idFrom, code),
(
itemNotify,
sub,
newState,
oldState,
change,
point,
lparam,
),
) = (std, extra)
oldSel = (oldState & commctrl.LVIS_SELECTED) != 0
newSel = (newState & commctrl.LVIS_SELECTED) != 0
Expand Down
3 changes: 2 additions & 1 deletion Pythonwin/pywin/framework/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# The application is responsible for managing the main frame window.
#
# We also grab the FileOpen command, to invoke our Python editor
" The PythonWin application code. Manages most aspects of MDI, etc "
"The PythonWin application code. Manages most aspects of MDI, etc"

from __future__ import annotations

import os
Expand Down
4 changes: 1 addition & 3 deletions Pythonwin/pywin/framework/scriptutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@
debugging_options = """No debugging
Step-through in the debugger
Run in the debugger
Post-Mortem of unhandled exceptions""".split(
"\n"
)
Post-Mortem of unhandled exceptions""".split("\n")

byte_cr = b"\r"
byte_lf = b"\n"
Expand Down
1 change: 1 addition & 0 deletions Pythonwin/pywin/framework/stdin.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import sys
sys.stdin = sys.stdin.real_file
"""

import sys

get_input_line = input
Expand Down
3 changes: 1 addition & 2 deletions Pythonwin/pywin/mfc/activex.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Support for ActiveX control hosting in Pythonwin.
"""
"""Support for ActiveX control hosting in Pythonwin."""

import win32ui
import win32uiole
Expand Down
2 changes: 1 addition & 1 deletion adodbapi/examples/db_print.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" db_print.py -- a simple demo for ADO database reads."""
"""db_print.py -- a simple demo for ADO database reads."""

import sys

Expand Down
2 changes: 1 addition & 1 deletion adodbapi/examples/db_table_names.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" db_table_names.py -- a simple demo for ADO database table listing."""
"""db_table_names.py -- a simple demo for ADO database table listing."""

import sys

Expand Down
2 changes: 1 addition & 1 deletion adodbapi/process_connect_string.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" a clumsy attempt at a macro language to let the programmer execute code on the server (ex: determine 64bit)"""
"""a clumsy attempt at a macro language to let the programmer execute code on the server (ex: determine 64bit)"""

from . import is64bit

Expand Down
33 changes: 17 additions & 16 deletions adodbapi/test/adodbapitest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Unit tests version 2.6.1.0 for adodbapi"""
"""Unit tests version 2.6.1.0 for adodbapi"""

"""
adodbapi - A python DB API 2.0 interface to Microsoft ADO
Expand Down Expand Up @@ -325,15 +325,16 @@ def helpTestDataType(
rs = crsr.fetchone()
if allowedReturnValues:
allowedTypes = tuple([type(aRV) for aRV in allowedReturnValues])
assert isinstance(
rs[0], allowedTypes
), 'result type "%s" must be one of %s' % (type(rs[0]), allowedTypes)
assert isinstance(rs[0], allowedTypes), (
'result type "%s" must be one of %s' % (type(rs[0]), allowedTypes)
)
else:
assert isinstance(
rs[0], type(pyData)
), 'result type "%s" must be instance of %s' % (
type(rs[0]),
type(pyData),
assert isinstance(rs[0], type(pyData)), (
'result type "%s" must be instance of %s'
% (
type(rs[0]),
type(pyData),
)
)

if compareAlmostEqual and DBAPIDataTypeString == "DATETIME":
Expand All @@ -343,9 +344,9 @@ def helpTestDataType(
elif compareAlmostEqual:
s = float(pyData)
v = float(rs[0])
assert (
abs(v - s) / s < 0.00001
), "Values not almost equal recvd=%s, expected=%f" % (rs[0], s)
assert abs(v - s) / s < 0.00001, (
"Values not almost equal recvd=%s, expected=%f" % (rs[0], s)
)
else:
if allowedReturnValues:
ok = False
Expand Down Expand Up @@ -487,7 +488,7 @@ def testDataTypeDate(self):
)

def testDataTypeBinary(self):
binfld = b"\x07\x00\xE2\x40*"
binfld = b"\x07\x00\xe2\x40*"
arv = [binfld, adodbapi.Binary(binfld), bytes(binfld)]
if self.getEngine() == "PostgreSQL":
self.helpTestDataType(
Expand Down Expand Up @@ -692,9 +693,9 @@ def testRowIterator(self):
rec = crsr.fetchone()
# check that stepping through an emulated row works
for j in range(len(inParam)):
assert (
rec[j] == inParam[j]
), 'returned value:"%s" != test value:"%s"' % (rec[j], inParam[j])
assert rec[j] == inParam[j], (
'returned value:"%s" != test value:"%s"' % (rec[j], inParam[j])
)
# check that we can get a complete tuple from a row
assert (
tuple(rec) == inParam
Expand Down
14 changes: 7 additions & 7 deletions adodbapi/test/dbapi20.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/usr/bin/env python
""" Python DB API 2.0 driver compliance unit test suite.
"""Python DB API 2.0 driver compliance unit test suite.
This software is Public Domain and may be used without restrictions.
This software is Public Domain and may be used without restrictions.
"Now we have booze and barflies entering the discussion, plus rumours of
DBAs on drugs... and I won't tell you what flashes through my mind each
time I read the subject line with 'Anal Compliance' in it. All around
this is turning out to be a thoroughly unwholesome unit test."
"Now we have booze and barflies entering the discussion, plus rumours of
DBAs on drugs... and I won't tell you what flashes through my mind each
time I read the subject line with 'Anal Compliance' in it. All around
this is turning out to be a thoroughly unwholesome unit test."
-- Ian Bicking
-- Ian Bicking
"""

__version__ = "$Revision: 1.15.0 $"[11:-2]
Expand Down
1 change: 1 addition & 0 deletions adodbapi/test/setuptestframework.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/python2
# Configure this in order to run the testcases.
"setuptestframework.py v 2.6.0.8"

import os
import shutil
import tempfile
Expand Down
27 changes: 13 additions & 14 deletions com/win32com/client/combrowse.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
"""A utility for browsing COM objects.
Usage:
Usage:
Command Prompt
Command Prompt
Use the command *"python.exe combrowse.py"*. This will display
display a fairly small, modal dialog.
Use the command *"python.exe combrowse.py"*. This will display
display a fairly small, modal dialog.
Pythonwin
Pythonwin
Use the "Run Script" menu item, and this will create the browser in an
MDI window. This window can be fully resized.
Use the "Run Script" menu item, and this will create the browser in an
MDI window. This window can be fully resized.
Details
Details
This module allows browsing of registered Type Libraries, COM categories,
and running COM objects. The display is similar to the Pythonwin object
browser, and displays the objects in a hierarchical window.
This module allows browsing of registered Type Libraries, COM categories,
and running COM objects. The display is similar to the Pythonwin object
browser, and displays the objects in a hierarchical window.
Note that this module requires the win32ui (ie, Pythonwin) distribution to
work.
Note that this module requires the win32ui (ie, Pythonwin) distribution to
work.
"""

Expand Down Expand Up @@ -581,7 +581,6 @@ def GetSubList(self):


def main(modal=True, mdi=False):

root = HLIRoot("COM Browser")
if mdi and "pywin.framework.app" in sys.modules:
# do it in a MDI window
Expand Down
7 changes: 4 additions & 3 deletions com/win32com/client/dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,9 +389,10 @@ def _get_good_object_(self, ob, userName=None, ReturnCLSID=None):
elif isinstance(ob, tuple):
return tuple(
map(
lambda o, s=self, oun=userName, rc=ReturnCLSID: s._get_good_single_object_(
o, oun, rc
),
lambda o,
s=self,
oun=userName,
rc=ReturnCLSID: s._get_good_single_object_(o, oun, rc),
ob,
)
)
Expand Down
4 changes: 1 addition & 3 deletions com/win32com/client/genpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -969,9 +969,7 @@ def _Build_Interface(self, type_info_tuple):
return oleItem, vtableItem

def BuildOleItemsFromType(self):
assert (
self.bBuildHidden
), "This code doesn't look at the hidden flag - I thought everyone set it true!?!?!"
assert self.bBuildHidden, "This code doesn't look at the hidden flag - I thought everyone set it true!?!?!"
oleItems = {}
enumItems = {}
recordItems = {}
Expand Down
7 changes: 4 additions & 3 deletions com/win32com/client/makepy.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@
"""Generate a .py file from an OLE TypeLibrary file.
This module is concerned only with the actual writing of
a .py file. It draws on the @build@ module, which builds
the knowledge of a COM interface.
This module is concerned only with the actual writing of
a .py file. It draws on the @build@ module, which builds
the knowledge of a COM interface.
"""

usageHelp = """ \
Usage:
Expand Down
3 changes: 1 addition & 2 deletions com/win32com/client/selecttlb.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Utilities for selecting and enumerating the Type Libraries installed on the system
"""
"""Utilities for selecting and enumerating the Type Libraries installed on the system"""

import pythoncom
import win32api
Expand Down
Loading

0 comments on commit b74bfdc

Please sign in to comment.