File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 11from __future__ import annotations
22
33import argparse
4+ import sys
45from typing import Sequence
56
6- import toml
7+ if sys .version_info >= (3 , 11 ): # pragma: >=3.11 cover
8+ import tomllib
9+ else : # pragma: <3.11 cover
10+ import tomli as tomllib
711
812
913def main (argv : Sequence [str ] | None = None ) -> int :
@@ -14,8 +18,9 @@ def main(argv: Sequence[str] | None = None) -> int:
1418 retval = 0
1519 for filename in args .filenames :
1620 try :
17- toml .load (filename )
18- except toml .TomlDecodeError as exc :
21+ with open (filename , mode = 'rb' ) as fp :
22+ tomllib .load (fp )
23+ except tomllib .TOMLDecodeError as exc :
1924 print (f'{ filename } : { exc } ' )
2025 retval = 1
2126 return retval
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ classifiers =
2424packages = find:
2525install_requires =
2626 ruamel.yaml>=0.15
27- toml
27+ tomli>=1.1.0 ; python_version<"3.11"
2828python_requires = >=3.7
2929
3030[options.packages.find]
You can’t perform that action at this time.
0 commit comments