forked from Ponysearch/Ponysearch
[fix] add missing tomli to the requirements.txt
Package ``tomli`` is needed for py < 3.11, BTW remove the no longer needed pytomlpp package. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
a3921b5ed7
commit
e08ff05fff
2 changed files with 5 additions and 24 deletions
|
@ -15,7 +15,7 @@ setproctitle==1.3.3
|
||||||
redis==5.0.8
|
redis==5.0.8
|
||||||
markdown-it-py==3.0.0
|
markdown-it-py==3.0.0
|
||||||
fasttext-predict==0.9.2.2
|
fasttext-predict==0.9.2.2
|
||||||
pytomlpp==1.0.13; python_version < '3.11'
|
tomli==2.0.2; python_version < '3.11'
|
||||||
pydantic==2.9.2
|
pydantic==2.9.2
|
||||||
eval_type_backport; python_version < '3.9'
|
eval_type_backport; python_version < '3.9'
|
||||||
typer-slim==0.12.5
|
typer-slim==0.12.5
|
||||||
|
|
|
@ -14,17 +14,7 @@ import typing
|
||||||
import logging
|
import logging
|
||||||
import pathlib
|
import pathlib
|
||||||
|
|
||||||
try:
|
from ..compat import tomllib
|
||||||
import tomllib
|
|
||||||
|
|
||||||
pytomlpp = None
|
|
||||||
USE_TOMLLIB = True
|
|
||||||
except ImportError:
|
|
||||||
import pytomlpp
|
|
||||||
|
|
||||||
tomllib = None
|
|
||||||
USE_TOMLLIB = False
|
|
||||||
|
|
||||||
|
|
||||||
__all__ = ['Config', 'UNSET', 'SchemaIssue']
|
__all__ = ['Config', 'UNSET', 'SchemaIssue']
|
||||||
|
|
||||||
|
@ -183,8 +173,6 @@ class Config:
|
||||||
|
|
||||||
|
|
||||||
def toml_load(file_name):
|
def toml_load(file_name):
|
||||||
if USE_TOMLLIB:
|
|
||||||
# Python >= 3.11
|
|
||||||
try:
|
try:
|
||||||
with open(file_name, "rb") as f:
|
with open(file_name, "rb") as f:
|
||||||
return tomllib.load(f)
|
return tomllib.load(f)
|
||||||
|
@ -192,13 +180,6 @@ def toml_load(file_name):
|
||||||
msg = str(exc).replace('\t', '').replace('\n', ' ')
|
msg = str(exc).replace('\t', '').replace('\n', ' ')
|
||||||
log.error("%s: %s", file_name, msg)
|
log.error("%s: %s", file_name, msg)
|
||||||
raise
|
raise
|
||||||
# fallback to pytomlpp for Python < 3.11
|
|
||||||
try:
|
|
||||||
return pytomlpp.load(file_name)
|
|
||||||
except pytomlpp.DecodeError as exc:
|
|
||||||
msg = str(exc).replace('\t', '').replace('\n', ' ')
|
|
||||||
log.error("%s: %s", file_name, msg)
|
|
||||||
raise
|
|
||||||
|
|
||||||
|
|
||||||
# working with dictionaries
|
# working with dictionaries
|
||||||
|
|
Loading…
Reference in a new issue