diff --git a/numcodecs/abc.py b/numcodecs/abc.py index 5aba8c25..a57c13e2 100644 --- a/numcodecs/abc.py +++ b/numcodecs/abc.py @@ -29,14 +29,13 @@ """ from abc import ABC, abstractmethod -from typing import Optional +from typing import ClassVar class Codec(ABC): """Codec abstract base class.""" - # override in sub-class - codec_id: Optional[str] = None + codec_id: ClassVar[str] """Codec identifier.""" @abstractmethod diff --git a/numcodecs/tests/test_registry.py b/numcodecs/tests/test_registry.py index 93ed8f03..131b8773 100644 --- a/numcodecs/tests/test_registry.py +++ b/numcodecs/tests/test_registry.py @@ -34,8 +34,8 @@ def test_all_classes_registered(): if ( inspect.isclass(obj) and issubclass(obj, numcodecs.abc.Codec) + and hasattr(obj, 'codec_id') and obj.codec_id not in numcodecs.registry.codec_registry - and obj.codec_id is not None # remove `None` ) }