src/aoikhotkey/__main__.py
def check_deps():
    """
    Check whether dependency packages have been installed.

    :return: Error message for missing dependency, otherwise None.
    """
    # If the platform is MacOS
    if sys.platform.startswith('darwin'):
        try:
            # Import dependency module
            import AppKit

            # Suppress linter error
            id(AppKit)

        # If the dependency module is not found
        except ImportError:
            # Get error message
            msg = (
                'Error: Package `pyobjc` is not installed. Try:\n'
                'pip install pyobjc\n'
            )

            # Return error message
            return msg

    # If the platform is Linux
    if sys.platform.startswith('linux'):
        try:
            # Import dependency module
            import Xlib

            # Suppress linter error
            id(Xlib)

        # If the dependency module is not found
        except ImportError:
            # Get error message
            msg = (
                'Error: Package `python-xlib` is not installed. Try:\n'
                'pip install python-xlib\n'
            )

            # Return error message
            return msg

    # If the platform is Windows or Cygwin
    if sys.platform.startswith('win') or sys.platform.startswith('cygwin'):
        try:
            # Import dependency module
            try:
                import PyHook3

                # Suppress linter error
                id(PyHook3)
            except ImportError:
                import pyHook

                # Suppress linter error
                id(pyHook)

        # If the dependency module is not found
        except ImportError:
            # Get error message
            msg = (
                'Error: Package `PyHook3` or `pyHook` is not installed. Try:\n'
                'pip install PyHook3\n'
            )

            # Return error message
            return msg

    # Return None to mean no missing dependency
    return None

    Check whether dependency packages have been installed.

    :return: Error message for missing dependency, otherwise None.
    
Check whether dependency packages have been installed.
Check whether dependency packages have been installed .
def check_deps():
    if sys.platform.startswith('darwin'):
        try:
            import AppKit
            id(AppKit)
        except ImportError:
            msg = (
                'Error: Package `pyobjc` is not installed. Try:\n'
                'pip install pyobjc\n'
            )
            return msg
    if sys.platform.startswith('linux'):
        try:
            import Xlib
            id(Xlib)
        except ImportError:
            msg = (
                'Error: Package `python-xlib` is not installed. Try:\n'
                'pip install python-xlib\n'
            )
            return msg
    if sys.platform.startswith('win') or sys.platform.startswith('cygwin'):
        try:
            try:
                import PyHook3
                id(PyHook3)
            except ImportError:
                import pyHook
                id(pyHook)
        except ImportError:
            msg = (
                'Error: Package `PyHook3` or `pyHook` is not installed. Try:\n'
                'pip install PyHook3\n'
            )
            return msg
    return None
def check_deps ( ) : if sys . platform . startswith ( 'darwin' ) : try : import AppKit id ( AppKit ) except ImportError : msg = ( 'Error: Package `pyobjc` is not installed. Try:\n' 'pip install pyobjc\n' ) return msg if sys . platform . startswith ( 'linux' ) : try : import Xlib id ( Xlib ) except ImportError : msg = ( 'Error: Package `python-xlib` is not installed. Try:\n' 'pip install python-xlib\n' ) return msg if sys . platform . startswith ( 'win' ) or sys . platform . startswith ( 'cygwin' ) : try : try : import PyHook3 id ( PyHook3 ) except ImportError : import pyHook id ( pyHook ) except ImportError : msg = ( 'Error: Package `PyHook3` or `pyHook` is not installed. Try:\n' 'pip install PyHook3\n' ) return msg return None
Check whether dependency packages have been installed.
Check whether dependency packages have been installed .
"""
    Check whether dependency packages have been installed.

    :return: Error message for missing dependency, otherwise None.
    """ # If the platform is MacOS # Import dependency module # Suppress linter error # If the dependency module is not found # Get error message # Return error message # If the platform is Linux # Import dependency module # Suppress linter error # If the dependency module is not found # Get error message # Return error message # If the platform is Windows or Cygwin # Import dependency module # Suppress linter error # Suppress linter error # If the dependency module is not found # Get error message # Return error message # Return None to mean no missing dependency
Error message for missing dependency, otherwise None.
Error message for missing dependency otherwise None .