diff --git a/doc/check_names.py b/doc/check_names.py new file mode 100644 index 00000000..6a6db356 --- /dev/null +++ b/doc/check_names.py @@ -0,0 +1,45 @@ +# Generate the routines divide by slicot-chapters for sphinx-doc. +# Only prints out the names, copy & past them into slycot_outer.rst and slycot_inner.rst. +import re +import pandas as pd +import warnings + +import slycot +slycot.__version__ + +def get_slycot_routines(sly): + all_attributes = dir(sly) + r = re.compile("[a-z][a-z][0-9][0-9a-z][a-z][a-z]") + matched_attributes = list(filter(r.match, all_attributes)) + return matched_attributes + +def get_slycot_routines_help(file,pre=""): + textfile = open(file, 'r') + filetext = textfile.read() + textfile.close() + lines = filetext.split("\n") + res = [ele.replace(" ","") for ele in lines] + res = [ele.replace("_wrapper.","") for ele in res] + + r = re.compile("[a-z][a-z][0-9][0-9a-z][a-z][a-z]") + matched_attributes = list(filter(r.match, res)) + return matched_attributes + +slycot_wrapper = get_slycot_routines(slycot) +slycot_wrapper.sort() +slycot_f2py_wrapper = get_slycot_routines(slycot._wrapper) +slycot_f2py_wrapper.sort() + +slycot_wrapper_help = get_slycot_routines_help("source/reference/slycot_outer.rst") +slycot_wrapper_help.sort() + +slycot_f2py_wrapper_help = get_slycot_routines_help("source/reference/slycot_inner.rst") +slycot_f2py_wrapper_help.sort() + +missing = list(set(slycot_wrapper) - set(slycot_wrapper_help)) +if bool(missing): + warnings.warn(f"The routines {missing} are missing in 'slycot_outer.rst'.") + +missing = list(set(slycot_f2py_wrapper) - set(slycot_f2py_wrapper_help)) +if bool(missing): + warnings.warn(f"The routines _wrapper.{missing} are missing in 'slycot_inner.rst'.") \ No newline at end of file diff --git a/doc/conf.py b/doc/conf.py index 6db89d89..2938ea5a 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -10,6 +10,9 @@ import sys sys.path.insert(0, os.path.abspath('../slycot')) +import subprocess +subprocess.run(["python", "check_names.py"]) + project = 'Slycot' copyright = '2023, Slycot Developers' author = 'Slycot Developers' @@ -25,6 +28,7 @@ print("version %s, release %s" % (version, release)) + # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration