mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 05:34:18 +08:00
[BE] enable ruff
rule RSE
and remove useless parentheses in raise
statements (#124261)
Remove useless parentheses in `raise` statements if the exception type is raised with no argument. Pull Request resolved: https://github.com/pytorch/pytorch/pull/124261 Approved by: https://github.com/albanD
This commit is contained in:
committed by
PyTorch MergeBot
parent
b726a23d4e
commit
93e249969b
@ -1238,7 +1238,7 @@ $3: f32[] = torch._ops.aten.add.Tensor($1, $2)""")
|
||||
class AMode(TorchDispatchMode):
|
||||
def __torch_dispatch__(self, func, types, args=(), kwargs=None):
|
||||
if func.__name__ == 'randn.default':
|
||||
raise RuntimeError()
|
||||
raise RuntimeError
|
||||
return A(torch.zeros(()))
|
||||
|
||||
with AMode():
|
||||
@ -1254,7 +1254,7 @@ $3: f32[] = torch._ops.aten.add.Tensor($1, $2)""")
|
||||
|
||||
class A(TorchDispatchMode):
|
||||
def __torch_dispatch__(self, func, types, args=(), kwargs=None):
|
||||
raise ErrorA()
|
||||
raise ErrorA
|
||||
|
||||
x = A()
|
||||
with self.assertRaises(ErrorA):
|
||||
|
Reference in New Issue
Block a user