Created
May 21, 2025 08:19
-
-
Save LiEnby/d2649c6a1c5d9e6760b956973ee98cba to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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