in glam/api/management/commands/import_probes.py [0:0]
def extract(self):
# Read in all probes.
probes_dict = json.loads(urllib.request.urlopen(self.PROBES_URL).read())
print("{} probes loaded from probe dictionary".format(len(probes_dict.keys())))
# Filter probes by histograms or scalars only.
keys = [
k for k in probes_dict.keys() if k.startswith(("histogram/", "scalar/"))
]
# Remove any specifically excluded probes.
keys = [
k for k in keys if not any((regex.match(k) for regex in EXCLUDED_PROBES_RE))
]
print("{} probes after filters and exclusions".format(len(keys)))
# Restructure from one global dict to a list of dicts per probe, with `key`
# being the original probe dict key.
probes = [dict(probes_dict[k], key=k) for k in keys]
return probes