Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions autoflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -1089,9 +1089,13 @@ def find_files(filenames, recursive, exclude):

def process_pyproject_toml(toml_file_path):
"""Extract config mapping from pyproject.toml file."""
import toml
try:
import tomllib
except ModuleNotFoundError:
import tomli as tomllib

return toml.load(toml_file_path).get("tool", {}).get("autoflake", None)
with open(toml_file_path, "rb") as f:
return tomllib.load(f).get("tool", {}).get("autoflake", None)


def process_setup_cfg(cfg_file_path):
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ py_modules =
autoflake
install_requires =
pyflakes>=1.1.0
toml>=0.10.2
tomli>=2.0.1;python_version<'3.11'
python_requires = >=3.7
test_suite = test_autoflake

Expand Down