Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wangsen
MinerU
Commits
b34c8cb0
"tests/vscode:/vscode.git/clone" did not exist on "d6bf268a4ad71443f975923126ff1f5157b30ecb"
Commit
b34c8cb0
authored
Jun 12, 2025
by
myhloli
Browse files
fix: handle None config cases in configuration retrieval functions
parent
76259a80
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
mineru/utils/config_reader.py
mineru/utils/config_reader.py
+9
-3
No files found.
mineru/utils/config_reader.py
View file @
b34c8cb0
...
@@ -17,7 +17,7 @@ def read_config():
...
@@ -17,7 +17,7 @@ def read_config():
config_file
=
os
.
path
.
join
(
home_dir
,
CONFIG_FILE_NAME
)
config_file
=
os
.
path
.
join
(
home_dir
,
CONFIG_FILE_NAME
)
if
not
os
.
path
.
exists
(
config_file
):
if
not
os
.
path
.
exists
(
config_file
):
logger
.
warning
(
f
'
{
config_file
}
not found, using default configuration'
)
#
logger.warning(f'{config_file} not found, using default configuration')
return
None
return
None
else
:
else
:
with
open
(
config_file
,
'r'
,
encoding
=
'utf-8'
)
as
f
:
with
open
(
config_file
,
'r'
,
encoding
=
'utf-8'
)
as
f
:
...
@@ -106,7 +106,9 @@ def get_formula_config():
...
@@ -106,7 +106,9 @@ def get_formula_config():
def
get_latex_delimiter_config
():
def
get_latex_delimiter_config
():
config
=
read_config
()
config
=
read_config
()
latex_delimiter_config
=
config
.
get
(
'latex-delimiter-config'
)
if
config
is
None
:
return
None
latex_delimiter_config
=
config
.
get
(
'latex-delimiter-config'
,
None
)
if
latex_delimiter_config
is
None
:
if
latex_delimiter_config
is
None
:
# logger.warning(f"'latex-delimiter-config' not found in {CONFIG_FILE_NAME}, use 'None' as default")
# logger.warning(f"'latex-delimiter-config' not found in {CONFIG_FILE_NAME}, use 'None' as default")
return
None
return
None
...
@@ -116,7 +118,9 @@ def get_latex_delimiter_config():
...
@@ -116,7 +118,9 @@ def get_latex_delimiter_config():
def
get_llm_aided_config
():
def
get_llm_aided_config
():
config
=
read_config
()
config
=
read_config
()
llm_aided_config
=
config
.
get
(
'llm-aided-config'
)
if
config
is
None
:
return
None
llm_aided_config
=
config
.
get
(
'llm-aided-config'
,
None
)
if
llm_aided_config
is
None
:
if
llm_aided_config
is
None
:
# logger.warning(f"'llm-aided-config' not found in {CONFIG_FILE_NAME}, use 'None' as default")
# logger.warning(f"'llm-aided-config' not found in {CONFIG_FILE_NAME}, use 'None' as default")
return
None
return
None
...
@@ -126,6 +130,8 @@ def get_llm_aided_config():
...
@@ -126,6 +130,8 @@ def get_llm_aided_config():
def
get_local_models_dir
():
def
get_local_models_dir
():
config
=
read_config
()
config
=
read_config
()
if
config
is
None
:
return
None
models_dir
=
config
.
get
(
'models-dir'
)
models_dir
=
config
.
get
(
'models-dir'
)
if
models_dir
is
None
:
if
models_dir
is
None
:
logger
.
warning
(
f
"'models-dir' not found in
{
CONFIG_FILE_NAME
}
, use None as default"
)
logger
.
warning
(
f
"'models-dir' not found in
{
CONFIG_FILE_NAME
}
, use None as default"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment