Skip to content

Commit

Permalink
Fix typo "tomlib"
Browse files Browse the repository at this point in the history
  • Loading branch information
SRv6d authored and DimitriPapadopoulos committed Jan 26, 2023
1 parent 65b2f88 commit 7478623
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions codespell_lib/_codespell.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,27 +545,27 @@ def parse_options(

# Read toml before other config files.
toml_files = []
tomlib_raise_error = False
tomllib_raise_error = False
if os.path.isfile("pyproject.toml"):
toml_files.append("pyproject.toml")
if options.toml:
toml_files.append(options.toml)
tomlib_raise_error = True
tomllib_raise_error = True
if toml_files:
try:
import tomlib # type: ignore
import tomllib # type: ignore
except ModuleNotFoundError:
try:
import tomli as tomlib # type: ignore
import tomli as tomllib # type: ignore
except ImportError as e:
if tomlib_raise_error:
if tomllib_raise_error:
raise ImportError(
f"tomlib or tomli are required to read pyproject.toml "
f"tomllib or tomli are required to read pyproject.toml "
f"but could not be imported, got: {e}"
) from None
for toml_file in toml_files:
with open(toml_file, "rb") as f:
data = tomlib.load(f).get("tool", {})
data = tomllib.load(f).get("tool", {})
config.read_dict(data)

# Collect which config files are going to be used
Expand Down

0 comments on commit 7478623

Please sign in to comment.