All Samples(12) | Call(11) | Derive(0) | Import(1)
Hook to write a warning to a file; replace if you like.
def _show_warning(message, category, filename, lineno, file=None, line=None):
"""Hook to write a warning to a file; replace if you like."""
if file is None:
file = sys.stderr
try:
file.write(formatwarning(message, category, filename, lineno, line))
except IOError:
pass # the file (probably stderr) is invalid - this warning gets lost.
import sys
import logging
import warnings
from warnings import showwarning as showwarning_orig
_logger_warnings = logging.getLogger('warnings')
def _showwarning_logging(message, category, filename, lineno, file=None, *args,
**kwargs):
if not (file is None):
showwarning_orig(message, category, filename, lineno, file, *args, **kwargs)
return
_logger_warnings.warn(formatwarning(message, category, filename, lineno,
src/i/r/ironruby-HEAD/External.LCA_RESTRICTED/Languages/IronPython/27/Lib/test/test_logging.py ironruby(Download)
#See if an explicit file uses the original implementation
file = cStringIO.StringIO()
warnings.showwarning("Explicit", UserWarning, "dummy.py", 42,
file, "Dummy line")
s = file.getvalue()
file.close()
src/i/r/ironruby-HEAD/External.LCA_RESTRICTED/Languages/CPython/27/Lib/test/test_logging.py ironruby(Download)
#See if an explicit file uses the original implementation
file = cStringIO.StringIO()
warnings.showwarning("Explicit", UserWarning, "dummy.py", 42,
file, "Dummy line")
s = file.getvalue()
file.close()
src/j/y/jython-HEAD/sandbox/wierzbicki/test27/CPythonLib/test/test_logging.py jython(Download)
#See if an explicit file uses the original implementation
file = cStringIO.StringIO()
warnings.showwarning("Explicit", UserWarning, "dummy.py", 42, file,
"Dummy line")
s = file.getvalue()
file.close()
src/p/y/pypy3-HEAD/lib-python/3.1.2/test/test_logging.py pypy3(Download)
#See if an explicit file uses the original implementation
file = io.StringIO()
warnings.showwarning("Explicit", UserWarning, "dummy.py", 42,
file, "Dummy line")
s = file.getvalue()
file.close()
src/p/y/pyvm-HEAD/projects/python_in_a_can/trunk/win32/python-2.7/Lib/test/test_logging.py pyvm(Download)
#See if an explicit file uses the original implementation
file = cStringIO.StringIO()
warnings.showwarning("Explicit", UserWarning, "dummy.py", 42,
file, "Dummy line")
s = file.getvalue()
file.close()
src/s/t/stackless-HEAD/Lib/test/test_logging.py stackless(Download)
#See if an explicit file uses the original implementation
file = cStringIO.StringIO()
warnings.showwarning("Explicit", UserWarning, "dummy.py", 42,
file, "Dummy line")
s = file.getvalue()
file.close()
src/p/y/pywii-HEAD/Python-3.1.2/Lib/test/test_logging.py pywii(Download)
#See if an explicit file uses the original implementation
file = io.StringIO()
warnings.showwarning("Explicit", UserWarning, "dummy.py", 42,
file, "Dummy line")
s = file.getvalue()
file.close()
src/b/d/bdk-c-HEAD/trunk/workspace/script/python/Lib/test/test_logging.py bdk-c(Download)
#See if an explicit file uses the original implementation
file = io.StringIO()
warnings.showwarning("Explicit", UserWarning, "dummy.py", 42,
file, "Dummy line")
s = file.getvalue()
file.close()
src/a/t/Athena-Dependencies-Python-HEAD/Lib/test/test_logging.py Athena-Dependencies-Python(Download)
#See if an explicit file uses the original implementation
file = io.StringIO()
warnings.showwarning("Explicit", UserWarning, "dummy.py", 42,
file, "Dummy line")
s = file.getvalue()
file.close()
1 | 2 Next