diff options
author | Matthäus G. Chajdas <dev@anteru.net> | 2021-02-14 14:42:49 +0100 |
---|---|---|
committer | Matthäus G. Chajdas <dev@anteru.net> | 2021-02-14 14:42:49 +0100 |
commit | 5f3db3a36610366e12ba14cd688d3d259917f33c (patch) | |
tree | 0f7321d8a492429df8a05581d3b00fbe8d7bba96 | |
parent | 41f25b1e6aa8d17794b0156fe133733d4a515ff8 (diff) | |
download | pygments-git-5f3db3a36610366e12ba14cd688d3d259917f33c.tar.gz |
Fix various issues found by make check.
-rw-r--r-- | pygments/formatters/svg.py | 6 | ||||
-rw-r--r-- | pygments/lexers/amdgpu.py | 12 | ||||
-rw-r--r-- | pygments/lexers/cddl.py | 1 | ||||
-rw-r--r-- | pygments/lexers/futhark.py | 2 | ||||
-rw-r--r-- | pygments/lexers/graphviz.py | 5 | ||||
-rw-r--r-- | pygments/lexers/javascript.py | 6 | ||||
-rw-r--r-- | pygments/styles/material.py | 1 | ||||
-rw-r--r-- | pygments/styles/zenburn.py | 2 | ||||
-rw-r--r-- | tests/test_html_lexer.py | 12 |
9 files changed, 29 insertions, 18 deletions
diff --git a/pygments/formatters/svg.py b/pygments/formatters/svg.py index 6950cd96..547a7bbc 100644 --- a/pygments/formatters/svg.py +++ b/pygments/formatters/svg.py @@ -140,7 +140,8 @@ class SvgFormatter(Formatter): if self.linenos: if counter % counter_step == 0: - outfile.write('<text x="%s" y="%s" %s text-anchor="end">%s</text>' % (x+self.linenowidth,y,counter_style,counter)) + outfile.write('<text x="%s" y="%s" %s text-anchor="end">%s</text>' % + (x+self.linenowidth,y,counter_style,counter)) line_x += self.linenowidth + self.ystep counter += 1 @@ -158,7 +159,8 @@ class SvgFormatter(Formatter): y += self.ystep outfile.write('</text>\n') if self.linenos and counter % counter_step == 0: - outfile.write('<text x="%s" y="%s" text-anchor="end" %s>%s</text>' % (x+self.linenowidth,y,counter_style,counter)) + outfile.write('<text x="%s" y="%s" text-anchor="end" %s>%s</text>' % + (x+self.linenowidth,y,counter_style,counter)) counter += 1 outfile.write('<text x="%s" y="%s" ' 'xml:space="preserve">' % (line_x,y)) diff --git a/pygments/lexers/amdgpu.py b/pygments/lexers/amdgpu.py index 8fd5c921..529a687b 100644 --- a/pygments/lexers/amdgpu.py +++ b/pygments/lexers/amdgpu.py @@ -1,7 +1,6 @@ -# -*- coding: utf-8 -*- """ - pygments.lexers.AMDGPULexer - ~~~~~~~~~~~~~~~~~~~~~~~~ + pygments.lexers.amdgpu + ~~~~~~~~~~~~~~~~~~~~~~ Lexers for the AMDGPU ISA assembly. @@ -10,13 +9,18 @@ """ from pygments.lexer import RegexLexer -from pygments.token import * +from pygments.token import Name, Text, Keyword, Whitespace, Number, Comment import re __all__ = ['AMDGPULexer'] class AMDGPULexer(RegexLexer): + """ + For AMD GPU assembly. + + .. versionadded:: 2.8 + """ name = 'AMDGPU' aliases = ['amdgpu'] filenames = ['*.isa'] diff --git a/pygments/lexers/cddl.py b/pygments/lexers/cddl.py index 6b6b8085..09bb5839 100644 --- a/pygments/lexers/cddl.py +++ b/pygments/lexers/cddl.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ pygments.lexers.cddl ~~~~~~~~~~~~~~~~~~~~ diff --git a/pygments/lexers/futhark.py b/pygments/lexers/futhark.py index f19d1d78..8892bb79 100644 --- a/pygments/lexers/futhark.py +++ b/pygments/lexers/futhark.py @@ -4,7 +4,7 @@ Lexer for the Futhark language - :copyright: Copyright 2021 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/pygments/lexers/graphviz.py b/pygments/lexers/graphviz.py index 15ff9424..55cf2e4c 100644 --- a/pygments/lexers/graphviz.py +++ b/pygments/lexers/graphviz.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ pygments.lexers.graphviz ~~~~~~~~~~~~~~~~~~~~~~~~ @@ -34,7 +33,9 @@ class GraphvizLexer(RegexLexer): (r'(?i)(node|edge|graph|digraph|subgraph|strict)\b', Keyword), (r'--|->', Operator), (r'[{}[\]:;,]', Punctuation), - (r'(\b\D\w*)(\s*)(=)(\s*)', bygroups(Name.Attribute, Whitespace, Punctuation, Whitespace), 'attr_id'), + (r'(\b\D\w*)(\s*)(=)(\s*)', + bygroups(Name.Attribute, Whitespace, Punctuation, Whitespace), + 'attr_id'), (r'\b(n|ne|e|se|s|sw|w|nw|c|_)\b', Name.Builtin), (r'\b\D\w*', Name.Tag), # node (r'[-]?((\.[0-9]+)|([0-9]+(\.[0-9]*)?))', Number), diff --git a/pygments/lexers/javascript.py b/pygments/lexers/javascript.py index 2f9b9b1c..a06272b4 100644 --- a/pygments/lexers/javascript.py +++ b/pygments/lexers/javascript.py @@ -486,8 +486,10 @@ class TypeScriptLexer(RegexLexer): (r'(for|in|while|do|break|return|continue|switch|case|default|if|else|' r'throw|try|catch|finally|new|delete|typeof|instanceof|void|of|' r'this|async|await|debugger|yield|abstract|static|import|export|' - r'implements|super|extends|private|protected|public|readonly)\b', Keyword, 'slashstartsregex'), - (r'(var|let|const|with|function|class|type|enum|interface)\b', Keyword.Declaration, 'slashstartsregex'), + r'implements|super|extends|private|protected|public|readonly)\b', + Keyword, 'slashstartsregex'), + (r'(var|let|const|with|function|class|type|enum|interface)\b', + Keyword.Declaration, 'slashstartsregex'), (r'(boolean|byte|char|double|final|float|goto|int|long|native|' r'package|short|synchronized|throws|transient|volatile)\b', Keyword.Reserved), (r'(true|false|null|NaN|Infinity|undefined)\b', Keyword.Constant), diff --git a/pygments/styles/material.py b/pygments/styles/material.py index c8fec164..c7012fe5 100644 --- a/pygments/styles/material.py +++ b/pygments/styles/material.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ pygments.styles.material ~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/pygments/styles/zenburn.py b/pygments/styles/zenburn.py index b97984e8..8797df7f 100644 --- a/pygments/styles/zenburn.py +++ b/pygments/styles/zenburn.py @@ -7,7 +7,7 @@ See: https://kippura.org/zenburnpage/ https://github.com/jnurmine/Zenburn - :copyright: Copyright 2006-2020 by the Pygments team, see AUTHORS. + :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ diff --git a/tests/test_html_lexer.py b/tests/test_html_lexer.py index ddf42ebb..0d4f0824 100644 --- a/tests/test_html_lexer.py +++ b/tests/test_html_lexer.py @@ -28,7 +28,8 @@ def test_happy_javascript_fragment(lexer_html): start_time = time.time() tokens = list(lexer_html.get_tokens(fragment)) assert all(x[1] != Token.Error for x in tokens) - assert time.time() - start_time < MAX_HL_TIME, 'The HTML lexer might have an expensive happy-path script case' + assert time.time() - start_time < MAX_HL_TIME, \ + 'The HTML lexer might have an expensive happy-path script case' def test_happy_css_fragment(lexer_html): @@ -38,7 +39,8 @@ def test_happy_css_fragment(lexer_html): start_time = time.time() tokens = list(lexer_html.get_tokens(fragment)) assert all(x[1] != Token.Error for x in tokens) - assert time.time() - start_time < MAX_HL_TIME, 'The HTML lexer might have an expensive happy-path style case' + assert time.time() - start_time < MAX_HL_TIME, \ + 'The HTML lexer might have an expensive happy-path style case' def test_long_unclosed_javascript_fragment(lexer_html): @@ -48,7 +50,8 @@ def test_long_unclosed_javascript_fragment(lexer_html): fragment = "<script type=\"text/javascript\">"+"alert(\"hi\");"*reps start_time = time.time() tokens = list(lexer_html.get_tokens(fragment)) - assert time.time() - start_time < MAX_HL_TIME, 'The HTML lexer might have an expensive error script case' + assert time.time() - start_time < MAX_HL_TIME, \ + 'The HTML lexer might have an expensive error script case' tokens_intro = [ (Token.Punctuation, '<'), (Token.Name.Tag, 'script'), @@ -82,7 +85,8 @@ def test_long_unclosed_css_fragment(lexer_html): fragment = "<style>"+".ui-helper-hidden{display:none}"*reps start_time = time.time() tokens = list(lexer_html.get_tokens(fragment)) - assert time.time() - start_time < MAX_HL_TIME, 'The HTML lexer might have an expensive error style case' + assert time.time() - start_time < MAX_HL_TIME, \ + 'The HTML lexer might have an expensive error style case' tokens_intro = [ (Token.Punctuation, '<'), |