Skip to content

Commit 6e5fbc3

Browse files
committed
build(deps): replace toml with tomli
toml library is abandoned, last release was in 2020 tomli library is the community recognized replacement change required because toml can't parse our pyproject.toml
1 parent ed3341e commit 6e5fbc3

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

cve_bin_tool/config.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
from typing import Mapping
1111

1212
if sys.version_info >= (3, 11):
13-
import tomllib as toml
13+
import tomllib
1414
else:
15-
import toml
15+
import tomli as tomllib
1616

1717
import yaml
1818

@@ -65,12 +65,8 @@ def parse_config(
6565
with ErrorHandler(mode=self.error_mode):
6666
raise FileNotFoundError(self.filename)
6767
if self.filename.endswith(".toml"):
68-
if sys.version_info >= (3, 11):
69-
with open(self.filename, "rb") as f:
70-
raw_config_data = toml.load(f)
71-
else:
72-
with open(self.filename) as f:
73-
raw_config_data = toml.load(f)
68+
with open(self.filename, "rb") as f:
69+
raw_config_data = tomllib.load(f)
7470
self.config_data = ChainMap(*raw_config_data.values())
7571
elif self.filename.endswith(".yaml"):
7672
with open(self.filename) as f:

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ dependencies = [
4848
"rich",
4949
"rpmfile>=1.0.6",
5050
"setuptools>=70.0.0", # pinned by Snyk to avoid a vulnerability
51-
"toml; python_version < '3.11'",
51+
"tomli; python_version < '3.11'",
5252
"urllib3>=2.2.2", # dependency of requests added explicitly to avoid CVEs
5353
"xmlschema",
5454
"zipp>=3.19.1", # not directly required, pinned by Snyk to avoid a vulnerability
@@ -84,7 +84,6 @@ dev = [
8484
"types-PyYAML",
8585
"types-requests",
8686
"types-setuptools",
87-
"types-toml",
8887
]
8988

9089
[project.urls]

0 commit comments

Comments
 (0)