diff --git a/optree/integration/jax.py b/optree/integration/jax.py index 01a5bccc..aa70c1dd 100644 --- a/optree/integration/jax.py +++ b/optree/integration/jax.py @@ -160,7 +160,7 @@ def tree_ravel( A pair ``(array, unravel_func)`` where the first element is a 1D array representing the flattened and concatenated leaf values, with ``dtype`` determined by promoting the ``dtype``\s of leaf values, and the second element is a callable for unflattening a 1D array - of the same length back to a pytree of of the same structure as the input ``tree``. If the + of the same length back to a pytree of the same structure as the input ``tree``. If the input pytree is empty (i.e. has no leaves) then as a convention a 1D empty array of the default dtype is returned in the first component of the output. """ diff --git a/optree/integration/numpy.py b/optree/integration/numpy.py index fcdc3ef9..50099eee 100644 --- a/optree/integration/numpy.py +++ b/optree/integration/numpy.py @@ -89,7 +89,7 @@ def tree_ravel( A pair ``(array, unravel_func)`` where the first element is a 1D array representing the flattened and concatenated leaf values, with ``dtype`` determined by promoting the ``dtype``\s of leaf values, and the second element is a callable for unflattening a 1D array - of the same length back to a pytree of of the same structure as the input ``tree``. If the + of the same length back to a pytree of the same structure as the input ``tree``. If the input pytree is empty (i.e. has no leaves) then as a convention a 1D empty array of the default dtype is returned in the first component of the output. """ diff --git a/optree/integration/torch.py b/optree/integration/torch.py index 9ff9f899..023d8e0a 100644 --- a/optree/integration/torch.py +++ b/optree/integration/torch.py @@ -86,7 +86,7 @@ def tree_ravel( A pair ``(tensor, unravel_func)`` where the first element is a 1D tensor representing the flattened and concatenated leaf values, with ``dtype`` determined by promoting the ``dtype``\s of leaf values, and the second element is a callable for unflattening a 1D tensor - of the same length back to a pytree of of the same structure as the input ``tree``. If the + of the same length back to a pytree of the same structure as the input ``tree``. If the input pytree is empty (i.e. has no leaves) then as a convention a 1D empty tensor of the default dtype is returned in the first component of the output. """ diff --git a/optree/utils.py b/optree/utils.py index f6d4a8f9..10e8ad80 100644 --- a/optree/utils.py +++ b/optree/utils.py @@ -43,14 +43,12 @@ def total_order_sorted( if key is None: def key_fn(x: T) -> tuple[str, Any]: - # pylint: disable-next=consider-using-f-string return (f'{x.__class__.__module__}.{x.__class__.__qualname__}', x) else: def key_fn(x: T) -> tuple[str, Any]: y = key(x) - # pylint: disable-next=consider-using-f-string return (f'{y.__class__.__module__}.{y.__class__.__qualname__}', y) try: