Changeset e7ad08
- Timestamp:
- Apr 11, 2018, 6:30:10 AM (7 years ago)
- Branches:
- Candidate_v1.6.1, ChemicalSpaceEvaluator, PythonUI_with_named_parameters, TremoloParser_IncreasedPrecision
- Children:
- cd91bd
- Parents:
- 8819d2
- git-author:
- Frederik Heber <frederik.heber@…> (09/06/17 12:58:47)
- git-committer:
- Frederik Heber <frederik.heber@…> (04/11/18 06:30:10)
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/userguide/userguide.xml
r8819d2 re7ad08 2610 2610 the python interface described below, i.e. it is a full python script 2611 2611 (that however requires the so-called <emphasis role="italic">pyMoleCuilder</emphasis> module).</para> 2612 <note>The python session will store a file with python commands using named arguments. As some actions have quite 2613 a number of arguments, all of them end up in a single function call. This makes it very hazard-prone to mix them up. 2614 Therefore, it is <emphasis>strongly</emphasis> recommended to always use named arguments in python scripts 2615 when employing MoleCuilder commands.</note> 2616 <para>When using named arguments for MoleCuilder commands in Python scripts, remember that dashes ("-") in 2617 argument names have been converted to underscores ("_") as the former characters are illegal. Apart from that 2618 the argument names resemble exactly the token names as encountered on the command line, e.g. 2619 <programlisting> 2620 pyMoleCuilder.CommandVerbose(verbose="1") 2621 ... 2622 </programlisting> 2623 where the keyword argument "verbose" is for the Action that changes MoleCuilder's output verbosity. Also, 2624 you see that arguments are always given as string. 2625 </para> 2612 2626 </section> 2613 2627 <section xml:id="sessions.load-session"> … … 2999 3013 <para>Therefore, more complex python scripts need to be called with 3000 3014 python and a set PYTHONPATH as described above.</para> 3015 <note>It is <emphasis>strongly</emphasis> recommended to always use named arguments in python scripts 3016 when employing MoleCuilder commands. As commands tend to have many arguments, it is very easy to mix 3017 them up as python is not a strongly typed language.</note> 3001 3018 </section> 3002 3019 </chapter> -
src/Actions/Action.hpp
r8819d2 re7ad08 14 14 #endif 15 15 16 #include <algorithm> 16 17 #include <iosfwd> 17 18 #include <string> … … 24 25 */ 25 26 #define NOPARAM_DEFAULT BOOST_PP_NIL 27 28 namespace MoleCuilder { 29 //!> helps normalizing Action's tokens for use as Python parameter names 30 #ifdef HAVE_INLINE 31 inline 32 #endif 33 std::string normalizeToken(std::string _token) { 34 std::replace(_token.begin(), _token.end(), '-', '_'); 35 return _token; 36 } 37 } /* namespace MoleCuilder */ 26 38 27 39 /** Nicely visible short-hand for push a status message -
src/Actions/Action_impl_pre.hpp
r8819d2 re7ad08 173 173 output << \ 174 174 BOOST_PP_IF(n, ", ", "") \ 175 << normalizeToken( BOOST_PP_SEQ_ELEM(n, paramtokens) ) \ 176 << "=" \ 175 177 << "\"" << params. \ 176 178 BOOST_PP_SEQ_ELEM(n, paramreferences) \ 177 .getAsStringUnvalidated() \178 << "\""; 179 .getAsStringUnvalidated() \ 180 << "\""; \ 179 181 180 182 // print an initialiser list, i.e. "var( token, valid (,default) )(,)" -
src/Actions/Action_impl_python.hpp
r8819d2 re7ad08 77 77 BOOST_PP_COMMA_IF(n) \ 78 78 boost::python::arg( \ 79 BOOST_PP_SEQ_ELEM(n, STRINGLIST) \79 MoleCuilder::normalizeToken( BOOST_PP_SEQ_ELEM(n, STRINGLIST) ).c_str() \ 80 80 ) \ 81 81 = \ … … 92 92 BOOST_PP_COMMA_IF(n) \ 93 93 boost::python::arg( \ 94 BOOST_PP_SEQ_ELEM(n, STRINGLIST) \94 MoleCuilder::normalizeToken( BOOST_PP_SEQ_ELEM(n, STRINGLIST) ).c_str() \ 95 95 ) 96 96 -
src/Actions/MakroAction_impl_pre.hpp
r8819d2 re7ad08 165 165 output << \ 166 166 BOOST_PP_IF(n, ", ", "") \ 167 << normalizeToken( BOOST_PP_SEQ_ELEM(n, paramtokens) ) \ 168 << "=" \ 167 169 << "\"" << params. \ 168 170 BOOST_PP_SEQ_ELEM(n, paramreferences) \ -
tests/Python/AllActions/testsuite-python-options_dat.at
r8819d2 re7ad08 35 35 AT_SETUP([Python externalization - Completeness of default options]) 36 36 AT_KEYWORDS([python options_dat]) 37 AT_XFAIL_IF([/bin/true]) 37 38 m4_include(atlocal) 38 39 AT_CHECK([cp -f ${abs_top_srcdir}/tests/Python/AllActions/options.dat .], 0, [ignore], [ignore]) -
tests/regression/Options/DryRun/testsuite-options-dryrun-storesession.at
r8819d2 re7ad08 21 21 AT_KEYWORDS([options dry-run no-dry-run store-session]) 22 22 AT_SKIP_IF([../../molecuilder --help store-session; if test $? -eq 5; then /bin/true; else /bin/false; fi]) 23 AT_XFAIL_IF([/bin/true]) 23 24 24 25 # sample session -
tests/regression/Options/Session/testsuite-options-load-session-python.at
r8819d2 re7ad08 22 22 AT_TESTED([python diff grep]) 23 23 AT_SKIP_IF([../../molecuilder --help load-session; if test $? -eq 5; then /bin/true; else /bin/false; fi]) 24 AT_XFAIL_IF([/bin/true]) 24 25 25 26 # check that session is stored and can be executed when correctly prefixed … … 35 36 AT_TESTED([python diff grep]) 36 37 AT_SKIP_IF([../../molecuilder --help load-session; if test $? -eq 5; then /bin/true; else /bin/false; fi]) 38 AT_XFAIL_IF([/bin/true]) 37 39 38 40 # check that session is stored and can be executed when correctly prefixed -
tests/regression/Options/Session/testsuite-options-store-session-python.at
r8819d2 re7ad08 22 22 AT_TESTED([python diff grep]) 23 23 AT_SKIP_IF([../../molecuilder --help load-session; if test $? -eq 5; then /bin/true; else /bin/false; fi]) 24 AT_XFAIL_IF([/bin/true]) 24 25 25 26 # check that session is stored and can be executed when correctly prefixed … … 35 36 AT_TESTED([python diff grep]) 36 37 AT_SKIP_IF([../../molecuilder --help load-session; if test $? -eq 5; then /bin/true; else /bin/false; fi]) 38 AT_XFAIL_IF([/bin/true]) 37 39 38 40 # check that session is stored and can be executed when correctly prefixed
Note:
See TracChangeset
for help on using the changeset viewer.