コード例 #1
0
                'utf-8')]['winner'].values[0] == '+' else False
        candidateBuffer['is_finalist_winner'] = isWinner
        candidateBuffer['quote_final'] = round(
            float(
                df_quotesFinal.loc[df_quotesFinal.participant == realName.
                                   encode('utf-8')]['rate_procent'].values[0]),
            2)

    if candidateBuffer and (
        (CONFIG_INCLUDE_FINAL and candidateBuffer['is_finalist'])
            or not CONFIG_INCLUDE_FINAL):
        taskDataList.append(candidateBuffer)

#STEP: output-file
prefix = '_show-final_' if CONFIG_INCLUDE_FINAL else '_show-semifinal_'
outputPath = router.getRoute(
    config['target']['route']) + config['target']['dir']
outputFilePath = outputPath + config['target']['file'].replace(
    '$VERSION$', prefix + str(config['version']))

#com: create output folder
if not os.path.exists(outputPath):
    os.makedirs(outputPath)

#com: save taks-data file
with open(outputFilePath, 'w') as outfile:
    json.dump(taskDataList, outfile, indent=2, ensure_ascii=False)

#STEP: update config file
yaml.dump(config,
          file(DIR_TASK + '\\' + CONFIG_FILE_NAME + '.yml', 'w'),
          indent=2,
コード例 #2
0
router = Router( )

# --------------------------------------------------------------------------
today = dt.datetime.now().strftime("%Y-%m-%d--%H-%M") 


#STEP: modify version?

configVersion = config['version']
config['version'] =  round( float(configVersion) + .1, 1 ) if config['options']['increment-version'] == True else configVersion


#STEP: load source files
source = config['source']['source_quotes']
fileIdx = 0
sourcePathFile = router.getRoute( source['route'] ) + source['dir'] + source['files'][fileIdx]
df_showQuotes = pd.read_csv( filepath_or_buffer = sourcePathFile , sep=";", quoting= 3, decimal=',' )

source = config['source']['source_team']
fileIdx = 0
sourcePathFile = router.getRoute( source['route'] ) + source['dir'] + source['files'][fileIdx]
rawFile = open( sourcePathFile , 'r')
coachesTeamsObj = json.load( rawFile )
coachesNames = coachesTeamsObj.keys() # ['Michael Patrick', 'Mark', 'Michi & Smudo', 'Yvonne' ]

source = config['source']['source_buzzers']
fileIdx = 0
sourcePathFile = router.getRoute( source['route'] ) + source['dir'] + source['files'][fileIdx]
rawFile = open( sourcePathFile , 'r')
participantsObj = json.load( rawFile )
コード例 #3
0
print '>> Walk, Don`t Run'

#----------------------------------- STEP: modify version?

configVersion = config['version']
config['version'] = round(
    float(configVersion) +
    .1, 1) if config['options']['increment-version'] == True else configVersion

pItemsFileLimit = config['params']['itemsFileLimit']

#----------------------------------- STEP: Collect dimension tables

dfTables = {}
for iFile in config['source']['tables']['files']:
    inputFilePath =  router.getRoute( config['source']['tables']['route'] ) \
      + config['source']['tables']['dir'] \
      + iFile
    tableName = iFile.replace('table--', '')
    tableName = tableName.replace('.csv', '')

    dfTables[tableName] = pd.read_csv(filepath_or_buffer=inputFilePath,
                                      sep=';',
                                      quoting=0)

#help: dfTables KEYS -> D_AMP_NM, D_BNF, D_COST, D_PRACTICE, D_TIME, D_VMP_NM, D_VTM_NM
# print dfTables['D_PRACTICE']

#----------------------------------- STEP: Collect all source-files as a single dataframe

#com: start load
コード例 #4
0
sys.path.append(DIR_LIB)

from lib.router import Router
router = Router()
print '>> Walk, Don`t Run'


def tsToDate(miliTs):
    #convert Drawdate To Timestamp
    tss = float(str(miliTs)[:-3])
    return dt.datetime.fromtimestamp(tss).strftime('%Y-%m-%d')


# --------------------------------------------------------------------------

outputPath = router.getRoute(
    config['target']['route']) + config['target']['dir']

#com: create output folder
if not os.path.exists(outputPath):
    os.makedirs(outputPath)

# --------------------------------------------------------------------------

data_dir = router.getRoute(config['source']['route']) + config['source']['dir']
listFiles = os.listdir(data_dir)

container = {}

for idFile, nameFile in enumerate(listFiles):

    if '!' in nameFile:
コード例 #5
0
print '>> Walk, Don`t Run'
# --------------------------------------------------------------------------
#STEP: modify version?

configVersion = config['version']
config['version'] = round(
    float(configVersion) +
    .1, 1) if config['options']['increment-version'] == True else configVersion

#STEP: prepare Plot
plt.xlabel('xLabel')
plt.ylabel("yLabel")

#STEP: load
sourcePath = router.getRoute(
    config['source']
    ['route']) + config['source']['dir'] + config['source']['file']
rawObj = open(sourcePath, 'r')
fileJsonContent = json.load(rawObj)

colors = {
    'ducados': '#1b4079',
    'carmin': '#a5243d',
    'yema': '#f3a712',
    'chocolate': '#534d41',
    'purpura': '#5d2e46',
    'lila': '#b58db6',
    'naranja': '#ff4a1c',
    'menta': '#b2ffa9',
    'verde': '#06d6a0',
    'anyil': '#457b9d',
コード例 #6
0
from lib.router import Router
router = Router()

# --------------------------------------------------------------------------

today = dt.datetime.now().strftime("%Y-%m-%d--%H-%M")

#STEP: modify version?
configVersion = config['version']
config['version'] = round(
    float(configVersion) +
    .1, 1) if config['options']['increment-version'] == True else configVersion

sourcePathFile = router.getRoute(
    config['source']
    ['route']) + config['source']['dir'] + config['source']['file']
rawObj = open(sourcePathFile, 'r')
fileJsonContent = json.load(rawObj)


#STEP: definition
def openPartLink(_part, _coachKey, _partId):
    params = ''  # '/videos?disable_polymer=1'
    url = _part['link']
    browser.get(url + params)
    # time.sleep( 2 )
    browser.implicitly_wait(2)
    iframe = browser.find_elements_by_class_name('htmlcontent')[0]
    browser.switch_to.frame(iframe)
コード例 #7
0
        filtered_result_json = {
            "duration_seconds":
            result_json["rows"][0]["elements"][0]["duration"]["value"],
            "distance_meters":
            result_json["rows"][0]["elements"][0]["distance"]["value"],
            "station_a":
            station_a["evaNumber"],
            "station_b":
            station_b["evaNumber"]
        }
    return filtered_result_json


#STEP
configSourceElement = config['sources']['source_stations']
sourcePath = router.getRoute(
    configSourceElement['route']) + configSourceElement['dir']
sourceFiles = sourcePath + configSourceElement['files'][2]
listStations = json.load(open(sourceFiles, 'r'))

#STEP: output-file
outputPath = router.getRoute(
    config['target']['route']) + config['target']['dir']

#COM: create output folder
if not os.path.exists(outputPath):
    os.makedirs(outputPath)

# STEP: get data

station_a_obj = listStations[str(config['params']['station_a_evanumber'])]
station_b_obj = listStations[str(config['params']['station_b_evanumber'])]
コード例 #8
0
router = Router()
print '>> Walk, Don`t Run'
# --------------------------------------------------------------------------
#STEP: modify version?

configVersion = config['version']
config['version'] = round(
    float(configVersion) +
    .1, 1) if config['options']['increment-version'] == True else configVersion

halfFinalDate = config['params']['half-final_date']
d = dt.datetime.strptime(halfFinalDate, '%d.%m.%Y')
filePrefix = 'teams_' + d.strftime('%Y-%m-%d')

#STEP: load web-likes from half-final day
sourcePath = router.getRoute(config['source']['web-teams']
                             ['route']) + config['source']['web-teams']['dir']
sourceFilesNames = [f for f in listdir(sourcePath) if filePrefix in f]
sourceFilesNames.sort()

coachNames = ['Michael Patrick', 'Mark', 'Michi & Smudo', 'Yvonne']


def getTimeDataStart(_fileIndex):
    #INFO: global list of sourceFilesNames
    #COM: get list of current active participants
    fileName = sourceFilesNames[_fileIndex]
    rawObj = open(sourcePath + fileName, 'r')
    fileJsonContent = json.load(rawObj)

    timeData = {}
    #COM: empty file?
コード例 #9
0
CONFIG_FILE_NAME = '001.02_config.yml'
config = yaml.load( stream = file( DIR_TASK + '\\' + CONFIG_FILE_NAME, 'r'))

sys.path.append( DIR_LIB )

from lib.router import Router
router = Router( )

# _____________________________________________________________________________________ INIT

#STEP: modify version?
configVersion = config['version']
config['version'] =  round( float(configVersion) + .1, 1 ) if config['options']['increment_version'] == True else configVersion

#STEP: output-file
outputPath =  router.getRoute( config['target']['route'] ) + config['target']['dir'] 

#COM: create output folder
if not os.path.exists( outputPath ):
  os.makedirs( outputPath )


#STEP: Load Data

configSourceElement = config['sources']['source_stations']
sourceFile = router.getRoute( configSourceElement['route'] ) + configSourceElement['dir'] + configSourceElement['file']
rawContent = open( sourceFile , 'r') 
fileJsonContent = json.load( rawContent )

#STEP: Filter the stations
コード例 #10
0
from lib.router import Router
router = Router( )

# --------------------------------------------------------------------------
today = dt.datetime.now().strftime("%Y-%m-%d--%H-%M") 

#STEP: modify version?

configVersion = config['version']
config['version'] =  round( float(configVersion) + .1, 1 ) if config['options']['increment-version'] == True else configVersion


#STEP: load file json

sourcePathFile = router.getRoute( config['secret']['route'] ) + config['secret']['dir'] + config['secret']['file']
rawObj = open( sourcePathFile , 'r')
secretFile = json.load( rawObj )

sourcePath = router.getRoute( config['source']['route'] ) + config['source']['dir']
sourceFilesNames = [f for f in listdir( sourcePath ) if isfile(join(sourcePath , f))]
# sourceFilesNames.remove('links.json')

#STEP: 

def getGenderByName( _name ):
    # https://genderapi.io/api/?name=Abdullah
    apiUrl = "https://genderapi.io/api/"
    params = {
        "name": _name
    }