Coverage for src/typedconfig/loaders/loaders_310.py: 100%

1"""

2 Loaders for Python 3.10.

3"""

4

5 import sys

6 import typing

7 from typing import BinaryIO

8

9 if sys.version_info > (3, 10):

10 raise EnvironmentError("Wrong Python version!")

11 else: # pragma: no cover

12 import tomlkit

13

14 T_toml = dict[str, typing.Any]

15

16

17 def toml(f: BinaryIO) -> T_toml:

18 """

19 Load a toml file.

20 """

21 return typing.cast(T_toml, tomlkit.load(f))