##// END OF EJS Templates
ENH: initial .mailmap to unify major contributors appearance in shortlog...
ENH: initial .mailmap to unify major contributors appearance in shortlog Now instead of 785 Fernando Perez 632 Brian Granger 572 MinRK 572 vivainio 307 Thomas Kluyver 253 fperez 250 epatters 205 Ville M. Vainio 187 Brian E. Granger 110 Gael Varoquaux 106 walter.doerwald 69 gvaroquaux 52 Barry Wark 45 Brian E Granger 41 ldufrechou 40 Robert Kern 25 Jorgen Stenarson 20 vivainio2 16 Paul Ivanov 15 bgranger ... it would look like 1052 Fernando Perez 879 Brian E. Granger 802 Ville M. Vainio 588 Benjamin Ragan-Kelley 307 Thomas Kluyver 262 Evan Patterson 180 Gael Varoquaux 108 Walter Doerwald 70 Laurent Dufréchou 52 Barry Wark 42 Robert Kern ... There are more contributors which haven't yet been added to the mailmap file

File last commit:

r4574:a8c54759
r4798:eb389453
Show More
display_trap.py
70 lines | 2.1 KiB | text/x-python | PythonLexer
# encoding: utf-8
"""
A context manager for handling sys.displayhook.
Authors:
* Robert Kern
* Brian Granger
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2008-2009 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
import sys
from IPython.config.configurable import Configurable
from IPython.utils.traitlets import Any
#-----------------------------------------------------------------------------
# Classes and functions
#-----------------------------------------------------------------------------
class DisplayTrap(Configurable):
"""Object to manage sys.displayhook.
This came from IPython.core.kernel.display_hook, but is simplified
(no callbacks or formatters) until more of the core is refactored.
"""
hook = Any
def __init__(self, hook=None):
super(DisplayTrap, self).__init__(hook=hook, config=None)
self.old_hook = None
# We define this to track if a single BuiltinTrap is nested.
# Only turn off the trap when the outermost call to __exit__ is made.
self._nested_level = 0
def __enter__(self):
if self._nested_level == 0:
self.set()
self._nested_level += 1
return self
def __exit__(self, type, value, traceback):
if self._nested_level == 1:
self.unset()
self._nested_level -= 1
# Returning False will cause exceptions to propagate
return False
def set(self):
"""Set the hook."""
if sys.displayhook is not self.hook:
self.old_hook = sys.displayhook
sys.displayhook = self.hook
def unset(self):
"""Unset the hook."""
sys.displayhook = self.old_hook