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

Remove extraneous parentheses found by Ruff/pyupgrade #2110

Merged
merged 1 commit into from
Sep 21, 2023
Merged
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
2 changes: 1 addition & 1 deletion Pythonwin/pywin/framework/stdin.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def fake_input(prompt=None):
result = test_input[:end_of_line_pos]
test_input = test_input[end_of_line_pos + 1 :]
if len(result) == 0 or result[0] == "~":
raise EOFError()
raise EOFError
return result

get_input_line = fake_input
Expand Down
4 changes: 2 additions & 2 deletions Pythonwin/pywin/scintilla/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def __init__(self, scintilla):
self.SetStyles()

def HookFormatter(self, parent=None):
raise NotImplementedError()
raise NotImplementedError

# Used by the IDLE extensions to quickly determine if a character is a string.
def GetStringStyle(self, pos):
Expand All @@ -114,7 +114,7 @@ def RegisterStyle(self, style, stylenum):
self.styles_by_id[stylenum] = style

def SetStyles(self):
raise NotImplementedError()
raise NotImplementedError

def GetSampleText(self):
return "Sample Text for the Format Dialog"
Expand Down
2 changes: 1 addition & 1 deletion com/win32com/olectl.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


def MAKE_SCODE(sev, fac, code):
return int((int(-sev) << 31) | ((fac) << 16) | ((code)))
return int((int(-sev) << 31) | ((fac) << 16) | (code))


def STD_CTL_SCODE(n):
Expand Down
2 changes: 1 addition & 1 deletion com/win32com/test/testConversionErrors.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class TestException(Exception):
# The object we try and pass - pywin32 will call __float__ as a last resort.
class BadConversions:
def __float__(self):
raise TestException()
raise TestException


class TestCase(win32com.test.util.TestCase):
Expand Down
36 changes: 18 additions & 18 deletions com/win32comext/adsi/adsicon.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,27 +226,27 @@ def _HRESULT_TYPEDEF_(_sc):
return _sc


E_ADS_BAD_PATHNAME = _HRESULT_TYPEDEF_((-2147463168))
E_ADS_INVALID_DOMAIN_OBJECT = _HRESULT_TYPEDEF_((-2147463167))
E_ADS_INVALID_USER_OBJECT = _HRESULT_TYPEDEF_((-2147463166))
E_ADS_INVALID_COMPUTER_OBJECT = _HRESULT_TYPEDEF_((-2147463165))
E_ADS_UNKNOWN_OBJECT = _HRESULT_TYPEDEF_((-2147463164))
E_ADS_PROPERTY_NOT_SET = _HRESULT_TYPEDEF_((-2147463163))
E_ADS_PROPERTY_NOT_SUPPORTED = _HRESULT_TYPEDEF_((-2147463162))
E_ADS_PROPERTY_INVALID = _HRESULT_TYPEDEF_((-2147463161))
E_ADS_BAD_PARAMETER = _HRESULT_TYPEDEF_((-2147463160))
E_ADS_OBJECT_UNBOUND = _HRESULT_TYPEDEF_((-2147463159))
E_ADS_PROPERTY_NOT_MODIFIED = _HRESULT_TYPEDEF_((-2147463158))
E_ADS_PROPERTY_MODIFIED = _HRESULT_TYPEDEF_((-2147463157))
E_ADS_CANT_CONVERT_DATATYPE = _HRESULT_TYPEDEF_((-2147463156))
E_ADS_PROPERTY_NOT_FOUND = _HRESULT_TYPEDEF_((-2147463155))
E_ADS_OBJECT_EXISTS = _HRESULT_TYPEDEF_((-2147463154))
E_ADS_SCHEMA_VIOLATION = _HRESULT_TYPEDEF_((-2147463153))
E_ADS_COLUMN_NOT_SET = _HRESULT_TYPEDEF_((-2147463152))
E_ADS_BAD_PATHNAME = _HRESULT_TYPEDEF_(-2147463168)
E_ADS_INVALID_DOMAIN_OBJECT = _HRESULT_TYPEDEF_(-2147463167)
E_ADS_INVALID_USER_OBJECT = _HRESULT_TYPEDEF_(-2147463166)
E_ADS_INVALID_COMPUTER_OBJECT = _HRESULT_TYPEDEF_(-2147463165)
E_ADS_UNKNOWN_OBJECT = _HRESULT_TYPEDEF_(-2147463164)
E_ADS_PROPERTY_NOT_SET = _HRESULT_TYPEDEF_(-2147463163)
E_ADS_PROPERTY_NOT_SUPPORTED = _HRESULT_TYPEDEF_(-2147463162)
E_ADS_PROPERTY_INVALID = _HRESULT_TYPEDEF_(-2147463161)
E_ADS_BAD_PARAMETER = _HRESULT_TYPEDEF_(-2147463160)
E_ADS_OBJECT_UNBOUND = _HRESULT_TYPEDEF_(-2147463159)
E_ADS_PROPERTY_NOT_MODIFIED = _HRESULT_TYPEDEF_(-2147463158)
E_ADS_PROPERTY_MODIFIED = _HRESULT_TYPEDEF_(-2147463157)
E_ADS_CANT_CONVERT_DATATYPE = _HRESULT_TYPEDEF_(-2147463156)
E_ADS_PROPERTY_NOT_FOUND = _HRESULT_TYPEDEF_(-2147463155)
E_ADS_OBJECT_EXISTS = _HRESULT_TYPEDEF_(-2147463154)
E_ADS_SCHEMA_VIOLATION = _HRESULT_TYPEDEF_(-2147463153)
E_ADS_COLUMN_NOT_SET = _HRESULT_TYPEDEF_(-2147463152)
S_ADS_ERRORSOCCURRED = _HRESULT_TYPEDEF_(0x00005011)
S_ADS_NOMORE_ROWS = _HRESULT_TYPEDEF_(0x00005012)
S_ADS_NOMORE_COLUMNS = _HRESULT_TYPEDEF_(0x00005013)
E_ADS_INVALID_FILTER = _HRESULT_TYPEDEF_((-2147463148))
E_ADS_INVALID_FILTER = _HRESULT_TYPEDEF_(-2147463148)

# ADS_DEREFENUM enum
ADS_DEREF_NEVER = 0
Expand Down
2 changes: 1 addition & 1 deletion win32/Lib/winnt.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def LANGIDFROMLCID(lcid):


def SORTIDFROMLCID(lcid):
return (((lcid)) & NLS_VALID_LOCALE_MASK) >> 16
return ((lcid) & NLS_VALID_LOCALE_MASK) >> 16


MAXIMUM_WAIT_OBJECTS = 64
Expand Down
4 changes: 2 additions & 2 deletions win32/test/test_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def testAttributes(self):
# some tests for 'insane' args.
def testStrangeArgsNone(self):
try:
raise pywintypes.error()
raise pywintypes.error
self.fail("Expected exception")
except pywintypes.error as exc:
self.assertEqual(exc.args, ())
Expand Down Expand Up @@ -176,7 +176,7 @@ def testAttributes(self):

def testStrangeArgsNone(self):
try:
raise pywintypes.com_error()
raise pywintypes.com_error
self.fail("Expected exception")
except pywintypes.com_error as exc:
self.assertEqual(exc.args, ())
Expand Down