예제 #1
0
def compare_config_files(config_filepath):
    """compares prod config file vs local version

    Args:
        config_filepath (str): path to config file

    Returns:
        (:obj:`dict`) description of unique keys between both configs

    """
    tracked_config = get_config(config_filepath, True)
    local_config = get_config(config_filepath)

    unique_values = {}

    if not path.isfile(
            get_local_config_filepath(config_filepath)):  #pragma: no cover
        #pytest.skip('no local .cfg found, skipping')
        return None

    local_unique_sections, local_unique_keys = find_unique_keys(
        local_config, tracked_config, 'local')
    tracked_unique_sections, tracked_unique_keys = find_unique_keys(
        tracked_config, local_config, 'tracked')

    ## vv TODO vv: TEST ME ##
    if any([local_unique_keys, tracked_unique_keys]):
        unique_values['unique_keys'] = {}
        unique_values['unique_keys']['local'] = local_unique_keys
        unique_values['unique_keys']['tracked'] = tracked_unique_keys
    if any([local_unique_sections, tracked_unique_sections]):
        unique_values['unique_sections'] = [
            local_unique_sections, tracked_unique_sections
        ]
    ## ^^ TODO ^^ ##

    return unique_values
예제 #2
0
def compare_config_files(config_filepath):
    '''validate that keys in tracked .cfg match keys in _local.cfg'''
    tracked_config = get_config(config_filepath, True)
    local_config = get_config(config_filepath)

    unique_values = {}

    if not path.isfile(get_local_config_filepath(config_filepath)):
        #pytest.skip('no local .cfg found, skipping')
        return None

    local_unique_sections, local_unique_keys = find_unique_keys(
        local_config,
        tracked_config,
        'local'
    )
    tracked_unique_sections, tracked_unique_keys = find_unique_keys(
        tracked_config,
        local_config,
        'tracked'
    )

    if any([
            local_unique_keys,
            tracked_unique_keys
    ]):
        unique_values['unique_keys'] = {}
        unique_values['unique_keys']['local'] = local_unique_keys
        unique_values['unique_keys']['tracked'] = tracked_unique_keys
    if any([
            local_unique_sections,
            tracked_unique_sections
    ]):
        unique_values['unique_sections'] = [local_unique_sections, tracked_unique_sections]

    return unique_values
예제 #3
0
'''FetchMapInfo.py: a script for saving the map statistics from EVE Online XML API'''

from os import path  #TODO: path->plumbum?

import pandas
import eveapi
from plumbum import cli

import prosper.common.prosper_logging as p_logging
from prosper.common.prosper_config import get_config

HERE = path.abspath(path.dirname(__file__))
ME = __file__.replace('.py', '')
CONFIG_ABSPATH = path.join(HERE, 'cron_config.cfg')

CONFIG = get_config(CONFIG_ABSPATH)

## MAP INFO GLOBALS ##
KILLS_FIELDS = CONFIG.get(ME, 'kills_fields')
JUMPS_FIELDS = CONFIG.get(ME, 'jumps_fields')
FAC_FIELDS = CONFIG.get(ME, 'fac_war_systems_fields')
SOV_FIELDS = CONFIG.get(ME, 'sovereignty_fields')


def convert_to_panda(data, fields):
    return pandas.DataFrame(refactor_to_docs(data, fields))


def refactor_to_docs(root, fields):

    for child in root.solarSystems:
예제 #4
0
import mysql.connector

#from prosper.common.utilities import get_config, create_logger
import prosper.common.prosper_logging as p_logging
import prosper.common.prosper_config as p_config
from prosper.common.prosper_logging import create_logger
from prosper.common.prosper_config import get_config
import prosper.warehouse.Connection as Connection
import prosper.warehouse.Utilities as table_utils

HERE = path.abspath(path.dirname(__file__))
ME = __file__.replace('.py', '')
CONFIG_ABSPATH = path.join(HERE, 'table_config.cfg')

print('EVE_SERVERINFO: GET_CONFIG')
config = p_config.get_config(CONFIG_ABSPATH)
CONNECTION_VALUES = table_utils.get_config_values(config, ME)

DEBUG = False


class eve_serverinfo(Connection.SQLTable):
    """Worker class for handling eve server info data"""
    _latest_entry = None

    def set_local_path(self):
        """return the local_path for eve_serverinfo"""
        return HERE

    def _define_table_type(self):
        """Set TableType enum"""