Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
data = {k: source_data[k] for k in fields}
timestamps = {k: source_ts[k] for k in fields}
return {}, data, timestamps
if fields:
event_fields = set(d['data_keys'])
selected_fields = set(filter(comp_re.match, event_fields))
discard_fields = event_fields - selected_fields
else:
discard_fields = set()
selected_fields = set(d['data_keys'])
objs_config = d.get('configuration', {}).values()
config_data = merge(obj_conf['data'] for obj_conf in objs_config)
config_ts = merge(obj_conf['timestamps']
for obj_conf in objs_config)
all_extra_data = {}
all_extra_ts = {}
all_extra_dk = {}
if not no_fields_filter:
for dt, ts in [(config_data, config_ts),
(start, defaultdict(lambda: start['time'])),
(stop, defaultdict(lambda: stop['time']))]:
# Look in the descriptor, then start, then stop.
l_dk, l_data, l_ts = _project_header_data(
dt, ts, selected_fields, comp_re)
all_extra_data.update(l_data)
all_extra_ts.update(l_ts)
selected_fields.update(l_data)
all_extra_dk.update(l_dk)
fields = (set(filter(comp_re.match, source_data)) - selected_fields)
data = {k: source_data[k] for k in fields}
timestamps = {k: source_ts[k] for k in fields}
return {}, data, timestamps
if fields:
event_fields = set(d['data_keys'])
selected_fields = set(filter(comp_re.match, event_fields))
discard_fields = event_fields - selected_fields
else:
discard_fields = set()
selected_fields = set(d['data_keys'])
objs_config = d.get('configuration', {}).values()
config_data = merge(obj_conf['data'] for obj_conf in objs_config)
config_ts = merge(obj_conf['timestamps']
for obj_conf in objs_config)
all_extra_data = {}
all_extra_ts = {}
all_extra_dk = {}
if not no_fields_filter:
for dt, ts in [(config_data, config_ts),
(start, defaultdict(lambda: start['time'])),
(stop, defaultdict(lambda: stop['time']))]:
# Look in the descriptor, then start, then stop.
l_dk, l_data, l_ts = _project_header_data(
dt, ts, selected_fields, comp_re)
all_extra_data.update(l_data)
all_extra_ts.update(l_ts)
selected_fields.update(l_data)
all_extra_dk.update(l_dk)
self._first_important_matches(matches))
for match, value in relevant_matches_and_values:
if not isinstance(value, Mapping):
raise InvalidTypeError(self.name, value, match.source, value.__class__.__name__,
self._type.__name__)
# mapkeys with important matches
def key_is_important(match, key):
return match.valueflags(self).get(key) == ParameterFlag.final
important_maps = tuple(dict((k, v)
for k, v in iteritems(match_value)
if key_is_important(match, k))
for match, match_value in relevant_matches_and_values)
# dump all matches in a dict
# then overwrite with important matches
return merge(concatv((v for _, v in relevant_matches_and_values),
reversed(important_maps)))
data = {k: source_data[k] for k in fields}
timestamps = {k: source_ts[k] for k in fields}
return {}, data, timestamps
if fields:
event_fields = set(d['data_keys'])
selected_fields = set(filter(comp_re.match, event_fields))
discard_fields = event_fields - selected_fields
else:
discard_fields = set()
selected_fields = set(d['data_keys'])
objs_config = d.get('configuration', {}).values()
config_data = merge(obj_conf['data'] for obj_conf in objs_config)
config_ts = merge(obj_conf['timestamps']
for obj_conf in objs_config)
all_extra_data = {}
all_extra_ts = {}
all_extra_dk = {}
if not no_fields_filter:
for dt, ts in [(config_data, config_ts),
(start, defaultdict(lambda: start['time'])),
(stop, defaultdict(lambda: stop['time']))]:
# Look in the descriptor, then start, then stop.
l_dk, l_data, l_ts = _project_header_data(
dt, ts, selected_fields, comp_re)
all_extra_data.update(l_data)
all_extra_ts.update(l_ts)
selected_fields.update(l_data)
all_extra_dk.update(l_dk)
def _render_(self, template_name='base.html', **extra_args):
repr_args = merge(self.configuration.copy(), extra_args)
if self.configuration['visualization_js']:
repr_args['visualization_js'] = env.get_template(self.configuration['visualization_js']).render(**repr_args)
else:
raise Exception('Empty Visualization code!')
if 'functions_js' in self.configuration and self.configuration['functions_js'] is not None:
repr_args['functions_js'] = env.get_template(self.configuration['functions_js']).render(**repr_args)
template = env.get_template(template_name)
if not 'figure_id' in repr_args or not repr_args['figure_id']:
repr_args['figure_id'] = 'fig-{0}'.format(uuid.uuid4())
if not 'vis_uuid' in repr_args or not repr_args['vis_uuid']:
repr_args['vis_uuid'] = 'datagram-vis-{0}'.format(uuid.uuid4())