Skip to content

Commit 7cbe291

Browse files
behrmannjelly
authored andcommitted
scanner: drop re.ASCII check
This too, was a Python 2.7 workaround introduced in 35ffc33.
1 parent cdabb21 commit 7cbe291

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

varlink/scanner.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,17 @@ class Scanner:
1414
"""Class for scanning a varlink interface definition."""
1515

1616
def __init__(self, string):
17-
if hasattr(re, "ASCII"):
18-
ASCII = re.ASCII
19-
else:
20-
ASCII = 0
21-
self.whitespace = re.compile(r'([ \t\n]|#.*$)+', ASCII | re.MULTILINE)
17+
self.whitespace = re.compile(r'([ \t\n]|#.*$)+', re.ASCII | re.MULTILINE)
2218
self.docstring = re.compile(r'(?:.?)+#(.*)(?:\n|\r\n)')
2319
# FIXME: nested ()
2420
self.method_signature = re.compile(r'([ \t\n]|#.*$)*(\([^)]*\))([ \t\n]|#.*$)*->([ \t\n]|#.*$)*(\([^)]*\))',
25-
ASCII | re.MULTILINE)
21+
re.ASCII | re.MULTILINE)
2622

27-
self.keyword_pattern = re.compile(r'\b[a-z]+\b|[:,(){}]|->|\[\]|\?|\[string\]\(\)|\[string\]', ASCII)
23+
self.keyword_pattern = re.compile(r'\b[a-z]+\b|[:,(){}]|->|\[\]|\?|\[string\]\(\)|\[string\]', re.ASCII)
2824
self.patterns = {
2925
'interface-name': re.compile(r'[A-Za-z]([A-Za-z])*([.][A-Za-z0-9]([-]*[A-Za-z0-9])*)+|xn--([0-9a-z])*([.][A-Za-z0-9]([-]*[A-Za-z0-9])*)+'),
30-
'member-name': re.compile(r'\b[A-Z][A-Za-z0-9]*\b', ASCII),
31-
'identifier': re.compile(r'\b[A-Za-z]([_]?[A-Za-z0-9])*\b', ASCII),
26+
'member-name': re.compile(r'\b[A-Z][A-Za-z0-9]*\b', re.ASCII),
27+
'identifier': re.compile(r'\b[A-Za-z]([_]?[A-Za-z0-9])*\b', re.ASCII),
3228
}
3329

3430
self.string = string

0 commit comments

Comments
 (0)