Skip to content

Commit ae69ffb

Browse files
authored
Fix python-lint violations in previous commit. (#4284)
1 parent ca14c36 commit ae69ffb

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

utils/pygments/swift.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
from pygments.lexer import (
66
RegexLexer,
77
bygroups,
8-
include,
98
default,
9+
include,
1010
)
1111
from pygments.token import (
1212
Comment,
@@ -23,6 +23,7 @@
2323

2424
__all__ = ['SwiftLexer', 'SILLexer', 'SwiftConsoleLexer']
2525

26+
2627
class SwiftLexer(RegexLexer):
2728
name = 'Swift'
2829
aliases = ['swift']
@@ -33,7 +34,8 @@ class SwiftLexer(RegexLexer):
3334
_isa = r'([a-zA-Z_][a-zA-Z0-9_]*)(\s*)(:)(\s*)([A-Z0-9_][a-zA-Z0-9_]*)'
3435
_isa_comma = r'([a-zA-Z_][a-zA-Z0-9_]*)(\s*)(:)(\s*)' + \
3536
'([A-Z0-9_][a-zA-Z0-9_]*)(,\s?)'
36-
_name = u'([@a-zA-Z_\U00000100-\U00100000][a-zA-Z0-9_\U00000100-\U00100000]*)'
37+
_name = u'([@a-zA-Z_\U00000100-\U00100000]' + \
38+
u'[a-zA-Z0-9_\U00000100-\U00100000]*)'
3739

3840
tokens = {
3941

@@ -51,7 +53,8 @@ class SwiftLexer(RegexLexer):
5153
],
5254

5355
'func-class-list': [
54-
(r'\b(func|init|deinit|class func|public func)\s', Keyword.Declaration, 'func-decl'),
56+
(r'\b(func|init|deinit|class func|public func)\s',
57+
Keyword.Declaration, 'func-decl'),
5558
],
5659

5760
'comment': [
@@ -66,7 +69,7 @@ class SwiftLexer(RegexLexer):
6669
'body': [
6770
include('comment'),
6871
include('name'),
69-
(r'\.{3}', Generic.Emph), # emphasize ellipses
72+
(r'\.{3}', Generic.Emph), # emphasize ellipses
7073
(r'[\~\^\*!%&<>+=/?-]|\.{2}', Operator),
7174
include('token-list'),
7275
(r'[\[\]\(\)\{\}\|:;,.#]', Punctuation),
@@ -254,7 +257,8 @@ class SwiftLexer(RegexLexer):
254257
(_name, Name.Namespace),
255258
(r',\s*', Punctuation),
256259
(r' ', Text.Whitespace),
257-
(r'(\()(\d+\.\d+)(\))', bygroups(Punctuation, Number.Float, Punctuation)),
260+
(r'(\()(\d+\.\d+)(\))', bygroups(
261+
Punctuation, Number.Float, Punctuation)),
258262
default('#pop'),
259263
],
260264

@@ -266,12 +270,14 @@ class SwiftLexer(RegexLexer):
266270
Punctuation,
267271
Whitespace)),
268272
include('class-isa'),
269-
(r'(\*?)([a-zA-Z_][a-zA-Z0-9_?]*)', bygroups(Punctuation, Name.Class)),
273+
(r'(\*?)([a-zA-Z_][a-zA-Z0-9_?]*)', bygroups(
274+
Punctuation, Name.Class)),
270275
(r'\.', Punctuation),
271276
(r'<', Punctuation, 'generic-type'),
272277
(r':', Punctuation, 'name-list'),
273278
(r'\s', Whitespace),
274-
(r'\s?(,)(\s*)([A-Z0-9_][a-zA-Z0-9_]*)', bygroups(Punctuation, Whitespace, Name.Constant)),
279+
(r'\s?(,)(\s*)([A-Z0-9_][a-zA-Z0-9_]*)', bygroups(
280+
Punctuation, Whitespace, Name.Constant)),
275281
(r'<', Punctuation, 'generic-type'),
276282
(r'where', Keyword.Reserved),
277283
default("#pop"),

0 commit comments

Comments
 (0)