|
26 | 26 | import pyficache |
27 | 27 |
|
28 | 28 | from trepan.lib.format import Filename, Hex, LineNumber, Symbol, format_token # Opcode, |
29 | | -from trepan.lib.stack import check_path_with_frame, frame2file, get_exec_string, is_eval_or_exec_stmt |
| 29 | +from trepan.lib.stack import ( |
| 30 | + check_path_with_frame, |
| 31 | + frame2file, |
| 32 | + get_exec_or_eval_string, |
| 33 | + is_eval_or_exec_stmt, |
| 34 | +) |
30 | 35 | from trepan.processor import cmdfns |
31 | 36 | from trepan.processor.cmdfns import deparse_fn |
32 | 37 |
|
@@ -108,7 +113,7 @@ def print_source_location_info( |
108 | 113 | L -- 2 import sys,os |
109 | 114 | (trepan3k) |
110 | 115 | """ |
111 | | - col_str = f":{column_number}" if column_number >= 0 else "" |
| 116 | + col_str = f":{column_number}" if column_number >= 0 else "" |
112 | 117 | if remapped_file and filename != remapped_file: |
113 | 118 | mess = f"({remapped_file}:{line_number}{col_str} remapped {filename}" |
114 | 119 | else: |
@@ -202,7 +207,9 @@ def prefix_for_source_text(source_text: str, maxwidth: int) -> str: |
202 | 207 | tempdir=proc_obj.settings("tempdir"), |
203 | 208 | ) |
204 | 209 | pyficache.remap_file(filename, remapped_file) |
205 | | - filename, line_number = pyficache.unmap_file_line(filename, line_number) |
| 210 | + filename, line_number = pyficache.unmap_file_line( |
| 211 | + filename, line_number |
| 212 | + ) |
206 | 213 | pass |
207 | 214 | pass |
208 | 215 |
|
@@ -230,12 +237,12 @@ def prefix_for_source_text(source_text: str, maxwidth: int) -> str: |
230 | 237 | # else: |
231 | 238 | # print("Can't deparse", frame.f_code) |
232 | 239 | if source_text is None and eval_kind: |
233 | | - if (source_text := get_exec_string(frame)): |
234 | | - filename = "string-" + prefix_for_filename(source_text) + "-" |
235 | | - else: |
236 | | - source_text = f"{eval_kind}(...)" |
237 | | - pass |
238 | | - pass |
| 240 | + if source_text := get_exec_or_eval_string(frame): |
| 241 | + filename = "string-" + prefix_for_filename(source_text) + "-" |
| 242 | + else: |
| 243 | + source_text = f"{eval_kind}(...)" |
| 244 | + pass |
| 245 | + pass |
239 | 246 | pass |
240 | 247 | pass |
241 | 248 | else: |
@@ -320,7 +327,9 @@ def prefix_for_source_text(source_text: str, maxwidth: int) -> str: |
320 | 327 | pyficache.remap_file(remapped_file, filename) |
321 | 328 | fd.close() |
322 | 329 | if source_text: |
323 | | - intf_obj.msg(f"remapped string {prefix_for_source_text(source_text, 10)} to file {remapped_file}") |
| 330 | + intf_obj.msg( |
| 331 | + f"remapped string {prefix_for_source_text(source_text, 10)} to file {remapped_file}" |
| 332 | + ) |
324 | 333 | else: |
325 | 334 | intf_obj.msg(f"remapped file {filename} to {remapped_file}") |
326 | 335 | proc_obj.list_filename = remapped_file |
@@ -424,10 +433,12 @@ def five(): |
424 | 433 | cmdproc.curframe = cmdproc.stack[cmdproc.curindex][0] |
425 | 434 | print_location(cmdproc) |
426 | 435 |
|
427 | | - exec(""" |
| 436 | + exec( |
| 437 | + """ |
428 | 438 | cmdproc.frame = currentframe() |
429 | 439 | cmdproc.setup() |
430 | 440 | print_location(cmdproc) |
431 | | -""") |
| 441 | +""" |
| 442 | + ) |
432 | 443 |
|
433 | 444 | exec("five()") |
0 commit comments