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
tianlh
LightGBM-DCU
Commits
035a6cd5
Unverified
Commit
035a6cd5
authored
Jul 04, 2021
by
Nikita Titov
Committed by
GitHub
Jul 04, 2021
Browse files
[python] migrate to pathlib in helper scripts (#4434)
parent
b699fa68
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
11 deletions
+11
-11
helpers/check_dynamic_dependencies.py
helpers/check_dynamic_dependencies.py
+2
-2
helpers/parameter_generator.py
helpers/parameter_generator.py
+9
-9
No files found.
helpers/check_dynamic_dependencies.py
View file @
035a6cd5
...
...
@@ -5,6 +5,7 @@ This script checks that LightGBM library is linked to the appropriate symbol ver
"""
import
re
import
sys
from
pathlib
import
Path
def
check_dependicies
(
objdump_string
:
str
)
->
None
:
...
...
@@ -39,5 +40,4 @@ def check_dependicies(objdump_string: str) -> None:
if
__name__
==
"__main__"
:
with
open
(
sys
.
argv
[
1
],
'r'
)
as
f
:
check_dependicies
(
f
.
read
())
check_dependicies
(
Path
(
sys
.
argv
[
1
]).
read_text
(
encoding
=
'utf-8'
))
helpers/parameter_generator.py
View file @
035a6cd5
...
...
@@ -6,7 +6,7 @@ with list of all parameters, aliases table and other routines
along with parameters description in LightGBM/docs/Parameters.rst file
from the information in LightGBM/include/LightGBM/config.h file.
"""
import
os
from
pathlib
import
Path
def
get_parameter_infos
(
config_hpp
):
...
...
@@ -14,7 +14,7 @@ def get_parameter_infos(config_hpp):
Parameters
----------
config_hpp :
string
config_hpp :
pathlib.Path
Path to the config header file.
Returns
...
...
@@ -198,7 +198,7 @@ def gen_parameter_description(sections, descriptions, params_rst):
Names of parameters sections.
descriptions : list
Structured descriptions of parameters.
params_rst :
string
params_rst :
pathlib.Path
Path to the file with parameters documentation.
"""
params_to_write
=
[]
...
...
@@ -256,9 +256,9 @@ def gen_parameter_code(config_hpp, config_out_cpp):
Parameters
----------
config_hpp :
string
config_hpp :
pathlib.Path
Path to the config header file.
config_out_cpp :
string
config_out_cpp :
pathlib.Path
Path to the auto config file.
Returns
...
...
@@ -339,9 +339,9 @@ def gen_parameter_code(config_hpp, config_out_cpp):
if
__name__
==
"__main__"
:
current_dir
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
__file__
)
)
config_hpp
=
os
.
path
.
join
(
current_dir
,
os
.
path
.
pardir
,
'include'
,
'LightGBM'
,
'config.h'
)
config_out_cpp
=
os
.
path
.
join
(
current_dir
,
os
.
path
.
pardir
,
'src'
,
'io'
,
'config_auto.cpp'
)
params_rst
=
os
.
path
.
join
(
current_dir
,
os
.
path
.
pardir
,
'docs'
,
'Parameters.rst'
)
current_dir
=
Path
(
__file__
).
parent
.
absolute
(
)
config_hpp
=
current_dir
.
parent
/
'include'
/
'LightGBM'
/
'config.h'
config_out_cpp
=
current_dir
.
parent
/
'src'
/
'io'
/
'config_auto.cpp'
params_rst
=
current_dir
.
parent
/
'docs'
/
'Parameters.rst'
sections
,
descriptions
=
gen_parameter_code
(
config_hpp
,
config_out_cpp
)
gen_parameter_description
(
sections
,
descriptions
,
params_rst
)
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