l(ist) [first[, last] | .] List source code for the current file. Without arguments, list 11 lines around the current line or continue the previous listing. With . as argument, list 11 lines around the current line. With one argument, list 11 lines starting at tha
(self, arg)
| 2160 | complete_pp = _complete_expression |
| 2161 | |
| 2162 | def do_list(self, arg): |
| 2163 | """l(ist) [first[, last] | .] |
| 2164 | |
| 2165 | List source code for the current file. Without arguments, |
| 2166 | list 11 lines around the current line or continue the previous |
| 2167 | listing. With . as argument, list 11 lines around the current |
| 2168 | line. With one argument, list 11 lines starting at that line. |
| 2169 | With two arguments, list the given range; if the second |
| 2170 | argument is less than the first, it is a count. |
| 2171 | |
| 2172 | The current line in the current frame is indicated by "->". |
| 2173 | If an exception is being debugged, the line where the |
| 2174 | exception was originally raised or propagated is indicated by |
| 2175 | ">>", if it differs from the current line. |
| 2176 | """ |
| 2177 | self.lastcmd = 'list' |
| 2178 | last = None |
| 2179 | if arg and arg != '.': |
| 2180 | try: |
| 2181 | if ',' in arg: |
| 2182 | first, last = arg.split(',') |
| 2183 | first = int(first.strip()) |
| 2184 | last = int(last.strip()) |
| 2185 | if last < first: |
| 2186 | # assume it's a count |
| 2187 | last = first + last |
| 2188 | else: |
| 2189 | first = int(arg.strip()) |
| 2190 | first = max(1, first - 5) |
| 2191 | except ValueError: |
| 2192 | self.error('Error in argument: %r' % arg) |
| 2193 | return |
| 2194 | elif self.lineno is None or arg == '.': |
| 2195 | first = max(1, self.curframe.f_lineno - 5) |
| 2196 | else: |
| 2197 | first = self.lineno + 1 |
| 2198 | if last is None: |
| 2199 | last = first + 10 |
| 2200 | filename = self.curframe.f_code.co_filename |
| 2201 | breaklist = self.get_file_breaks(filename) |
| 2202 | try: |
| 2203 | lines = linecache.getlines(filename, self.curframe.f_globals) |
| 2204 | self._print_lines(lines[first-1:last], first, breaklist, |
| 2205 | self.curframe) |
| 2206 | self.lineno = min(last, len(lines)) |
| 2207 | if len(lines) < last: |
| 2208 | self.message('[EOF]') |
| 2209 | except KeyboardInterrupt: |
| 2210 | pass |
| 2211 | self._validate_file_mtime() |
| 2212 | do_l = do_list |
| 2213 | |
| 2214 | def do_longlist(self, arg): |
nothing calls this directly
no test coverage detected