# Path: kano/logging.py
# class lazy_logger:
# class loader:
#     def __getattr__(self, name):
#     def __init__(self, old_mod):
#     def __getattr__(self, name):
# def log_excepthook(exc_class, exc_value, tb):
# 
# Path: kano/utils/shell.py
# def run_cmd(cmd, localised=False, unsudo=False):
#     '''
#     Executes cmd, returning stdout, stderr, return code
#     if localised is False, LC_ALL will be set to "C"
#     '''
#     env = os.environ.copy()
#     if not localised:
#         env['LC_ALL'] = 'C'
# 
#     if unsudo and \
#             'SUDO_USER' in os.environ and \
#             os.environ['SUDO_USER'] != 'root':
#         cmd = "sudo -u {} bash -c '{}' ".format(os.environ['SUDO_USER'], cmd)
# 
#     process = subprocess.Popen(cmd, shell=True, env=env,
#                                stdout=subprocess.PIPE, stderr=subprocess.PIPE,
#                                preexec_fn=restore_signals)
# 
#     stdout, stderr = process.communicate()
#     returncode = process.returncode
#     return stdout, stderr, returncode
# 
# Path: kano/utils/file_operations.py
# def read_file_contents_as_lines(path):
#     if os.path.exists(path):
#         with open(path) as infile:
#             content = infile.readlines()
#             lines = [line.strip() for line in content]
#             return lines


import traceback
from kano.logging import logger
from kano.utils.shell import run_cmd
from kano.utils.file_operations import read_file_contents_as_lines

        elif revision_hex & 0x00ff in (0x12, 0x15) or \
                revision_hex & 0x00FFFFFF == 0x00900021:
            model_name = RPI_A_PLUS_KEY

        elif revision_hex & 0x00ff in (0x7, 0x8, 0x9):
            model_name = RPI_A_KEY

        elif revision_hex & 0x00FFFFFF == 0x009000C1:
            model_name = RPI_ZERO_W_KEY

        elif revision_hex & 0x00FFFFFF in (0x00900092, 0x00920092, 0x00900093, 0x00920093):
            model_name = RPI_ZERO_KEY

        elif revision_hex & 0x00FFFFFF == 0x00A020A0:
            model_name = RPI_COMPUTE_3_KEY

        elif revision_hex & 0x00ff in (0x11, 0x14):
            model_name = RPI_COMPUTE_KEY

        elif revision == 'Beta':
            model_name = RPI_B_BETA_KEY

        else:
            model_name = 'unknown revision: {}'.format(revision)
            logger.error('Unknown Raspberry Pi board revision: {}'.format(revision))

        return '{} {}'.format(model_name, overclocked).strip()

    except Exception:

# Path: kano/logging.py
# class lazy_logger:
# class loader:
#     def __getattr__(self, name):
#     def __init__(self, old_mod):
#     def __getattr__(self, name):
# def log_excepthook(exc_class, exc_value, tb):
# 
# Path: kano/utils/shell.py
# def run_cmd(cmd, localised=False, unsudo=False):
#     '''
#     Executes cmd, returning stdout, stderr, return code
#     if localised is False, LC_ALL will be set to "C"
#     '''
#     env = os.environ.copy()
#     if not localised:
#         env['LC_ALL'] = 'C'
# 
#     if unsudo and \
#             'SUDO_USER' in os.environ and \
#             os.environ['SUDO_USER'] != 'root':
#         cmd = "sudo -u {} bash -c '{}' ".format(os.environ['SUDO_USER'], cmd)
# 
#     process = subprocess.Popen(cmd, shell=True, env=env,
#                                stdout=subprocess.PIPE, stderr=subprocess.PIPE,
#                                preexec_fn=restore_signals)
# 
#     stdout, stderr = process.communicate()
#     returncode = process.returncode
#     return stdout, stderr, returncode
# 
# Path: kano/utils/file_operations.py
# def read_file_contents_as_lines(path):
#     if os.path.exists(path):
#         with open(path) as infile:
#             content = infile.readlines()
#             lines = [line.strip() for line in content]
#             return lines


# Path: kano/utils/hardware.py
import traceback
from kano.logging import logger
from kano.utils.shell import run_cmd
from kano.utils.file_operations import read_file_contents_as_lines


        elif revision_hex & 0x00ff in (0x12, 0x15) or \
                revision_hex & 0x00FFFFFF == 0x00900021:
            model_name = RPI_A_PLUS_KEY

        elif revision_hex & 0x00ff in (0x7, 0x8, 0x9):
            model_name = RPI_A_KEY

        elif revision_hex & 0x00FFFFFF == 0x009000C1:
            model_name = RPI_ZERO_W_KEY

        elif revision_hex & 0x00FFFFFF in (0x00900092, 0x00920092, 0x00900093, 0x00920093):
            model_name = RPI_ZERO_KEY

        elif revision_hex & 0x00FFFFFF == 0x00A020A0:
            model_name = RPI_COMPUTE_3_KEY

        elif revision_hex & 0x00ff in (0x11, 0x14):
            model_name = RPI_COMPUTE_KEY

        elif revision == 'Beta':
            model_name = RPI_B_BETA_KEY

        else:
            model_name = 'unknown revision: {}'.format(revision)
            logger.error('Unknown Raspberry Pi board revision: {}'.format(revision))

        return '{} {}'.format(model_name, overclocked).strip()

    except Exception:

        logger.error('Unexpected error: \n{}'.format(traceback.format_exc()))