( pyRelPath: string, pythonMajor: number, pythonMinor: number )
| 94 | * Returns `null` if the input is not a `.py` file. |
| 95 | */ |
| 96 | export function derivePycPath( |
| 97 | pyRelPath: string, |
| 98 | pythonMajor: number, |
| 99 | pythonMinor: number |
| 100 | ): string | null { |
| 101 | if (!pyRelPath.endsWith('.py')) return null; |
| 102 | |
| 103 | const lastSlash = pyRelPath.lastIndexOf('/'); |
| 104 | const dir = lastSlash === -1 ? '' : pyRelPath.slice(0, lastSlash + 1); |
| 105 | const baseName = pyRelPath.slice(lastSlash + 1, -3); // strip ".py" |
| 106 | |
| 107 | return `${dir}__pycache__/${baseName}.cpython-${pythonMajor}${pythonMinor}.pyc`; |
| 108 | } |
| 109 | |
| 110 | export interface BytecodeCollectionResult { |
| 111 | /** FileFsRef entries for .pyc files, keyed by bundle-relative path. */ |
no outgoing calls
no test coverage detected