src/dirbs/utils.py
def validate_exempted_device_types(conn, config):
    """
    Method to validate exempted device types specified in config.

    Arguments:
        conn: dirbs db connection object
        config: dirbs parsed configuration object
    Raises:
        ConfigParseException: if device types are not valid
    """
    with conn.cursor() as cursor:
        logger = logging.getLogger('dirbs.config')
        exempted_device_types = config.region_config.exempted_device_types
        if len(exempted_device_types) > 0:
            cursor.execute('SELECT DISTINCT device_type FROM gsma_data')
            all_device_types = [x.device_type for x in cursor]
            if len(all_device_types) == 0:
                logger.warning('RegionConfig: Ignoring setting exempted_device_types={0} as GSMA TAC database '
                               'not imported or no device types found.'.format(exempted_device_types))
            else:
                invalid_device_types = set(exempted_device_types) - set(all_device_types)
                if len(invalid_device_types) > 0:
                    msg = "RegionConfig: exempted_device_types \'{0}\' is/are not valid device type(s). " \
                          "The valid GSMA device types are: \'{1}\'".format(invalid_device_types, all_device_types)
                    logger.error(msg)
                    raise ConfigParseException(msg)

    Method to validate exempted device types specified in config.

    Arguments:
        conn: dirbs db connection object
        config: dirbs parsed configuration object
    Raises:
        ConfigParseException: if device types are not valid
    
Method to validate exempted device types specified in config.
Method to validate exempted device types specified in config .
def validate_exempted_device_types(conn, config):
    with conn.cursor() as cursor:
        logger = logging.getLogger('dirbs.config')
        exempted_device_types = config.region_config.exempted_device_types
        if len(exempted_device_types) > 0:
            cursor.execute('SELECT DISTINCT device_type FROM gsma_data')
            all_device_types = [x.device_type for x in cursor]
            if len(all_device_types) == 0:
                logger.warning('RegionConfig: Ignoring setting exempted_device_types={0} as GSMA TAC database '
                               'not imported or no device types found.'.format(exempted_device_types))
            else:
                invalid_device_types = set(exempted_device_types) - set(all_device_types)
                if len(invalid_device_types) > 0:
                    msg = "RegionConfig: exempted_device_types \'{0}\' is/are not valid device type(s). " \
                          "The valid GSMA device types are: \'{1}\'".format(invalid_device_types, all_device_types)
                    logger.error(msg)
                    raise ConfigParseException(msg)
def validate_exempted_device_types ( conn , config ) : with conn . cursor ( ) as cursor : logger = logging . getLogger ( 'dirbs.config' ) exempted_device_types = config . region_config . exempted_device_types if len ( exempted_device_types ) > 0 : cursor . execute ( 'SELECT DISTINCT device_type FROM gsma_data' ) all_device_types = [ x . device_type for x in cursor ] if len ( all_device_types ) == 0 : logger . warning ( 'RegionConfig: Ignoring setting exempted_device_types={0} as GSMA TAC database ' 'not imported or no device types found.' . format ( exempted_device_types ) ) else : invalid_device_types = set ( exempted_device_types ) - set ( all_device_types ) if len ( invalid_device_types ) > 0 : msg = "RegionConfig: exempted_device_types \'{0}\' is/are not valid device type(s). " "The valid GSMA device types are: \'{1}\'" . format ( invalid_device_types , all_device_types ) logger . error ( msg ) raise ConfigParseException ( msg )
Method to validate exempted device types specified in config.
Method to validate exempted device types specified in config .
"""
    Method to validate exempted device types specified in config.

    Arguments:
        conn: dirbs db connection object
        config: dirbs parsed configuration object
    Raises:
        ConfigParseException: if device types are not valid
    """
if device types are not valid
if device types are not valid
ConfigParseException
conn
dirbs db connection object
dirbs db connection object
config
dirbs parsed configuration object
dirbs parsed configuration object