A little helper class to keep ROOT silent...
Definition at line 63 of file Tools/PyUtils/python/Helpers.py.
◆ __init__()
def python.Helpers.ShutUp.__init__ |
( |
|
self, |
|
|
|
filters = DefaultFilter |
|
) |
| |
Definition at line 72 of file Tools/PyUtils/python/Helpers.py.
72 def __init__(self, filters = DefaultFilter):
74 if os.environ.get(
'PYUTILS_SHUTUP_DEBUG',
'0') ==
'1':
77 self.save_err =
open(
'/dev/null',
'w' )
78 self.save_out =
open(
'/dev/null',
'w' )
80 self.quiet_err = NamedTemporaryFile( suffix =
".msg.log" )
81 self.quiet_out = NamedTemporaryFile( suffix =
".msg.log" )
88 self.quiet_err = NamedTemporaryFile( suffix =
".msg.log" )
89 self.quiet_out = NamedTemporaryFile( suffix =
".msg.log" )
94 self.filters = filters
97 os.dup2( sys.stderr.fileno(), self.save_err.fileno() )
98 os.dup2( sys.stdout.fileno(), self.save_out.fileno() )
◆ __del__()
def python.Helpers.ShutUp.__del__ |
( |
|
self | ) |
|
◆ __enter__()
def python.Helpers.ShutUp.__enter__ |
( |
|
self | ) |
|
◆ __exit__()
def python.Helpers.ShutUp.__exit__ |
( |
|
self, |
|
|
|
exc_type, |
|
|
|
exc_val, |
|
|
|
exc_tb |
|
) |
| |
◆ __filterRootMessages()
def python.Helpers.ShutUp.__filterRootMessages |
( |
|
self, |
|
|
|
fd |
|
) |
| |
|
private |
Definition at line 122 of file Tools/PyUtils/python/Helpers.py.
122 def __filterRootMessages(self, fd):
124 for l
in fd.readlines():
127 for filter
in self.filters:
128 if re.match(filter, l):
131 print (
"PyRoot:",l.replace(
"\n",
""))
◆ mute()
def python.Helpers.ShutUp.mute |
( |
|
self | ) |
|
Definition at line 106 of file Tools/PyUtils/python/Helpers.py.
108 os.dup2( self.quiet_err.fileno(), sys.stderr.fileno() )
109 os.dup2( self.quiet_out.fileno(), sys.stdout.fileno() )
◆ unMute()
def python.Helpers.ShutUp.unMute |
( |
|
self | ) |
|
Definition at line 112 of file Tools/PyUtils/python/Helpers.py.
114 os.dup2( self.save_err.fileno(), sys.stderr.fileno() )
115 os.dup2( self.save_out.fileno(), sys.stdout.fileno() )
116 self.__filterRootMessages(self.quiet_err)
117 self.quiet_err.seek(0)
118 self.__filterRootMessages(self.quiet_out)
119 self.quiet_out.seek(0)
◆ _dummy
python.Helpers.ShutUp._dummy |
|
private |
◆ DefaultFilter
python.Helpers.ShutUp.DefaultFilter |
|
static |
◆ filters
python.Helpers.ShutUp.filters |
◆ quiet_err
python.Helpers.ShutUp.quiet_err |
◆ quiet_out
python.Helpers.ShutUp.quiet_out |
◆ save_err
python.Helpers.ShutUp.save_err |
◆ save_out
python.Helpers.ShutUp.save_out |
The documentation for this class was generated from the following file: