"...git@developer.sourcefind.cn:tianlh/lightgbm-dcu.git" did not exist on "011fe02487a13d33058fe922b08921c8a71081eb"
Unverified Commit b2d73dee authored by NovusEdge's avatar NovusEdge Committed by GitHub
Browse files

[python] added f-strings to docs/conf.py (#4147)



* Added f-strings to docs/conf.py

* fixed some linting errors

* fixed indent on 210:25

* YAF

* yet another try at fixing the linting

* Try: 1

* Try 2

* Update docs/conf.py
Co-authored-by: default avatarNikita Titov <nekit94-08@mail.ru>

* Update docs/conf.py
Co-authored-by: default avatarNikita Titov <nekit94-08@mail.ru>

* Update docs/conf.py
Co-authored-by: default avatarNikita Titov <nekit94-08@mail.ru>
Co-authored-by: default avatarNikita Titov <nekit94-08@mail.ru>
Co-authored-by: default avatarJames Lamb <jaylamb20@gmail.com>
parent 2885d3e0
......@@ -76,7 +76,7 @@ RTD = bool(os.environ.get('READTHEDOCS', ''))
# If your documentation needs a minimal Sphinx version, state it here.
needs_sphinx = '2.1.0' # Due to sphinx.ext.napoleon, autodoc_typehints
if needs_sphinx > sphinx.__version__:
message = 'This project needs at least Sphinx v%s' % needs_sphinx
message = f'This project needs at least Sphinx v{needs_sphinx}'
raise VersionRequirementError(message)
# Add any Sphinx extension module names here, as strings. They can be
......@@ -114,7 +114,7 @@ master_doc = 'index'
# General information about the project.
project = 'LightGBM'
copyright = '%s, Microsoft Corporation' % str(datetime.datetime.now().year)
copyright = f'{datetime.datetime.now().year}, Microsoft Corporation'
author = 'Microsoft Corporation'
# The name of an image file (relative to this directory) to place at the top
......@@ -206,10 +206,10 @@ def generate_doxygen_xml(app):
app : object
The application object representing the Sphinx process.
"""
input = os.path.join(CURR_PATH, os.path.pardir, 'include', 'LightGBM', 'c_api.h')
doxygen_args = [
"INPUT={}".format(os.path.join(CURR_PATH, os.path.pardir,
'include', 'LightGBM', 'c_api.h')),
"OUTPUT_DIRECTORY={}".format(os.path.join(CURR_PATH, 'doxyoutput')),
f"INPUT={input}",
f"OUTPUT_DIRECTORY={os.path.join(CURR_PATH, 'doxyoutput')}",
"GENERATE_HTML=NO",
"GENERATE_LATEX=NO",
"GENERATE_XML=YES",
......@@ -242,7 +242,7 @@ def generate_doxygen_xml(app):
else:
print(output)
except BaseException as e:
raise Exception("An error has occurred while executing Doxygen\n" + str(e))
raise Exception(f"An error has occurred while executing Doxygen\n{e}")
def generate_r_docs(app):
......@@ -253,7 +253,7 @@ def generate_r_docs(app):
app : object
The application object representing the Sphinx process.
"""
commands = """
commands = f"""
/home/docs/.conda/bin/conda create \
-q \
-y \
......@@ -268,10 +268,10 @@ def generate_r_docs(app):
r-roxygen2=7.1.1=r40h0357c0b_0
source /home/docs/.conda/bin/activate r_env
export TAR=/bin/tar
cd {0}
cd {os.path.join(CURR_PATH, os.path.pardir)}
export R_LIBS="$CONDA_PREFIX/lib/R/library"
Rscript build_r.R || exit -1
cd {1}
cd {os.path.join(CURR_PATH, os.path.pardir, "lightgbm_r")}
Rscript -e "roxygen2::roxygenize(load = 'installed')" || exit -1
Rscript -e "pkgdown::build_site( \
lazy = FALSE \
......@@ -284,8 +284,8 @@ def generate_r_docs(app):
, new_process = TRUE \
)
" || exit -1
cd {0}
""".format(os.path.join(CURR_PATH, os.path.pardir), os.path.join(CURR_PATH, os.path.pardir, "lightgbm_r"))
cd {os.path.join(CURR_PATH, os.path.pardir)}
"""
try:
# Warning! The following code can cause buffer overflows on RTD.
# Consider suppressing output completely if RTD project silently fails.
......@@ -301,7 +301,7 @@ def generate_r_docs(app):
else:
print(output)
except BaseException as e:
raise Exception("An error has occurred while generating documentation for R-package\n" + str(e))
raise Exception(f"An error has occurred while generating documentation for R-package\n{e}")
def setup(app):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment