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