Skip to content

Commit 51dc58b

Browse files
Apply ruff/tryceratops rule TRY301
TRY301 Abstract `raise` to an inner function
1 parent bb5f936 commit 51dc58b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

distutils/command/install_lib.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ def finalize_options(self):
8181
if not isinstance(self.optimize, int):
8282
try:
8383
self.optimize = int(self.optimize)
84-
if self.optimize not in (0, 1, 2):
85-
raise AssertionError
86-
except (ValueError, AssertionError):
84+
except ValueError:
85+
pass
86+
if self.optimize not in (0, 1, 2):
8787
raise DistutilsOptionError("optimize must be 0, 1, or 2")
8888

8989
def run(self):

distutils/msvc9compiler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def load_macros(self, version):
154154
if version >= 8.0:
155155
self.set_macro("FrameworkSDKDir", NET_BASE, "sdkinstallrootv2.0")
156156
else:
157-
raise KeyError("sdkinstallrootv2.0")
157+
raise KeyError("sdkinstallrootv2.0") # noqa: TRY301
158158
except KeyError:
159159
raise DistutilsPlatformError(
160160
"""Python was built with Visual Studio 2008;

0 commit comments

Comments
 (0)