Convert formatting to use ruff instead of yapf + isort (#26247)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
This commit is contained in:
+14
-24
@@ -52,40 +52,35 @@ def json_iter_leaves(value: JSONTree[_T]) -> Iterable[_T]:
|
||||
def json_map_leaves(
|
||||
func: Callable[["torch.Tensor"], "torch.Tensor"],
|
||||
value: "BatchedTensorInputs",
|
||||
) -> "BatchedTensorInputs":
|
||||
...
|
||||
) -> "BatchedTensorInputs": ...
|
||||
|
||||
|
||||
@overload
|
||||
def json_map_leaves(
|
||||
func: Callable[[_T], _U],
|
||||
value: Union[_T, dict[str, _T]],
|
||||
) -> Union[_U, dict[str, _U]]:
|
||||
...
|
||||
) -> Union[_U, dict[str, _U]]: ...
|
||||
|
||||
|
||||
@overload
|
||||
def json_map_leaves(
|
||||
func: Callable[[_T], _U],
|
||||
value: Union[_T, list[_T]],
|
||||
) -> Union[_U, list[_U]]:
|
||||
...
|
||||
) -> Union[_U, list[_U]]: ...
|
||||
|
||||
|
||||
@overload
|
||||
def json_map_leaves(
|
||||
func: Callable[[_T], _U],
|
||||
value: Union[_T, tuple[_T, ...]],
|
||||
) -> Union[_U, tuple[_U, ...]]:
|
||||
...
|
||||
) -> Union[_U, tuple[_U, ...]]: ...
|
||||
|
||||
|
||||
@overload
|
||||
def json_map_leaves(
|
||||
func: Callable[[_T], _U],
|
||||
value: JSONTree[_T],
|
||||
) -> JSONTree[_U]:
|
||||
...
|
||||
) -> JSONTree[_U]: ...
|
||||
|
||||
|
||||
def json_map_leaves(
|
||||
@@ -111,8 +106,7 @@ def json_reduce_leaves(
|
||||
func: Callable[[_T, _T], _T],
|
||||
value: Union[_T, dict[str, _T]],
|
||||
/,
|
||||
) -> _T:
|
||||
...
|
||||
) -> _T: ...
|
||||
|
||||
|
||||
@overload
|
||||
@@ -120,8 +114,7 @@ def json_reduce_leaves(
|
||||
func: Callable[[_T, _T], _T],
|
||||
value: Union[_T, list[_T]],
|
||||
/,
|
||||
) -> _T:
|
||||
...
|
||||
) -> _T: ...
|
||||
|
||||
|
||||
@overload
|
||||
@@ -129,8 +122,7 @@ def json_reduce_leaves(
|
||||
func: Callable[[_T, _T], _T],
|
||||
value: Union[_T, tuple[_T, ...]],
|
||||
/,
|
||||
) -> _T:
|
||||
...
|
||||
) -> _T: ...
|
||||
|
||||
|
||||
@overload
|
||||
@@ -138,8 +130,7 @@ def json_reduce_leaves(
|
||||
func: Callable[[_T, _T], _T],
|
||||
value: JSONTree[_T],
|
||||
/,
|
||||
) -> _T:
|
||||
...
|
||||
) -> _T: ...
|
||||
|
||||
|
||||
@overload
|
||||
@@ -148,15 +139,14 @@ def json_reduce_leaves(
|
||||
value: JSONTree[_T],
|
||||
initial: _U,
|
||||
/,
|
||||
) -> _U:
|
||||
...
|
||||
) -> _U: ...
|
||||
|
||||
|
||||
def json_reduce_leaves(
|
||||
func: Callable[..., Union[_T, _U]],
|
||||
value: _JSONTree[_T],
|
||||
initial: _U = cast(_U, ...), # noqa: B008
|
||||
/,
|
||||
func: Callable[..., Union[_T, _U]],
|
||||
value: _JSONTree[_T],
|
||||
initial: _U = cast(_U, ...), # noqa: B008
|
||||
/,
|
||||
) -> Union[_T, _U]:
|
||||
"""
|
||||
Apply a function of two arguments cumulatively to each leaf in a
|
||||
|
||||
Reference in New Issue
Block a user