(text)
| 533 | } |
| 534 | |
| 535 | function extractSessionMetadata(text) { |
| 536 | const source = String(text || ''); |
| 537 | const readValue = (label) => { |
| 538 | const match = source.match(new RegExp('^> - \\*\\*' + label + ':\\*\\*\\s+(.+?)\\s*$', 'm')); |
| 539 | return match ? match[1].replace(/`/g, '').trim() : ''; |
| 540 | }; |
| 541 | return { |
| 542 | sessionId: readValue('Session ID'), |
| 543 | started: readValue('Started'), |
| 544 | duration: readValue('Duration'), |
| 545 | exported: readValue('Exported') |
| 546 | }; |
| 547 | } |
| 548 | |
| 549 | function looksLikePython(text) { |
| 550 | return /(from\s+[A-Za-z0-9_\.]+\s+import\s+|import\s+[A-Za-z0-9_\.]+|async\s+def\s+|def\s+[A-Za-z_][A-Za-z0-9_]*\s*\(|class\s+[A-Za-z_][A-Za-z0-9_]*\s*[(:]|asyncio\.run\(|await\s+[A-Za-z_][A-Za-z0-9_\.]*\(|if\s+__name__\s*==\s*['"]__main__['"])/m.test(String(text || '')); |
no test coverage detected