From e448f32944d43b532fef3d16379ab44b51a71049 Mon Sep 17 00:00:00 2001 From: PyTorch MergeBot Date: Sun, 28 Jul 2024 03:29:31 +0000 Subject: [PATCH] Revert "[BE] typing for decorators - signal/windows/windows (#131582)" This reverts commit 8689d377f9b60b70efa6608e654a3889f947f4d8. Reverted https://github.com/pytorch/pytorch/pull/131582 on behalf of https://github.com/clee2000 due to breaking lint internally D60265575 ([comment](https://github.com/pytorch/pytorch/pull/131572#issuecomment-2254328359)) --- torch/signal/windows/windows.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/torch/signal/windows/windows.py b/torch/signal/windows/windows.py index 1028e53c0e2..51784b11194 100644 --- a/torch/signal/windows/windows.py +++ b/torch/signal/windows/windows.py @@ -1,5 +1,6 @@ +# mypy: allow-untyped-decorators # mypy: allow-untyped-defs -from typing import Optional, Iterable, TypeVar, Callable +from typing import Optional, Iterable import torch from math import sqrt @@ -21,8 +22,6 @@ __all__ = [ 'nuttall', ] -_T = TypeVar("_T") - window_common_args = merge_dicts( parse_kwargs( """ @@ -40,7 +39,7 @@ window_common_args = merge_dicts( ) -def _add_docstr(*args: str) -> Callable[[_T], _T]: +def _add_docstr(*args): r"""Adds docstrings to a given decorated function. Specially useful when then docstrings needs string interpolation, e.g., with @@ -52,7 +51,7 @@ def _add_docstr(*args: str) -> Callable[[_T], _T]: args (str): """ - def decorator(o: _T) -> _T: + def decorator(o): o.__doc__ = "".join(args) return o