##// END OF EJS Templates
py3: add b'' to literals in check-config.py...
Pulkit Goyal -
r35938:2912bed9 default
parent child Browse files
Show More
@@ -15,7 +15,7 b' foundopts = {}'
15 documented = {}
15 documented = {}
16 allowinconsistent = set()
16 allowinconsistent = set()
17
17
18 configre = re.compile(r'''
18 configre = re.compile(br'''
19 # Function call
19 # Function call
20 ui\.config(?P<ctype>|int|bool|list)\(
20 ui\.config(?P<ctype>|int|bool|list)\(
21 # First argument.
21 # First argument.
@@ -25,7 +25,7 b" configre = re.compile(r'''"
25 (?:default=)?(?P<default>\S+?))?
25 (?:default=)?(?P<default>\S+?))?
26 \)''', re.VERBOSE | re.MULTILINE)
26 \)''', re.VERBOSE | re.MULTILINE)
27
27
28 configwithre = re.compile('''
28 configwithre = re.compile(b'''
29 ui\.config(?P<ctype>with)\(
29 ui\.config(?P<ctype>with)\(
30 # First argument is callback function. This doesn't parse robustly
30 # First argument is callback function. This doesn't parse robustly
31 # if it is e.g. a function call.
31 # if it is e.g. a function call.
@@ -35,57 +35,57 b" configwithre = re.compile('''"
35 (?:default=)?(?P<default>\S+?))?
35 (?:default=)?(?P<default>\S+?))?
36 \)''', re.VERBOSE | re.MULTILINE)
36 \)''', re.VERBOSE | re.MULTILINE)
37
37
38 configpartialre = (r"""ui\.config""")
38 configpartialre = (br"""ui\.config""")
39
39
40 ignorere = re.compile(r'''
40 ignorere = re.compile(br'''
41 \#\s(?P<reason>internal|experimental|deprecated|developer|inconsistent)\s
41 \#\s(?P<reason>internal|experimental|deprecated|developer|inconsistent)\s
42 config:\s(?P<config>\S+\.\S+)$
42 config:\s(?P<config>\S+\.\S+)$
43 ''', re.VERBOSE | re.MULTILINE)
43 ''', re.VERBOSE | re.MULTILINE)
44
44
45 def main(args):
45 def main(args):
46 for f in args:
46 for f in args:
47 sect = ''
47 sect = b''
48 prevname = ''
48 prevname = b''
49 confsect = ''
49 confsect = b''
50 carryover = ''
50 carryover = b''
51 linenum = 0
51 linenum = 0
52 for l in open(f, 'rb'):
52 for l in open(f, 'rb'):
53 linenum += 1
53 linenum += 1
54
54
55 # check topic-like bits
55 # check topic-like bits
56 m = re.match('\s*``(\S+)``', l)
56 m = re.match(b'\s*``(\S+)``', l)
57 if m:
57 if m:
58 prevname = m.group(1)
58 prevname = m.group(1)
59 if re.match('^\s*-+$', l):
59 if re.match(b'^\s*-+$', l):
60 sect = prevname
60 sect = prevname
61 prevname = ''
61 prevname = b''
62
62
63 if sect and prevname:
63 if sect and prevname:
64 name = sect + '.' + prevname
64 name = sect + b'.' + prevname
65 documented[name] = 1
65 documented[name] = 1
66
66
67 # check docstring bits
67 # check docstring bits
68 m = re.match(r'^\s+\[(\S+)\]', l)
68 m = re.match(br'^\s+\[(\S+)\]', l)
69 if m:
69 if m:
70 confsect = m.group(1)
70 confsect = m.group(1)
71 continue
71 continue
72 m = re.match(r'^\s+(?:#\s*)?(\S+) = ', l)
72 m = re.match(br'^\s+(?:#\s*)?(\S+) = ', l)
73 if m:
73 if m:
74 name = confsect + '.' + m.group(1)
74 name = confsect + b'.' + m.group(1)
75 documented[name] = 1
75 documented[name] = 1
76
76
77 # like the bugzilla extension
77 # like the bugzilla extension
78 m = re.match(r'^\s*(\S+\.\S+)$', l)
78 m = re.match(br'^\s*(\S+\.\S+)$', l)
79 if m:
79 if m:
80 documented[m.group(1)] = 1
80 documented[m.group(1)] = 1
81
81
82 # like convert
82 # like convert
83 m = re.match(r'^\s*:(\S+\.\S+):\s+', l)
83 m = re.match(br'^\s*:(\S+\.\S+):\s+', l)
84 if m:
84 if m:
85 documented[m.group(1)] = 1
85 documented[m.group(1)] = 1
86
86
87 # quoted in help or docstrings
87 # quoted in help or docstrings
88 m = re.match(r'.*?``(\S+\.\S+)``', l)
88 m = re.match(br'.*?``(\S+\.\S+)``', l)
89 if m:
89 if m:
90 documented[m.group(1)] = 1
90 documented[m.group(1)] = 1
91
91
@@ -108,7 +108,7 b' def main(args):'
108 default = m.group('default')
108 default = m.group('default')
109 if default in (None, 'False', 'None', '0', '[]', '""', "''"):
109 if default in (None, 'False', 'None', '0', '[]', '""', "''"):
110 default = ''
110 default = ''
111 if re.match('[a-z.]+$', default):
111 if re.match(b'[a-z.]+$', default):
112 default = '<variable>'
112 default = '<variable>'
113 if (name in foundopts and (ctype, default) != foundopts[name]
113 if (name in foundopts and (ctype, default) != foundopts[name]
114 and name not in allowinconsistent):
114 and name not in allowinconsistent):
General Comments 0
You need to be logged in to leave comments. Login now