init
This commit is contained in:
22
tools/convert_data.py
Normal file
22
tools/convert_data.py
Normal file
@ -0,0 +1,22 @@
|
||||
import re
|
||||
|
||||
import otc_metadata.services
|
||||
from ruamel.yaml import YAML
|
||||
|
||||
data = otc_metadata.services.Services()
|
||||
new_data = data._service_data
|
||||
|
||||
# services = data.service_dict
|
||||
|
||||
for doc in new_data["documents"]:
|
||||
hc_location = None
|
||||
link = doc.get("link")
|
||||
if link:
|
||||
print(f"Parsing {link}")
|
||||
# (p1, p2) = link.split("/")
|
||||
doc["link"] = re.sub(r"/(.*)/(.*)/", r"/\2/\1/", link)
|
||||
|
||||
_yaml = YAML()
|
||||
_yaml.indent(mapping=2, sequence=4, offset=2)
|
||||
with open("new.yaml", "w") as fd:
|
||||
_yaml.dump(new_data, fd)
|
Reference in New Issue
Block a user