-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmapchart.py
More file actions
24 lines (21 loc) · 812 Bytes
/
mapchart.py
File metadata and controls
24 lines (21 loc) · 812 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import json
from utils import *
class Map:
def __init__(self):
self.config = {}
self.settings = json.load(open("resources/settings.json","r"))
def create(self,groups: list):
"""_summary_
Args:
groups (dict):
Groups
example:
[{"failed": "color": "#ff0000", "countries": "us"...}]
"""
self.config["groups"]={}
for group in groups:
self.config["groups"][group.get("color",None)] = {}
self.config["groups"][group.get("color",{})]["label"] = group.get("title","Not defined")
self.config["groups"][group.get("color",{})]["paths"] = group.get("countries",[])
self.config.update(self.settings)
return format_config(str(self.config))