comparison blast2html.py @ 51:b15a20c2372a

fix python 2 compatibility
author Jan Kanis <jan.code@jankanis.nl>
date Wed, 21 May 2014 18:34:35 +0200
parents bfc82a8aa3c9
children 4217bb9cf1d3
comparison
equal deleted inserted replaced
50:bfc82a8aa3c9 51:b15a20c2372a
11 import sys 11 import sys
12 import math 12 import math
13 import warnings 13 import warnings
14 from os import path 14 from os import path
15 from itertools import repeat 15 from itertools import repeat
16 import six
16 import argparse 17 import argparse
17 from lxml import objectify 18 from lxml import objectify
18 import jinja2 19 import jinja2
19 20
20 21
21 22
22 _filters = {} 23 _filters = {}
23 def filter(func_or_name): 24 def filter(func_or_name):
24 "Decorator to register a function as filter in the current jinja environment" 25 "Decorator to register a function as filter in the current jinja environment"
25 if isinstance(func_or_name, str): 26 if isinstance(func_or_name, six.string_types):
26 def inner(func): 27 def inner(func):
27 _filters[func_or_name] = func.__name__ 28 _filters[func_or_name] = func.__name__
28 return func 29 return func
29 return inner 30 return inner
30 else: 31 else: