Commits

Jonathan Eunice committed 973a8ff

Some PEP8 fixes. Adopted FmtException from say>=1.0.4

Comments (0)

Files changed (4)

 system = str(sys.platform).lower()
 impl = platform.python_implementation()
 
-install_requires = ['six>=1.4.1', 'options>=1.0', 'say>=1.0', 'stuf>=0.9.12',
-                    'mementos>=1.0', 'codegen', # 'astor'
+install_requires = ['six>=1.4.1', 'options>=1.0', 'say>=1.0.4',
+                    'stuf>=0.9.12', 'mementos>=1.0', 'codegen', # 'astor'
                     ]
 
 if 'darwin' in system:
 
 setup(
     name='show',
-    version='1.0.1',
+    version='1.0.2',
     author='Jonathan Eunice',
     author_email='jonathan.eunice@gmail.com',
     description='Debug print statements, done right. E.g. show(x)',
 from show.linecacher import *
 from show.introspect import *
 from show.util import *
+from show.exceptions import *
 
 from options.nulltype import NullType
 Private    = NullType('Private')
             except Exception as e:
                 raise e
         else:
-            raise ValueError("'{0}' is not a recognized pretty print mode").format(mode)
+            raise BadValue("{mode!r} is not a recognized pretty print mode")
 
     # TODO: Give option for showing return value differently
     # TODO: Give this decorator standard show kwargs

show/introspect.py

 from show.linecacher import *
 import textwrap
 from stuf import stuf
-from say import fmt
+from say import fmt, FmtException
 
 prefix = stuf(normal='', slot='/', superclass='^', baseobject='*')
 
         for lastlineno in range(self.lineno, self.lineno + 10):
             line = getline(self.filepath, lastlineno)
             if line is None:
-                raise ArgsUnavailable('getline returns None at {lastlineno}'.format(lastlineno))
+                raise ArgsUnavailable('getline returns None at {lastlineno}')
             src += line
             try:
                 srcleft = textwrap.dedent(src)
                 pass
             except SyntaxError:
                 pass
-        raise RuntimeError('Failed to parse:\n{}\n'.format(src))
+        raise ParseError('Failed to parse source:\n{src}\n')
 
     def visit_Call(self, node):
         """

show/linecacher.py

 
 import sys
 import linecache
-
-
-class ArgsUnavailable(ValueError):
-    pass
+from show.exceptions import ArgsUnavailable
 
 isInteractive = hasattr(sys, 'ps1') or hasattr(sys, 'ipcompleter')
 # see http://bit.ly/1aNuD3S
             try:
                 return history.lines[index]
             except IndexError:
-                err_msg = 'Cannot retrieve history line {0}'.format(index)
-                raise ArgsUnavailable(err_msg)
+                raise ArgsUnavailable('Cannot retrieve history line {index}')
         else:
             return linecache.getline(filename, lineno)