Skip to content

Commit

Permalink
Applied black 22.1.0 to codebase. (#1826)
Browse files Browse the repository at this point in the history
Black is now non-beta with a policy saying formatting changes will only be introduced in major versions (i.e. once per year).
  • Loading branch information
LincolnPuzey authored Feb 16, 2022
1 parent 44afd86 commit 7e56d09
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 24 deletions.
19 changes: 11 additions & 8 deletions adodbapi/adodbapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -711,14 +711,17 @@ def format_description(self, d):
self._makeDescriptionFromRS()
if isinstance(d, int):
d = self.description[d]
desc = "Name= %s, Type= %s, DispSize= %s, IntSize= %s, Precision= %s, Scale= %s NullOK=%s" % (
d[0],
adc.adTypeNames.get(d[1], str(d[1]) + " (unknown type)"),
d[2],
d[3],
d[4],
d[5],
d[6],
desc = (
"Name= %s, Type= %s, DispSize= %s, IntSize= %s, Precision= %s, Scale= %s NullOK=%s"
% (
d[0],
adc.adTypeNames.get(d[1], str(d[1]) + " (unknown type)"),
d[2],
d[3],
d[4],
d[5],
d[6],
)
)
return desc

Expand Down
24 changes: 15 additions & 9 deletions com/win32com/makegw/makegwparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,10 +484,13 @@ def _GetPythonTypeDesc(self):
def GetParsePostCode(self):
# variable was declared with only the builtinIndirection
### NOTE: this is an [in] ... so use only builtin
return '\tif (!PyTime_Check(ob%s)) {\n\t\tPyErr_SetString(PyExc_TypeError, "The argument must be a PyTime object");\n\t\tbPythonIsHappy = FALSE;\n\t}\n\tif (!((PyTime *)ob%s)->GetTime(%s)) bPythonIsHappy = FALSE;\n' % (
self.arg.name,
self.arg.name,
self.GetIndirectedArgName(self.builtinIndirection, 1),
return (
'\tif (!PyTime_Check(ob%s)) {\n\t\tPyErr_SetString(PyExc_TypeError, "The argument must be a PyTime object");\n\t\tbPythonIsHappy = FALSE;\n\t}\n\tif (!((PyTime *)ob%s)->GetTime(%s)) bPythonIsHappy = FALSE;\n'
% (
self.arg.name,
self.arg.name,
self.GetIndirectedArgName(self.builtinIndirection, 1),
)
)

def GetBuildForInterfacePreCode(self):
Expand Down Expand Up @@ -516,11 +519,14 @@ def GetParsePostCode(self):

def GetBuildForInterfacePreCode(self):
notdirected = self.GetIndirectedArgName(None, 1)
return "\tob%s = PyCom_PyObjectFromSTATSTG(%s);\n\t// STATSTG doco says our responsibility to free\n\tif ((%s).pwcsName) CoTaskMemFree((%s).pwcsName);\n" % (
self.arg.name,
self.GetIndirectedArgName(None, 1),
notdirected,
notdirected,
return (
"\tob%s = PyCom_PyObjectFromSTATSTG(%s);\n\t// STATSTG doco says our responsibility to free\n\tif ((%s).pwcsName) CoTaskMemFree((%s).pwcsName);\n"
% (
self.arg.name,
self.GetIndirectedArgName(None, 1),
notdirected,
notdirected,
)
)


Expand Down
2 changes: 1 addition & 1 deletion com/win32com/test/testPyComTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def TestCommon(o, is_generated):
# This number fits in an unsigned long. Attempting to set it to a normal
# long will involve overflow, which is to be expected. But we do
# expect it to work in a property explicitly a VT_UI4.
check = 3 * 10 ** 9
check = 3 * 10**9
o.ULongProp = check
if o.ULongProp != check:
raise error(
Expand Down
11 changes: 7 additions & 4 deletions win32/Lib/win32evtlogutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,13 @@ def SafeFormatMessage(eventLogRecord, logType=None):
desc = ""
else:
desc = ", ".join(eventLogRecord.StringInserts)
return "<The description for Event ID ( %d ) in Source ( %r ) could not be found. It contains the following insertion string(s):%r.>" % (
winerror.HRESULT_CODE(eventLogRecord.EventID),
eventLogRecord.SourceName,
desc,
return (
"<The description for Event ID ( %d ) in Source ( %r ) could not be found. It contains the following insertion string(s):%r.>"
% (
winerror.HRESULT_CODE(eventLogRecord.EventID),
eventLogRecord.SourceName,
desc,
)
)


Expand Down
2 changes: 1 addition & 1 deletion win32/test/test_win32api.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def testValues(self):
("REG_MULTI_SZ_empty", win32con.REG_MULTI_SZ, []),
("REG_DWORD", win32con.REG_DWORD, 666),
("REG_QWORD_INT", win32con.REG_QWORD, 99),
("REG_QWORD", win32con.REG_QWORD, 2 ** 33),
("REG_QWORD", win32con.REG_QWORD, 2**33),
(
"REG_BINARY",
win32con.REG_BINARY,
Expand Down
2 changes: 1 addition & 1 deletion win32/test/test_win32trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def testThreads(self):

class TestHugeChunks(unittest.TestCase):
# BiggestChunk is the size where we stop stressing the writer
BiggestChunk = 2 ** 16 # 256k should do it.
BiggestChunk = 2**16 # 256k should do it.

def setUp(self):
SkipIfCI()
Expand Down

0 comments on commit 7e56d09

Please sign in to comment.