diff --git a/machineid/__init__.py b/machineid/__init__.py index 5761439..2e5e3bf 100644 --- a/machineid/__init__.py +++ b/machineid/__init__.py @@ -38,13 +38,10 @@ except ImportError: WinRegistry = None - - class MachineIdNotFound(RuntimeError): """ - Raised when this library is unable to - determine the machine id for the system - where it is running. + Raised when this library is unable to determine the machine id for the + system where it is running. """ def __sanitize__(id: str) -> str: @@ -80,6 +77,7 @@ def id(winregistry: bool = True) -> str: """ id returns the platform specific device GUID of the current host OS. """ + id = None if platform == 'darwin': id = __exec__("ioreg -d2 -c IOPlatformExpertDevice | awk -F\\\" '/IOPlatformUUID/{print $(NF-1)}'") @@ -117,7 +115,8 @@ def id(winregistry: bool = True) -> str: def hashed_id(app_id: str = '', **kwargs) -> str: """ - hashed_id returns the device's native GUID, hashed using HMAC-SHA256 with an optional application ID. + hashed_id returns the device's native GUID, hashed using HMAC-SHA256 with + an optional application ID. """ return hmac.new(bytes(app_id.encode()), id(**kwargs).encode(), hashlib.sha256).hexdigest() diff --git a/tests/test_exceptions.py b/tests/test_exceptions.py index 82896ec..c9c0528 100644 --- a/tests/test_exceptions.py +++ b/tests/test_exceptions.py @@ -3,12 +3,9 @@ import machineid - RETURNS_NONE = Mock(return_value=None) - class TestExceptionsHandling(unittest.TestCase): - @patch.multiple( 'machineid', __exec__=RETURNS_NONE,