| 759 | } |
| 760 | |
| 761 | PyObject* ApplicationPy::sGetImportType(PyObject* /*self*/, PyObject* args) |
| 762 | { |
| 763 | char* psKey = nullptr; |
| 764 | |
| 765 | if (!PyArg_ParseTuple(args, "|s", &psKey)) { |
| 766 | return nullptr; |
| 767 | } |
| 768 | |
| 769 | if (psKey) { |
| 770 | Py::List list; |
| 771 | std::vector<std::string> modules = GetApplication().getImportModules(psKey); |
| 772 | for (const auto& it : modules) { |
| 773 | list.append(Py::String(it)); |
| 774 | } |
| 775 | |
| 776 | return Py::new_reference_to(list); |
| 777 | } |
| 778 | |
| 779 | Py::Dict dict; |
| 780 | std::vector<std::string> types = GetApplication().getImportTypes(); |
| 781 | for (const auto& it : types) { |
| 782 | std::vector<std::string> modules = GetApplication().getImportModules(it.c_str()); |
| 783 | if (modules.empty()) { |
| 784 | dict.setItem(it.c_str(), Py::None()); |
| 785 | } |
| 786 | else if (modules.size() == 1) { |
| 787 | dict.setItem(it.c_str(), Py::String(modules.front())); |
| 788 | } |
| 789 | else { |
| 790 | Py::List list; |
| 791 | for (const auto& jt : modules) { |
| 792 | list.append(Py::String(jt)); |
| 793 | } |
| 794 | dict.setItem(it.c_str(), list); |
| 795 | } |
| 796 | } |
| 797 | |
| 798 | return Py::new_reference_to(dict); |
| 799 | } |
| 800 | |
| 801 | PyObject* ApplicationPy::sAddExportType(PyObject* /*self*/, PyObject* args) |
| 802 | { |
nothing calls this directly
no test coverage detected