mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[BE]: Enable RUF013 ban implicit optional (#141706)
Enables RUF013 rule to ban implicit Optional (from areas not already checked by mypy). Pull Request resolved: https://github.com/pytorch/pytorch/pull/141706 Approved by: https://github.com/ezyang
This commit is contained in:
committed by
PyTorch MergeBot
parent
b33f770574
commit
9f48881ba8
@ -308,7 +308,7 @@ def write_decl_impl(
|
||||
family_name: str,
|
||||
impl_file: str,
|
||||
autogen_dir: Path,
|
||||
disable_def: str = None,
|
||||
disable_def: Optional[str] = None,
|
||||
) -> None:
|
||||
cpp_file_header = """/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
|
@ -141,6 +141,7 @@ select = [
|
||||
"Q004", # unnecessary escaped quote
|
||||
"RSE",
|
||||
"RUF008", # mutable dataclass default
|
||||
"RUF013", # ban implicit optional
|
||||
"RUF015", # access first ele in constant time
|
||||
"RUF016", # type error non-integer index
|
||||
"RUF017",
|
||||
|
@ -215,7 +215,8 @@ class TracerBase:
|
||||
kwargs: Dict[str, Any],
|
||||
name: Optional[str] = None,
|
||||
type_expr: Optional[Any] = None,
|
||||
proxy_factory_fn: Callable[[Node], "Proxy"] = None,
|
||||
# fix noqa when updating bc tests
|
||||
proxy_factory_fn: Callable[[Node], "Proxy"] = None, # noqa: RUF013
|
||||
):
|
||||
"""
|
||||
Create a Node from the given arguments, then return the Node
|
||||
|
@ -1846,7 +1846,7 @@ def skipCUDAIfNotMiopenSuggestNHWC(fn):
|
||||
|
||||
|
||||
# Skips a test for specified CUDA versions, given in the form of a list of [major, minor]s.
|
||||
def skipCUDAVersionIn(versions: List[Tuple[int, int]] = None):
|
||||
def skipCUDAVersionIn(versions: Optional[List[Tuple[int, int]]] = None):
|
||||
def dec_fn(fn):
|
||||
@wraps(fn)
|
||||
def wrap_fn(self, *args, **kwargs):
|
||||
@ -1864,7 +1864,7 @@ def skipCUDAVersionIn(versions: List[Tuple[int, int]] = None):
|
||||
|
||||
|
||||
# Skips a test for CUDA versions less than specified, given in the form of [major, minor].
|
||||
def skipCUDAIfVersionLessThan(versions: Tuple[int, int] = None):
|
||||
def skipCUDAIfVersionLessThan(versions: Optional[Tuple[int, int]] = None):
|
||||
def dec_fn(fn):
|
||||
@wraps(fn)
|
||||
def wrap_fn(self, *args, **kwargs):
|
||||
|
Reference in New Issue
Block a user