Skip to content

Commit ba0d497

Browse files
authored
Use tomli to read .toml files (#81)
1 parent 95ec0ea commit ba0d497

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

.pre-commit-config.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ repos:
2828
- types-mock
2929
- types-setuptools
3030
- types-docutils
31-
- types-toml
3231
- repo: https://github.com/PyCQA/pylint
3332
rev: v2.13.3
3433
hooks:

README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ instead.
102102
* ``$CWD/tox.ini``
103103
* ``$CWD/pep8.ini``
104104
* ``$CWD/setup.cfg``
105-
* ``$CWD/pyproject.toml`` in section ``[tool.doc8]`` if ``toml`` is installed
105+
* ``$CWD/pyproject.toml`` in section ``[tool.doc8]`` if ``tomli`` is installed
106106

107107
An example section that can be placed into one of these files::
108108

src/doc8/main.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
import sys
3737

3838
try:
39-
import toml
39+
import tomli
4040

4141
HAVE_TOML = True
4242
except ImportError:
@@ -134,7 +134,8 @@ def from_ini(fp):
134134

135135

136136
def from_toml(fp):
137-
cfg = toml.load(fp).get("tool", {}).get("doc8", {})
137+
with open(fp, "rb") as f:
138+
cfg = tomli.load(f).get("tool", {}).get("doc8", {})
138139
return cfg
139140

140141

test-requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
mock # BSD
22
pytest # MIT
3-
toml # MIT
3+
tomli # MIT

0 commit comments

Comments
 (0)