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)
| 1208 | complete_pp = _complete_expression |
| 1209 | |
| 1210 | def do_list(self, arg): |
| 1211 | """l(ist) [first [,last] | .] |
| 1212 | |
| 1213 | List source code for the current file. Without arguments, |
| 1214 | list 11 lines around the current line or continue the previous |
| 1215 | listing. With . as argument, list 11 lines around the current |
| 1216 | line. With one argument, list 11 lines starting at that line. |
| 1217 | With two arguments, list the given range; if the second |
| 1218 | argument is less than the first, it is a count. |
| 1219 | |
| 1220 | The current line in the current frame is indicated by "->". |
| 1221 | If an exception is being debugged, the line where the |
| 1222 | exception was originally raised or propagated is indicated by |
| 1223 | ">>", if it differs from the current line. |
| 1224 | """ |
| 1225 | self.lastcmd = 'list' |
| 1226 | last = None |
| 1227 | if arg and arg != '.': |
| 1228 | try: |
| 1229 | if ',' in arg: |
| 1230 | first, last = arg.split(',') |
| 1231 | first = int(first.strip()) |
| 1232 | last = int(last.strip()) |
| 1233 | if last < first: |
| 1234 | # assume it's a count |
| 1235 | last = first + last |
| 1236 | else: |
| 1237 | first = int(arg.strip()) |
| 1238 | first = max(1, first - 5) |
| 1239 | except ValueError: |
| 1240 | self.error('Error in argument: %r' % arg) |
| 1241 | return |
| 1242 | elif self.lineno is None or arg == '.': |
| 1243 | first = max(1, self.curframe.f_lineno - 5) |
| 1244 | else: |
| 1245 | first = self.lineno + 1 |
| 1246 | if last is None: |
| 1247 | last = first + 10 |
| 1248 | filename = self.curframe.f_code.co_filename |
| 1249 | breaklist = self.get_file_breaks(filename) |
| 1250 | try: |
| 1251 | lines = linecache.getlines(filename, self.curframe.f_globals) |
| 1252 | self._print_lines(lines[first-1:last], first, breaklist, |
| 1253 | self.curframe) |
| 1254 | self.lineno = min(last, len(lines)) |
| 1255 | if len(lines) < last: |
| 1256 | self.message('[EOF]') |
| 1257 | except KeyboardInterrupt: |
| 1258 | pass |
| 1259 | do_l = do_list |
| 1260 | |
| 1261 | def do_longlist(self, arg): |
nothing calls this directly
no test coverage detected