Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ezekg committed Jul 4, 2024
1 parent b960169 commit ba5ce28
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
11 changes: 5 additions & 6 deletions machineid/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)}'")
Expand Down Expand Up @@ -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()
3 changes: 0 additions & 3 deletions tests/test_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@

import machineid


RETURNS_NONE = Mock(return_value=None)


class TestExceptionsHandling(unittest.TestCase):

@patch.multiple(
'machineid',
__exec__=RETURNS_NONE,
Expand Down

0 comments on commit ba5ce28

Please sign in to comment.