From 2e735738d34b7329e3f7c20992d2f9c540818dff Mon Sep 17 00:00:00 2001 From: Roberto Di Remigio Date: Sat, 6 Jan 2018 23:18:21 +0100 Subject: [PATCH] Add docstring for functions in export_psio --- .scripts/travis_print_failing.py | 4 +- psi4/src/export_psio.cc | 52 +++++++++---------- psi4/src/psi4/libpsio/psio.hpp | 2 +- tests/CMakeLists.txt | 3 +- tests/fcidump/CMakeLists.txt | 3 -- tests/python/CMakeLists.txt | 1 + tests/python/fcidump/CMakeLists.txt | 3 ++ .../{ => python}/fcidump/Ne.6311G.INTDUMP.ref | 0 tests/{ => python}/fcidump/input.py | 0 9 files changed, 32 insertions(+), 36 deletions(-) delete mode 100644 tests/fcidump/CMakeLists.txt create mode 100644 tests/python/fcidump/CMakeLists.txt rename tests/{ => python}/fcidump/Ne.6311G.INTDUMP.ref (100%) rename tests/{ => python}/fcidump/input.py (100%) diff --git a/.scripts/travis_print_failing.py b/.scripts/travis_print_failing.py index e9009d10f33..51c47974e3c 100755 --- a/.scripts/travis_print_failing.py +++ b/.scripts/travis_print_failing.py @@ -1,8 +1,6 @@ #!/usr/bin/env python import re import sys -import time -import subprocess badtests = [] @@ -24,7 +22,7 @@ sys.stdout.write("""\n\n%s failed. Here is the output:\n""" % (bad)) badoutfile = bad - for oddity in ['pcmsolver', 'cfour', 'libefp', 'chemps2', 'dftd3', 'mrcc', 'psi4numpy', + for oddity in ['pcmsolver', 'cfour', 'libefp', 'chemps2', 'dftd3', 'mrcc', 'psi4numpy', 'python', 'cookbook', 'dkh', 'erd', 'gcp', 'gdma', 'simint', 'snsmp2', 'v2rdm_casscf']: if bad.startswith(oddity): badoutfile = oddity + '/' + bad diff --git a/psi4/src/export_psio.cc b/psi4/src/export_psio.cc index f36b53ea833..f4611f2153a 100644 --- a/psi4/src/export_psio.cc +++ b/psi4/src/export_psio.cc @@ -34,34 +34,32 @@ using namespace psi; void export_psio(py::module &m) { py::class_ >(m, "IO", "docstring") - .def("state", &PSIO::state, "docstring") - .def("open", &PSIO::open, "docstring") - .def("close", &PSIO::close, "docstring") - .def("rehash", &PSIO::rehash, "docstring") - .def("open_check", &PSIO::open_check, "docstring") - .def("tocclean", &PSIO::tocclean, - "Delete all TOC entries after the given key. If a blank key is given, the entire TOC will be wiped") + .def("state", &PSIO::state, "Return 1 if PSIO library is activated") + .def("open", &PSIO::open, "Open unit. Status can be PSIO_OPEN_OLD (if existing file is to be opened) or PSIO_OPEN_NEW if new file should be open", py::arg("unit"), py::arg("status")) + .def("close", &PSIO::close, "Close unit. If keep == 0, will remove the file, else keep it", py::arg("unit"), py::arg("keep")) + .def("rehash", &PSIO::rehash, "Sync up the object to the file on disk by closing and opening the file, if necessary", py::arg("unit")) + .def("open_check", &PSIO::open_check, "Return 1 if unit is open", py::arg("unit")) + .def("tocclean", &PSIO::tocclean, "Delete all TOC entries after the given key. If a blank key is given, the entire TOC will be wiped", py::arg("unit"), py::arg("key")) .def("tocprint", &PSIO::tocprint, "Print the table of contents for the given unit") - .def("tocentry_exists", &PSIO::tocentry_exists, - "Checks the TOC to see if a particular keyword exists there or not") + .def("tocentry_exists", &PSIO::tocentry_exists, "Checks the TOC to see if a particular keyword exists there or not") .def("tocwrite", &PSIO::tocwrite, "Write the table of contents for passed file number") - .def("set_pid", &PSIO::set_pid, "docstring") - .def_static("shared_object", &PSIO::shared_object, "docstring") - .def_static("get_default_namespace", &PSIO::get_default_namespace, "docstring") - .def_static("set_default_namespace", &PSIO::set_default_namespace, py::arg("ns"), "docstring") - .def_static("change_file_namespace", &PSIO::change_file_namespace, py::arg("fileno"), py::arg("ns1"), - py::arg("ns2"), "docstring"); + .def("getpid", &PSIO::getpid, "Lookup process id") + .def("set_pid", &PSIO::set_pid, "Set process id", py::arg("pid")) + .def_static("shared_object", &PSIO::shared_object, "Return the global shared object") + .def_static("get_default_namespace", &PSIO::get_default_namespace, "Get the default namespace (for PREFIX.NAMESPACE.UNIT file numbering)") + .def_static("set_default_namespace", &PSIO::set_default_namespace, "Set the current namespace (for PREFIX.NAMESPACE.UNIT file numbering)", py::arg("ns")) + .def_static("change_file_namespace", &PSIO::change_file_namespace, "Change file number from ns1 to ns2", py::arg("fileno"), py::arg("ns1"), py::arg("ns2")); - py::class_ >(m, "IOManager", "docstring") - .def_static("shared_object", &PSIOManager::shared_object, "docstring") - .def("print_out", &PSIOManager::print_out, "docstring") - .def("psiclean", &PSIOManager::psiclean, "docstring") - .def("crashclean", &PSIOManager::crashclean, "docstring") - .def("mark_file_for_retention", &PSIOManager::mark_file_for_retention, "docstring") - .def("write_scratch_file", &PSIOManager::write_scratch_file, "docstring") - .def("set_default_path", &PSIOManager::set_default_path, "docstring") - .def("set_specific_path", &PSIOManager::set_specific_path, "docstring") - .def("get_file_path", &PSIOManager::get_file_path, "docstring") - .def("set_specific_retention", &PSIOManager::set_specific_retention, "docstring") - .def("get_default_path", &PSIOManager::get_default_path, "docstring"); + py::class_ >(m, "IOManager", "PSIOManager is a class designed to be used as a static object to track all PSIO operations in a given PSI4 computation") + .def_static("shared_object", &PSIOManager::shared_object, "The one and (should be) only instance of PSIOManager for a PSI4 instance") + .def("print_out", &PSIOManager::print_out, "Print the current status of PSI4 files") + .def("psiclean", &PSIOManager::psiclean, "Execute the psiclean protocol, deleting all recorded files, except those currently marked for retention") + .def("crashclean", &PSIOManager::crashclean, "Clean from disk-mirrored image after crash. NOT to be called during regular computation.") + .def("mark_file_for_retention", &PSIOManager::mark_file_for_retention, "Mark a file to be retained after a psiclean operation, ie for use in a later computation", py::arg("full_path"), py::arg("retain")) + .def("write_scratch_file", &PSIOManager::write_scratch_file, "Write a string to a temporary file. The scratch file is opened and closed by this function.", py::arg("full_path"), py::arg("text")) + .def("set_default_path", &PSIOManager::set_default_path, "Set the default path for files to be stored", py::arg("path")) + .def("set_specific_path", &PSIOManager::set_specific_path, "Set the path for specific file numbers", py::arg("fileno"), py::arg("path")) + .def("get_file_path", &PSIOManager::get_file_path, "Get the path for a specific file number", py::arg("fileno")) + .def("set_specific_retention", &PSIOManager::set_specific_retention, "Set the specific file number to be retained", py::arg("fileno"), py::arg("retain")) + .def("get_default_path", &PSIOManager::get_default_path, "Return the default path"); } diff --git a/psi4/src/psi4/libpsio/psio.hpp b/psi4/src/psi4/libpsio/psio.hpp index 6460ac5301b..1f8d6252485 100644 --- a/psi4/src/psi4/libpsio/psio.hpp +++ b/psi4/src/psi4/libpsio/psio.hpp @@ -93,7 +93,7 @@ class PSIOManager { */ void set_specific_path(int fileno, const std::string& path); /** - * Set the the specific file number to be retained + * Set the specific file number to be retained * \param fileno PSI4 file number * \param retain keep or not? (Allows override) */ diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 5b9c54c5ca3..a769f77e8b3 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -57,8 +57,7 @@ foreach(test_name adc1 adc2 casscf-fzc-sp casscf-semi casscf-sa-sp ao-casscf-sp dft-freq dft-grad1 dft-grad2 dft-psivar dft-b3lyp dft1 dft-vv10 dft1-alt dft2 dft3 dft-omega docs-bases docs-dft extern1 extern2 fsapt1 fsapt2 fsapt-terms fsapt-allterms isapt1 isapt2 - fci-dipole fci-h2o fci-h2o-2 fci-h2o-fzcv fci-tdm fci-tdm-2 - fci-coverage fcidump + fci-dipole fci-h2o fci-h2o-2 fci-h2o-fzcv fci-tdm fci-tdm-2 fci-coverage fd-freq-energy fd-freq-energy-large fd-freq-gradient fd-freq-gradient-large fd-gradient freq-isotope fnocc1 fnocc2 fnocc3 fnocc4 frac frac-ip-fitting frac-traverse ghosts gibbs matrix1 diff --git a/tests/fcidump/CMakeLists.txt b/tests/fcidump/CMakeLists.txt deleted file mode 100644 index bea2fcab85b..00000000000 --- a/tests/fcidump/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -include(TestingMacros) - -add_regression_test(fcidump "psi;smoketests;fcidump") diff --git a/tests/python/CMakeLists.txt b/tests/python/CMakeLists.txt index b46eb20a11d..1e005946fb8 100644 --- a/tests/python/CMakeLists.txt +++ b/tests/python/CMakeLists.txt @@ -6,3 +6,4 @@ add_subdirectory(mints2) add_subdirectory(cc54) add_subdirectory(3-index-transforms) add_subdirectory(JK_builds) +add_subdirectory(fcidump) diff --git a/tests/python/fcidump/CMakeLists.txt b/tests/python/fcidump/CMakeLists.txt new file mode 100644 index 00000000000..00f4f220534 --- /dev/null +++ b/tests/python/fcidump/CMakeLists.txt @@ -0,0 +1,3 @@ +include(TestingMacros) + +add_regression_test(python-fcidump "psi;quicktests;smoketests;fcidump;python") diff --git a/tests/fcidump/Ne.6311G.INTDUMP.ref b/tests/python/fcidump/Ne.6311G.INTDUMP.ref similarity index 100% rename from tests/fcidump/Ne.6311G.INTDUMP.ref rename to tests/python/fcidump/Ne.6311G.INTDUMP.ref diff --git a/tests/fcidump/input.py b/tests/python/fcidump/input.py similarity index 100% rename from tests/fcidump/input.py rename to tests/python/fcidump/input.py