@@ -23,7 +23,7 @@ def type_to_name(type_: Type) -> str:
2323 return type_ .__name__ .replace ('WindowsPath' , 'PosixPath' )
2424
2525
26- @dataclass
26+ @dataclass ( repr = False )
2727class Reg :
2828 dir_path : Path
2929 label : str
@@ -52,42 +52,42 @@ def match_text(self, text: str, sub_label: str = '') -> None:
5252
5353def strip_tb_text (text : str ) -> str :
5454 OFTO = '...omitted for tests only...'
55- text = text .replace ('\\ \\ ' , '\\ ' ) # for windows
56- text = re .sub ('.:\\ \\ ' , '/' , text ) # for windows
57- text = text .replace ('\\ ' , '/' ) # for windows
58- text = text .replace ('\r ' , '' ) # for windows
59- text = text .replace ('WindowsPath' , 'PosixPath' ) # for windows
60- text = re .sub (r'\n[^\n]*\^\^\^[^\n]*\n' , '\n ' , text )
55+ # text = text.replace('\\\\', '\\') # for windows
56+ # text = re.sub('.:\\\\', '/', text) # for windows
57+ # text = text.replace('\\', '/') # for windows
58+ # text = text.replace('\r', '') # for windows
59+ # text = text.replace('WindowsPath', 'PosixPath') # for windows
60+ # text = re.sub(r'\n[^\n]*\^\^\^[^\n]*\n', '\n', text)
6161 # File "/usr/local/lib/python3.8/dist-packages/_pytest/_code/code.py", line 810, in repr_traceback_entry
6262 text = re .sub (r'/[\w/.-]+/[\d]+\.py([^\w/-])' , fr'{ OFTO } \1' , text )
6363 text = re .sub (r'([^\w/.-])/[\w/.-]+(/[\w.-]+[^\w/.-])' , fr'\1{ OFTO } \2' , text )
6464 text = re .sub (r'/[\w/.-]+(/[\w.-]+\.py[^\w/-])' , fr'{ OFTO } \1' , text )
65- text = re .sub (r'(line)[^\n,]+(,)' , fr'\1{ OFTO } \2' , text )
65+ # text = re.sub(r'(line)[^\n,]+(,)', fr'\1{OFTO}\2', text)
6666 #text = re.sub(r"(__file__ = )[^\n]*\n", fr"\1'{OFTO}'", text)
6767 text = re .sub (r'( at 0x)\w+' , fr'\1{ OFTO } ' , text )
6868 #text = re.sub(r'(__builtins__[^{]*{)[^\n]*', fr'\1{OFTO}', text)
69- text = re .sub (r'(<ipython-input-)\d+-\w+(>)' , fr'{ OFTO } ' , text )
70- text = re .sub ('\n [^\n ]+function open[^\n ]+\n ' , '\n ' , text )
71- text = re .sub ('\n [^\n ]+_pytest[^\n ]+\n ' , '\n ' , text )
72- text = re .sub (', required=True' , '' , text )
73- text = re .sub ('integer division or modulo' , 'division' , text )
74- text = re .sub ('\n [^\n ]*__annotations__[^\n ]*\n ' , '\n ' , text )
75- text = re .sub ('\n [^\n ]*return self._parse_known_args2(args, namespace, intermixed=False)[^\n ]*\n ' , '\n ' , text )
76- text = re .sub (' 23 vars' , ' 22 vars' , text )
77- text = re .sub (' 10 vars' , ' 9 vars' , text )
78- for p in ['server.py' , 'code.py' , 'main.py' ]:
79- text = re .sub (p + ': error:' , 'python3 -m traceback_with_variables.main: error:' , text )
80- text = re .sub ('usage: ' + p , 'usage: python3 -m traceback_with_variables.main' , text )
81- text = re .sub ("prog='" + p , "prog='python3 -m traceback_with_variables.main" , text )
82- text = re .sub ("'prog': '" + p , "'prog': 'python3 -m traceback_with_variables.main" , text )
69+ # text = re.sub(r'(<ipython-input-)\d+-\w+(>)', fr'{OFTO}', text)
70+ # text = re.sub('\n[^\n]+function open[^\n]+\n', '\n', text)
71+ # text = re.sub('\n[^\n]+_pytest[^\n]+\n', '\n', text)
72+ # text = re.sub(', required=True', '', text)
73+ # text = re.sub('integer division or modulo', 'division', text)
74+ # text = re.sub('\n[^\n]*__annotations__[^\n]*\n', '\n', text)
75+ # text = re.sub('\n[^\n]*return self._parse_known_args2(args, namespace, intermixed=False)[^\n]*\n', '\n', text)
76+ # text = re.sub(' 23 vars', ' 22 vars', text)
77+ # text = re.sub(' 10 vars', ' 9 vars', text)
78+ # for p in ['server.py', 'code.py', 'main.py']:
79+ # text = re.sub(p + ': error:', 'python3 -m traceback_with_variables.main: error:', text)
80+ # text = re.sub('usage: ' + p, 'usage: python3 -m traceback_with_variables.main', text)
81+ # text = re.sub("prog='" + p, "prog='python3 -m traceback_with_variables.main", text)
82+ # text = re.sub("'prog': '" + p, "'prog': 'python3 -m traceback_with_variables.main", text)
8383
8484 #text = re.sub('main.py', 'python3 -m traceback_with_variables.main', text)
8585 #text = re.sub('server.py', 'python3 -m traceback_with_variables.main', text)
8686 #text = re.sub('code.py', 'python3 -m traceback_with_variables.main', text)
8787 #text = re.sub(r'(<_froze?n?s?e?t? ?a?t? ?0?x?).*(>)', fr'\1{OFTO}\2', text)
8888 #text = re.sub(r'(<trace?b?a?c?k? ?a?t? ?0?x?).*(>)', fr'\1{OFTO}\2', text)
8989 #text = re.sub(r'(<func?t?i?o?n? ?a?t? ?0?x?).*(>)', fr'\1{OFTO}\2', text)
90- text = re .sub (r'\n\s+~*\^+\n' , '\n ' , text ) # for jupyter with py>=3.13
90+ # text = re.sub(r'\n\s+~*\^+\n', '\n', text) # for jupyter with py>=3.13
9191
9292 return text
9393
0 commit comments