| 1366 | } |
| 1367 | |
| 1368 | std::optional<std::string> mitk::nnInteractiveTool::GetModelLicense() const |
| 1369 | { |
| 1370 | if (!this->IsSessionRunning()) |
| 1371 | return std::nullopt; |
| 1372 | |
| 1373 | try |
| 1374 | { |
| 1375 | auto pythonContext = m_Impl->GetPythonContext(); |
| 1376 | |
| 1377 | // session.license is a cached attribute on both local and remote sessions |
| 1378 | // (the remote one reads it from the server's /capabilities during |
| 1379 | // construction), so this is a plain local attribute read: no network call |
| 1380 | // and no remote guard needed. |
| 1381 | pythonContext->Execute("nni_license = getattr(session, 'license', None) or ''\n"); |
| 1382 | const auto license = pythonContext->GetVariableAsString("nni_license").value_or(""); |
| 1383 | pythonContext->Execute("del nni_license\n"); |
| 1384 | |
| 1385 | if (license.empty()) |
| 1386 | return std::nullopt; |
| 1387 | |
| 1388 | return license; |
| 1389 | } |
| 1390 | catch (const Exception& e) |
| 1391 | { |
| 1392 | MITK_WARN << "nnInteractive: could not read the model license: " << e.GetDescription(); |
| 1393 | return std::nullopt; |
| 1394 | } |
| 1395 | } |
| 1396 | |
| 1397 | bool mitk::nnInteractiveTool::SupportsUndo() const |
| 1398 | { |
no test coverage detected