From ec7550a4ece77b6902e299a0c68f2dd4d74d0aa9 Mon Sep 17 00:00:00 2001 From: Zhiyuan Chen Date: Tue, 28 Mar 2023 12:23:33 +0800 Subject: [PATCH] deprecate registry Signed-off-by: Zhiyuan Chen --- danling/registry.py | 5 +++++ danling/tensors/nested_tensor.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/danling/registry.py b/danling/registry.py index 8ca02e1d..2fa87b4d 100644 --- a/danling/registry.py +++ b/danling/registry.py @@ -1,6 +1,7 @@ from copy import deepcopy from functools import wraps from typing import Any, Callable, Mapping, Optional, Union +from warnings import warn from chanfig import NestedDict @@ -52,6 +53,10 @@ class Registry(NestedDict): def __init__(self, override: bool = False): super().__init__() self.setattr("override", override) + warn( + "DanLing Registry has been deprecated in favor of CHANfiG Registry, and will be removed in 0.2.0.", + DeprecationWarning, + ) def register(self, component: Optional[Callable] = None, name: Optional[str] = None) -> Callable: r""" diff --git a/danling/tensors/nested_tensor.py b/danling/tensors/nested_tensor.py index b5e1dc2a..a8bf3a78 100644 --- a/danling/tensors/nested_tensor.py +++ b/danling/tensors/nested_tensor.py @@ -488,7 +488,7 @@ def __torch_function__(cls, func, types, args=(), kwargs=None): def __len__(self) -> int: return len(self.storage) - def __eq__(self, other) -> Union[bool, Tensor, NestedTensor]: + def __eq__(self, other) -> Union[bool, Tensor, NestedTensor]: # type: ignore[override] if isinstance(other, NestedTensor): return self.storage == other.storage if isinstance(other, Tensor):