diff --git a/pyproject.toml b/pyproject.toml index 6e964ed..4087e53 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,6 +38,7 @@ test = [ 'coverage ~= 7.6.0; python_version >= "3.11"', 'coverage[toml] ~= 7.6.0; python_version <= "3.10"', "mypy ~= 1.10.1", + "overrides ~= 7.7.0", "pylint ~= 3.2.5", 'pyright==1.1.372; platform_system == "Linux"', "pytest ~= 8.2.2", diff --git a/startrepo/common.py b/startrepo/common.py index 30ad7aa..3ffd1fc 100644 --- a/startrepo/common.py +++ b/startrepo/common.py @@ -4,20 +4,24 @@ from typing import TYPE_CHECKING +from overrides import EnforceOverrides + if TYPE_CHECKING: from typing_extensions import Self # Directly import from typing on Python 3.11+ -# class LOSDeviceError(Exception): +# class LOSDeviceError(Exception, EnforceOverrides): # """Error class unique to LOSDevice objects.""" -class LOSDevice: +class LOSDevice(EnforceOverrides): """A device that supports Lineage OS. :param new_type: This is a new type for LOSDevice """ + __slots__ = ("new_type",) + def __init__(self, new_type: str) -> None: """Initialize the LOSDevice.""" self.new_type = new_type diff --git a/startrepo/devices/oneplus3t.py b/startrepo/devices/oneplus3t.py index 9ec9028..fa84497 100644 --- a/startrepo/devices/oneplus3t.py +++ b/startrepo/devices/oneplus3t.py @@ -2,25 +2,31 @@ from __future__ import annotations +from overrides import EnforceOverrides + from startrepo.common import LOSDevice -# class OP3TError(Exception): +# class OP3TError(LOSDeviceError, EnforceOverrides): # """Error class unique to OP3T objects.""" -class OP3T(LOSDevice): +class OP3T(LOSDevice, EnforceOverrides): """OnePlus 3T object.""" + __slots__ = () + def __init__(self) -> None: """Initialize the OP3T.""" super().__init__("") # @classmethod + # @override # def main(cls) -> None: # """OP3T main method. # """ # @staticmethod + # @override # def create() -> None: # """Build a shell. # """ diff --git a/startrepo/devices/oneplus6t.py b/startrepo/devices/oneplus6t.py index 8b7fd4f..91ce929 100644 --- a/startrepo/devices/oneplus6t.py +++ b/startrepo/devices/oneplus6t.py @@ -2,25 +2,31 @@ from __future__ import annotations +from overrides import EnforceOverrides + from startrepo.common import LOSDevice -# class OP6TError(Exception): +# class OP6TError(LOSDeviceError, EnforceOverrides): # """Error class unique to OP6T objects.""" -class OP6T(LOSDevice): +class OP6T(LOSDevice, EnforceOverrides): """OnePlus 6T object.""" + __slots__ = () + def __init__(self) -> None: """Initialize the OP6T.""" super().__init__("") # @classmethod + # @override # def main(cls) -> None: # """OP6T main method. # """ # @staticmethod + # @override # def create() -> None: # """Build a shell. # """