Skip to content

Instantly share code, notes, and snippets.

@LiEnby
Created May 21, 2025 08:19
Show Gist options
  • Save LiEnby/d2649c6a1c5d9e6760b956973ee98cba to your computer and use it in GitHub Desktop.
Save LiEnby/d2649c6a1c5d9e6760b956973ee98cba to your computer and use it in GitHub Desktop.
import os
import yaml
dbyml = {"version":2, "firmware": 3.60, "modules": {}}
ymls = os.listdir("360")
for yml in ymls:
ymldata = yaml.safe_load(open("360/"+yml, "rb").read())
for modname in list(ymldata["modules"].keys()):
for library in list(ymldata["modules"][modname]["libraries"].keys()):
if "stubname" in ymldata["modules"][modname]["libraries"][library]:
del ymldata["modules"][modname]["libraries"][library]["stubname"]
dbyml["modules"].update(ymldata["modules"])
def hexint_presenter(dumper, data):
return dumper.represent_int(hex(data))
yaml.add_representer(int, hexint_presenter)
with open("db.yml", "w") as dbfile:
dbfile.write(yaml.dump(dbyml, default_flow_style=False, sort_keys=False))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment