mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-16 00:37:11 +08:00
Replace toml with tomli (#787)
* Replace `toml` with `tomli` * Replace `toml` with `tomli`
This commit is contained in:
@@ -4,7 +4,7 @@ import textwrap
|
||||
from functools import partial
|
||||
from typing import Callable, Dict, List, NoReturn, Optional, Tuple, cast
|
||||
|
||||
import toml
|
||||
import tomli
|
||||
from django.db.models.fields.related import RelatedField
|
||||
from mypy.modulefinder import mypy_path
|
||||
from mypy.nodes import MypyFile, TypeInfo
|
||||
@@ -103,7 +103,11 @@ def extract_django_settings_module(config_file_path: Optional[str]) -> str:
|
||||
handler.error("'django_settings_module' not found or invalid: " + messages[error_type])
|
||||
|
||||
if config_file_path and helpers.is_toml(config_file_path):
|
||||
toml_data = toml.load(config_file_path)
|
||||
try:
|
||||
with open(config_file_path, encoding="utf-8") as config_file_obj:
|
||||
toml_data = tomli.loads(config_file_obj.read())
|
||||
except Exception:
|
||||
exit_toml(1)
|
||||
try:
|
||||
config = toml_data["tool"]["django-stubs"]
|
||||
except KeyError:
|
||||
|
||||
Reference in New Issue
Block a user