diff --git a/gluon/highlight.py b/gluon/highlight.py index d6faff87..951dab81 100644 --- a/gluon/highlight.py +++ b/gluon/highlight.py @@ -182,8 +182,8 @@ class Highlighter(object): )), 'PYTHONMultilineString': (python_tokenizer, (('ENDMULTILINESTRING', - re.compile(r'.*?("""|\'\'\')', - re.DOTALL), 'color: darkred'), )), + re.compile(r'.*?("""|\'\'\')', + re.DOTALL), 'color: darkred'), )), 'HTML': (html_tokenizer, ( ('GOTOPYTHON', re.compile(r'\{\{'), 'color: red'), ('COMMENT', re.compile(r'|'), @@ -209,7 +209,7 @@ class Highlighter(object): mode = self.mode while i < len(data): for (token, o_re, style) in Highlighter.all_styles[mode][1]: - if not token in self.suppress_tokens: + if token not in self.suppress_tokens: match = o_re.match(data, i) if match: if style: @@ -221,7 +221,7 @@ class Highlighter(object): new_mode = \ Highlighter.all_styles[mode][0](self, token, match, style) - if not new_mode is None: + if new_mode is not None: mode = new_mode i += max(1, len(match.group())) break @@ -241,9 +241,9 @@ class Highlighter(object): style = self.styles[token] if self.span_style != style: if style != 'Keep': - if not self.span_style is None: + if self.span_style is not None: self.output.append('') - if not style is None: + if style is not None: self.output.append('' % style) self.span_style = style @@ -260,7 +260,7 @@ def highlight( ): styles = styles or {} attributes = attributes or {} - if not 'CODE' in styles: + if 'CODE' not in styles: code_style = """ font-size: 11px; font-family: Bitstream Vera Sans Mono,monospace; @@ -272,7 +272,7 @@ def highlight( white-space: pre !important;\n""" else: code_style = styles['CODE'] - if not 'LINENUMBERS' in styles: + if 'LINENUMBERS' not in styles: linenumbers_style = """ font-size: 11px; font-family: Bitstream Vera Sans Mono,monospace; @@ -283,7 +283,7 @@ def highlight( color: #A0A0A0;\n""" else: linenumbers_style = styles['LINENUMBERS'] - if not 'LINEHIGHLIGHT' in styles: + if 'LINEHIGHLIGHT' not in styles: linehighlight_style = "background-color: #EBDDE2;" else: linehighlight_style = styles['LINEHIGHLIGHT'] @@ -333,8 +333,9 @@ def highlight( == '_' and value]) if fa: fa = ' ' + fa - return '
%s
%s
'\ - % (fa, linenumbers_style, numbers, code_style, code) + return '' \ + '
%s
' \ + '
%s
' % (fa, linenumbers_style, numbers, code_style, code) if __name__ == '__main__': @@ -342,5 +343,4 @@ if __name__ == '__main__': argfp = open(sys.argv[1]) data = argfp.read() argfp.close() - print('' + highlight(data, sys.argv[2])\ - + '') + print('' + highlight(data, sys.argv[2]) + '')