diff options
author | Martin Fischer <martin@push-f.com> | 2025-03-16 07:12:20 +0100 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2025-03-16 07:12:38 +0100 |
commit | 9ee3480a4bfed29259f4da8eb4c1de81a55d3ec3 (patch) | |
tree | dfd990f42803a1cb095397c458d949368a4aa5d0 | |
parent | 251ea5cec9f382f82db0c02ba1704031ef279b43 (diff) |
refactor: use tomllib
Since Python 3.11 tomllib is part of the standard library.
-rwxr-xr-x | build.py | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -5,16 +5,15 @@ import json import os import re import shutil - -import toml +import tomllib def get_features(dirname): feature_data = {} for feature in sorted(os.listdir('caniuse.rs/data/' + dirname)): - with open('caniuse.rs/data/' + dirname + '/' + feature) as f: + with open('caniuse.rs/data/' + dirname + '/' + feature, 'rb') as f: name = feature.split('.')[0] - feature_data[name] = toml.load(f) + feature_data[name] = tomllib.load(f) # new dict because we want to deduplicate features features = {} @@ -83,8 +82,8 @@ def get_features(dirname): with open('lib_feats.txt') as f: library_flags = set([l.strip() for l in f]) -with open('caniuse.rs/data/versions.toml') as f: - versions = toml.load(f) +with open('caniuse.rs/data/versions.toml', 'rb') as f: + versions = tomllib.load(f) for version, data in versions.items(): try: |