Skip to content
Snippets Groups Projects
Commit de42fbfb authored by Mikhail Svechnikov's avatar Mikhail Svechnikov
Browse files

only header in codeHeader

parent 6f782e0c
No related branches found
No related tags found
1 merge request!2720Avoid duplication of header in generated script
Pipeline #158030 passed
......@@ -20,12 +20,13 @@
std::string Py::Export::codeHeader(const std::string& code)
{
return "import bornagain as ba\n" + Py::Fmt::printImportedSymbols(code) + "\n\n" + code;
return "import bornagain as ba\n" + Py::Fmt::printImportedSymbols(code) + "\n\n";
}
std::string Py::Export::sampleCode(const MultiLayer& sample)
{
return Py::Export::codeHeader(SampleToPython().sampleCode(sample));
std::string sample_code = SampleToPython().sampleCode(sample);
return Py::Export::codeHeader(sample_code) + sample_code;
}
std::string Py::Export::simulationPlotCode(const ISimulation& simulation)
......
......@@ -368,7 +368,7 @@ std::string simulationCode(const ISimulation& simulation)
ASSERT(simulation.sample());
std::string code =
SampleToPython().sampleCode(*simulation.sample()) + defineSimulate(simulation);
return Py::Export::codeHeader(code);
return Py::Export::codeHeader(code) + code;
}
} // namespace
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment