From 9ee3480a4bfed29259f4da8eb4c1de81a55d3ec3 Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Sun, 16 Mar 2025 07:12:20 +0100 Subject: refactor: use tomllib Since Python 3.11 tomllib is part of the standard library. --- build.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'build.py') diff --git a/build.py b/build.py index 928f3b3..aae8385 100755 --- a/build.py +++ b/build.py @@ -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: -- cgit v1.2.3