1. Jonathan Eunice
  2. show


Jonathan Eunice  committed 973a8ff

Some PEP8 fixes. Adopted FmtException from say>=1.0.4

  • Participants
  • Parent commits 6045ce9
  • Branches default

Comments (0)

Files changed (4)

File setup.py

View file
 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:
-    version='1.0.1',
+    version='1.0.2',
     author='Jonathan Eunice',
     description='Debug print statements, done right. E.g. show(x)',

File show/core.py

View file
 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
-            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

File show/introspect.py

View file
 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
                 srcleft = textwrap.dedent(src)
             except SyntaxError:
-        raise RuntimeError('Failed to parse:\n{}\n'.format(src))
+        raise ParseError('Failed to parse source:\n{src}\n')
     def visit_Call(self, node):

File show/linecacher.py

View file
 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
                 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}')
             return linecache.getline(filename, lineno)