Permalink
Browse files

removed unnecessary PYGMENTS_AVAILABLE flag

seems more Pythonic this way
  • Loading branch information...
1 parent 818786a commit 0b628f7d53af6907c964f30aa90856baae40ec8a @FND FND committed Nov 11, 2012
Showing with 3 additions and 4 deletions.
  1. +3 −4 jsonformat/jsonf/cli.py
@@ -21,9 +21,8 @@
from pygments import highlight
from pygments.lexers import JSONLexer
from pygments.formatters import TerminalFormatter
- PYGMENTS_AVAILABLE = True
except ImportError:
- PYGMENTS_AVAILABLE = False
+ pass
def format_json(data):
@@ -48,9 +47,9 @@ def main():
print ''.join(headers)
output = format_json(''.join(content))
- if PYGMENTS_AVAILABLE:
+ try:
print highlight(output, JSONLexer(), TerminalFormatter())
- else:
+ except NameError:
print output
print >>stderr, ("NOTE: If you have the python package "
"`pygments` available for import, you'll get nice "

0 comments on commit 0b628f7

Please sign in to comment.