From 5f84fe8a3cf7d5fef740556b87b3079bacba79c6 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Tue, 26 Dec 2023 10:27:04 -0500 Subject: [PATCH] Make Distribution properly abstract. Ref #419. --- importlib_metadata/__init__.py | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/importlib_metadata/__init__.py b/importlib_metadata/__init__.py index 0ce535a1..d58d7cbb 100644 --- a/importlib_metadata/__init__.py +++ b/importlib_metadata/__init__.py @@ -334,27 +334,7 @@ def __repr__(self) -> str: return f'' -class DeprecatedNonAbstract: - # Required until Python 3.14 - def __new__(cls, *args, **kwargs): - all_names = { - name for subclass in inspect.getmro(cls) for name in vars(subclass) - } - abstract = { - name - for name in all_names - if getattr(getattr(cls, name), '__isabstractmethod__', False) - } - if abstract: - warnings.warn( - f"Unimplemented abstract methods {abstract}", - DeprecationWarning, - stacklevel=2, - ) - return super().__new__(cls) - - -class Distribution(DeprecatedNonAbstract): +class Distribution(metaclass=abc.ABCMeta): """ An abstract Python distribution package.