Skip to content

Commit

Permalink
Make Distribution properly abstract. Ref #419.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Dec 26, 2023
1 parent cb09881 commit 5f84fe8
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions importlib_metadata/__init__.py
Expand Up @@ -334,27 +334,7 @@ def __repr__(self) -> str:
return f'<FileHash mode: {self.mode} value: {self.value}>'


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.
Expand Down

0 comments on commit 5f84fe8

Please sign in to comment.