[BE][PYFMT] migrate PYFMT for test/[a-h]*/ to ruff format (#144555)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/144555
Approved by: https://github.com/ezyang
ghstack dependencies: #144551, #144554
This commit is contained in:
Xuehai Pan
2025-06-24 00:18:25 +00:00
committed by PyTorch MergeBot
parent e600e044a7
commit 6d5c789ad5
84 changed files with 585 additions and 520 deletions

View File

@ -78,9 +78,9 @@ def _kernel_fallback(op, *args, **kwargs):
elif op._schema.is_mutable or op is torch.ops.aten._copy_from.default:
# Only handle inplace ops returning their first arg
assert len(args) >= 1, f"Inplace {op} needs at least one arg"
assert (
len(op._schema.returns) == 1
), f"NYI Inplace {op} with more than one return"
assert len(op._schema.returns) == 1, (
f"NYI Inplace {op} with more than one return"
)
op_name = op.overloadpacket._qualified_op_name
real_res = args[0]
elif any(r.alias_info is not None for r in op._schema.returns):

View File

@ -67,7 +67,7 @@ def prepare_for_sending(args, kwargs):
def convert(obj):
if type(obj) not in VALID_QUEUE_TYPES_IN:
raise RuntimeError(
f"Cannot send object of type {type(obj)} " "over openreg device pipe."
f"Cannot send object of type {type(obj)} over openreg device pipe."
)
if isinstance(obj, torch.Tensor):
@ -82,8 +82,7 @@ def receive_after_sending(allocator, args, kwargs):
def convert(obj):
if type(obj) not in VALID_QUEUE_TYPES_OUT:
raise RuntimeError(
f"Received invalid object of type {type(obj)} "
"over openreg device pipe."
f"Received invalid object of type {type(obj)} over openreg device pipe."
)
if isinstance(obj, OpenRegTensorMeta):