

def _series(self, params):
    '\n    Handle the data URL.\n    '
    rval = []
    format = params.setdefault('format', ['graphite'])[0]
    condense = False
    fetch = None
    process_row = None
    join_rows = None
    if (format == 'graphite'):
        condense = True
    else:
        condense = bool(params.get('condense', [False])[0])
    collapse = bool(params.get('collapse', [False])[0])
    start = params.get('start', [''])[0]
    end = params.get('end', [''])[0]
    if start:
        start = parse_time(start)
    if end:
        end = parse_time(end)
    steps = int(params.get('steps', [0])[0])
    schema_name = params.get('schema', [None])[0]
    interval = params.get('interval', [None])[0]
    stat_queries = {
        
    }
    for stat_spec in params['stat']:
        func_match = FUNC_MATCH.match(stat_spec)
        if func_match:
            func_name = func_match.groupdict()['func']
            stat = func_match.groupdict()['stat']
        else:
            if (format == 'graphite'):
                func_name = 'mean'
            else:
                func_name = None
            stat = stat_spec
        stat = tuple(stat.split(','))
        stat_queries.setdefault(stat, {
            
        })
        if func_name:
            macro = self._configuration.macro(func_name)
            if macro:
                format = macro.get('format', format)
                fetch = macro.get('fetch')
                process_row = macro.get('process_row')
                join_rows = macro.get('join_rows')
                condense = macro.get('condense', condense)
                collapse = macro.get('collapse', collapse)
                start = macro.get('start', start)
                end = macro.get('end', end)
                steps = macro.get('steps', steps)
                func_name = macro.get('transform')
                schema_name = macro.get('schema', schema_name)
                interval = macro.get('interval', interval)
                if start:
                    start = parse_time(start)
                if end:
                    end = parse_time(end)
        if func_name:
            func = (self._configuration.transform(func_name) or func_name)
            stat_queries[stat][stat_spec] = (func_name, func)
        else:
            stat_queries[stat][stat_spec] = (None, None)
    for (stat, specs) in stat_queries.iteritems():
        schema = self._configuration.schema(schema_name)
        if ((not schema) and (not schema_name)):
            schemas = self._configuration.schemas(stat)
            for schema in schemas:
                if (interval in schema.config['intervals'].keys()):
                    break
            else:
                if (schema and (not interval)):
                    interval = schema.config['intervals'].keys()[0]
        elif (not interval):
            interval = schema.config['intervals'].keys()[0]
        if (not schema):
            for (spec, transform) in specs.items():
                rval.append({
                    'stat': spec,
                    'stat_name': stat,
                    'function': transform[0],
                    'target': stat,
                    'datapoints': [],
                })
            continue
        transforms = specs.values()
        if (transforms == [(None, None)]):
            transforms = None
        else:
            transforms = [t[1] for t in transforms]
        start = (start or None)
        end = (end or None)
        data = schema.timeseries.series(stat, interval, condense=condense, transform=transforms, fetch=fetch, process_row=process_row, join_rows=join_rows, start=start, end=end, steps=steps, collapse=collapse)
        if transforms:
            for (spec, transform) in specs.iteritems():
                rval.append({
                    'stat': spec,
                    'stat_name': stat,
                    'function': transform[0],
                    'target': stat,
                    'schema': schema.name,
                    'interval': interval,
                    'datapoints': extract(data, transform[1]),
                })
        else:
            rval.append({
                'stat': specs.keys()[0],
                'stat_name': stat,
                'target': stat,
                'schema': schema.name,
                'interval': interval,
                'datapoints': data,
            })
    return rval

dataset/ETHPy150Open agoragames/torus/torus/web.py Web._series/original