File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010from logging import Handler , Logger
1111import os
1212import sys
13+ from prompt_toolkit .patch_stdout import patch_stdout
1314
1415
1516class _PyflybyHandler (Handler ):
Original file line number Diff line number Diff line change 1414import os
1515import pathlib
1616import pkgutil
17- from prompt_toolkit .patch_stdout \
18- import patch_stdout
1917import textwrap
2018
2119from pyflyby ._fast_iter_modules \
@@ -70,12 +68,11 @@ def _remove_import_cache_dir(path: pathlib.Path):
7068 try :
7169 shutil .rmtree (str (path ))
7270 except Exception as e :
73- with patch_stdout (raw = True ):
74- logger .error (
75- f"Failed to remove cache directory at { path } - please "
76- "consider removing this directory manually. Error:\n "
77- f"{ textwrap .indent (str (e ), prefix = ' ' )} "
78- )
71+ logger .error (
72+ f"Failed to remove cache directory at { path } - please "
73+ "consider removing this directory manually. Error:\n "
74+ f"{ textwrap .indent (str (e ), prefix = ' ' )} "
75+ )
7976
8077
8178@memoize
@@ -613,8 +610,7 @@ def _cached_module_finder(
613610 for path in cache_dir .iterdir ():
614611 _remove_import_cache_dir (path )
615612
616- with patch_stdout (raw = True ):
617- logger .info (f"Rebuilding cache for { _format_path (importer .path )} ..." )
613+ logger .info (f"Rebuilding cache for { _format_path (importer .path )} ..." )
618614
619615 modules = _iter_file_finder_modules (importer , SUFFIXES )
620616 with open (cache_file , 'w' ) as fp :
You can’t perform that action at this time.
0 commit comments