Convert something as 'file1.py' at line 10 to ' ' at line 2. Note that the name should be already normalized at this point.
(self, absolute_filename, lineno)
| 118 | return self._cache[key] |
| 119 | |
| 120 | def map_to_server(self, absolute_filename, lineno): |
| 121 | """ |
| 122 | Convert something as 'file1.py' at line 10 to '<ipython-cell-xxx>' at line 2. |
| 123 | |
| 124 | Note that the name should be already normalized at this point. |
| 125 | """ |
| 126 | absolute_normalized_filename = pydevd_file_utils.normcase(absolute_filename) |
| 127 | |
| 128 | changed = False |
| 129 | mappings = self._mappings_to_server.get(absolute_normalized_filename) |
| 130 | if mappings: |
| 131 | i = bisect.bisect(KeyifyList(mappings, lambda entry: entry.line), lineno) |
| 132 | if i >= len(mappings): |
| 133 | i -= 1 |
| 134 | |
| 135 | if i == 0: |
| 136 | entry = mappings[i] |
| 137 | |
| 138 | else: |
| 139 | entry = mappings[i - 1] |
| 140 | |
| 141 | if not entry.contains_line(lineno): |
| 142 | entry = mappings[i] |
| 143 | if not entry.contains_line(lineno): |
| 144 | entry = None |
| 145 | |
| 146 | if entry is not None: |
| 147 | lineno = entry.runtime_line + (lineno - entry.line) |
| 148 | |
| 149 | absolute_filename = entry.runtime_source |
| 150 | changed = True |
| 151 | |
| 152 | return absolute_filename, lineno, changed |