<s> import warnings <EOL> from pikos . _internal . monitor_attach import MonitorAttach <EOL> def screen ( filter_ = None ) : <EOL> """<STR_LIT>""" <EOL> import sys <EOL> from pikos . recorders . text_stream_recorder import TextStreamRecorder <EOL> return TextStreamRecorder ( <EOL> sys . stdout , filter_ = filter_ , auto_flush = True , formatted = True ) <EOL> def textfile ( filename = None , filter_ = None ) : <EOL> """<STR_LIT>""" <EOL> if filename is None : <EOL> filename = '<STR_LIT>' <EOL> from pikos . recorders . text_file_recorder import TextFileRecorder <EOL> return TextFileRecorder ( <EOL> filename , filter_ = filter_ , auto_flush = True , formatted = True ) <EOL> def csvfile ( filename = None , filter_ = None ) : <EOL> """<STR_LIT>""" <EOL> if filename is None : <EOL> filename = '<STR_LIT>' <EOL> from pikos . recorders . csv_file_recorder import CSVFileRecorder <EOL> return CSVFileRecorder ( <EOL> filename , filter_ = filter_ ) <EOL> def monitor_functions ( recorder = None , focus_on = None ) : <EOL> """<STR_LIT>""" <EOL> if recorder is None : <EOL> recorder = screen ( ) <EOL> if focus_on is None : <EOL> try : <EOL> from pikos . cymonitors . api import FunctionMonitor <EOL> except ImportError : <EOL> from pikos . monitors . api import FunctionMonitor <EOL> warnings . warn ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> monitor = FunctionMonitor ( recorder ) <EOL> else : <EOL> from pikos . monitors . focused_function_monitor import ( <EOL> FocusedFunctionMonitor ) <EOL> monitor = FocusedFunctionMonitor ( recorder , functions = focus_on ) <EOL> return MonitorAttach ( monitor ) <EOL> def monitor_lines ( recorder = None , focus_on = None ) : <EOL> """<STR_LIT>""" <EOL> if recorder is None : <EOL> recorder = screen ( ) <EOL> if focus_on is None : <EOL> try : <EOL> from pikos . cymonitors . api import LineMonitor <EOL> except ImportError : <EOL> from pikos . monitors . api import LineMonitor <EOL> warnings . warn ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> monitor = LineMonitor ( recorder ) <EOL> else : <EOL> from pikos . monitors . focused_line_monitor import FocusedLineMonitor <EOL> monitor = FocusedLineMonitor ( recorder , functions = focus_on ) <EOL> return MonitorAttach ( monitor ) <EOL> def memory_on_functions ( recorder = None , focus_on = None ) : <EOL> """<STR_LIT>""" <EOL> if recorder is None : <EOL> recorder = screen ( ) <EOL> if focus_on is None : <EOL> try : <EOL> from pikos . cymonitors . function_memory_monitor import ( <EOL> FunctionMemoryMonitor ) <EOL> except ImportError : <EOL> from pikos . monitors . function_memory_monitor import ( <EOL> FunctionMemoryMonitor ) <EOL> warnings . warn ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> monitor = FunctionMemoryMonitor ( recorder ) <EOL> else : <EOL> from pikos . monitors . focused_function_memory_monitor import ( <EOL> FocusedFunctionMemoryMonitor ) <EOL> monitor = FocusedFunctionMemoryMonitor ( recorder , functions = focus_on ) <EOL> return MonitorAttach ( monitor ) <EOL> def memory_on_lines ( recorder = None , focus_on = None ) : <EOL> """<STR_LIT>""" <EOL> if recorder is None : <EOL> recorder = screen ( ) <EOL> if focus_on is None : <EOL> from pikos . monitors . line_memory_monitor import LineMemoryMonitor <EOL> monitor = LineMemoryMonitor ( recorder ) <EOL> else : <EOL> from pikos . monitors . focused_line_memory_monitor import ( <EOL> FocusedLineMemoryMonitor ) <EOL> monitor = FocusedLineMemoryMonitor ( recorder , functions = focus_on ) <EOL> return MonitorAttach ( monitor ) </s>
