##// END OF EJS Templates
A few style fixes:...
Matthias Bussonnier -
Show More
@@ -398,7 +398,7 b' def test_property_sources():'
398 def test_property_docstring_is_in_info_for_detail_level_0():
398 def test_property_docstring_is_in_info_for_detail_level_0():
399 class A(object):
399 class A(object):
400 @property
400 @property
401 def foobar():
401 def foobar(self):
402 """This is `foobar` property."""
402 """This is `foobar` property."""
403 pass
403 pass
404
404
@@ -85,7 +85,7 b' class WarningManager:'
85 else:
85 else:
86 return None
86 return None
87
87
88 def __exit__(self):
88 def __exit__(self, type_, value, traceback):
89 if not self._entered:
89 if not self._entered:
90 raise RuntimeError("Cannot exit %r without entering first" % self)
90 raise RuntimeError("Cannot exit %r without entering first" % self)
91 self._module.filters = self._filters
91 self._module.filters = self._filters
@@ -101,10 +101,8 b' def assert_warns(warning_class, func, *args, **kw):'
101
101
102 # XXX: once we may depend on python >= 2.6, this can be replaced by the
102 # XXX: once we may depend on python >= 2.6, this can be replaced by the
103 # warnings module context manager.
103 # warnings module context manager.
104 ctx = WarningManager(record=True)
104 with WarningManager(record=True) as l:
105 l = ctx.__enter__()
105 warnings.simplefilter('always')
106 warnings.simplefilter('always')
107 try:
108 func(*args, **kw)
106 func(*args, **kw)
109 if not len(l) > 0:
107 if not len(l) > 0:
110 raise AssertionError("No warning raised when calling %s"
108 raise AssertionError("No warning raised when calling %s"
@@ -112,5 +110,3 b' def assert_warns(warning_class, func, *args, **kw):'
112 if not l[0].category is warning_class:
110 if not l[0].category is warning_class:
113 raise AssertionError("First warning for %s is not a " \
111 raise AssertionError("First warning for %s is not a " \
114 "%s( is %s)" % (func.__name__, warning_class, l[0]))
112 "%s( is %s)" % (func.__name__, warning_class, l[0]))
115 finally:
116 ctx.__exit__()
@@ -39,7 +39,7 b' from pygments.lexer import ('
39 Lexer, DelegatingLexer, RegexLexer, do_insertions, bygroups, using,
39 Lexer, DelegatingLexer, RegexLexer, do_insertions, bygroups, using,
40 )
40 )
41 from pygments.token import (
41 from pygments.token import (
42 Comment, Generic, Keyword, Literal, Name, Operator, Other, Text, Error,
42 Generic, Keyword, Literal, Name, Operator, Other, Text, Error,
43 )
43 )
44 from pygments.util import get_bool_opt
44 from pygments.util import get_bool_opt
45
45
@@ -83,13 +83,11 b' def build_ipy_lexer(python3):'
83 # we will also have two IPython lexer classes.
83 # we will also have two IPython lexer classes.
84 if python3:
84 if python3:
85 PyLexer = Python3Lexer
85 PyLexer = Python3Lexer
86 clsname = 'IPython3Lexer'
87 name = 'IPython3'
86 name = 'IPython3'
88 aliases = ['ipython3']
87 aliases = ['ipython3']
89 doc = """IPython3 Lexer"""
88 doc = """IPython3 Lexer"""
90 else:
89 else:
91 PyLexer = PythonLexer
90 PyLexer = PythonLexer
92 clsname = 'IPythonLexer'
93 name = 'IPython'
91 name = 'IPython'
94 aliases = ['ipython2', 'ipython']
92 aliases = ['ipython2', 'ipython']
95 doc = """IPython Lexer"""
93 doc = """IPython Lexer"""
@@ -468,9 +466,9 b' class IPythonConsoleLexer(Lexer):'
468 if insertion:
466 if insertion:
469 self.insertions.append((len(self.buffer), [insertion]))
467 self.insertions.append((len(self.buffer), [insertion]))
470 self.buffer += code
468 self.buffer += code
471 else:
469
472 for token in self.buffered_tokens():
470 for token in self.buffered_tokens():
473 yield token
471 yield token
474
472
475 class IPyLexer(Lexer):
473 class IPyLexer(Lexer):
476 """
474 """
General Comments 0
You need to be logged in to leave comments. Login now