mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[BE]: Enable ruff rule PIE800 - unnecessary nested dict expansion (#113880)
Adds an additional list which removes unnecessary dict literal unpacking, also applies the fixes. Pull Request resolved: https://github.com/pytorch/pytorch/pull/113880 Approved by: https://github.com/albanD
This commit is contained in:
committed by
PyTorch MergeBot
parent
bdf0b196db
commit
d9f2cf9974
@ -222,13 +222,11 @@ def map_to_dtype(e, dtype):
|
||||
def deserialize_args(inps):
|
||||
inps = inps.strip().strip("'")
|
||||
global_vals = {
|
||||
**{
|
||||
"T": deserialize_tensor,
|
||||
"ST": deserialize_sparse_tensor,
|
||||
"th": torch,
|
||||
"inf": math.inf,
|
||||
"torch": torch,
|
||||
},
|
||||
**dtype_abbrs_parsing,
|
||||
}
|
||||
# f strings introduce quotations we dont want
|
||||
|
@ -78,6 +78,7 @@ select = [
|
||||
"PERF",
|
||||
"PGH004",
|
||||
"PIE794",
|
||||
"PIE800",
|
||||
"PIE807",
|
||||
"PIE810",
|
||||
"PLE",
|
||||
|
@ -59,7 +59,7 @@ class _PartialWrapper:
|
||||
# skip if arg_name in keywords so its possible to overwrite
|
||||
for arg_name in self.callable_args:
|
||||
if arg_name not in keywords:
|
||||
keywords = {**keywords, **{arg_name: self.callable_args[arg_name]()}}
|
||||
keywords = {**keywords, arg_name: self.callable_args[arg_name]()}
|
||||
return self.p(*args, **keywords)
|
||||
|
||||
def __repr__(self):
|
||||
|
@ -433,7 +433,7 @@ def enable_wrap(
|
||||
instances inside the context
|
||||
"""
|
||||
kwargs = {
|
||||
**{"wrapper_cls": wrapper_cls},
|
||||
"wrapper_cls": wrapper_cls,
|
||||
**wrapper_kwargs,
|
||||
}
|
||||
with _ConfigAutoWrap(**kwargs):
|
||||
|
Reference in New Issue
Block a user