Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hgweb/hgwebdir_mod.py @ 34146:0fa781320203
doctest: bulk-replace string literals with b'' for Python 3
Our code transformer can't rewrite string literals in docstrings, and I
don't want to make the transformer more complex.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 03 Sep 2017 14:32:11 +0900 |
parents | d5b2beca16c0 |
children | cf08aaaea7f0 |
comparison
equal
deleted
inserted
replaced
34145:ada8a19672ab | 34146:0fa781320203 |
---|---|
68 | 68 |
69 def urlrepos(prefix, roothead, paths): | 69 def urlrepos(prefix, roothead, paths): |
70 """yield url paths and filesystem paths from a list of repo paths | 70 """yield url paths and filesystem paths from a list of repo paths |
71 | 71 |
72 >>> conv = lambda seq: [(v, util.pconvert(p)) for v,p in seq] | 72 >>> conv = lambda seq: [(v, util.pconvert(p)) for v,p in seq] |
73 >>> conv(urlrepos('hg', '/opt', ['/opt/r', '/opt/r/r', '/opt'])) | 73 >>> conv(urlrepos(b'hg', b'/opt', [b'/opt/r', b'/opt/r/r', b'/opt'])) |
74 [('hg/r', '/opt/r'), ('hg/r/r', '/opt/r/r'), ('hg', '/opt')] | 74 [('hg/r', '/opt/r'), ('hg/r/r', '/opt/r/r'), ('hg', '/opt')] |
75 >>> conv(urlrepos('', '/opt', ['/opt/r', '/opt/r/r', '/opt'])) | 75 >>> conv(urlrepos(b'', b'/opt', [b'/opt/r', b'/opt/r/r', b'/opt'])) |
76 [('r', '/opt/r'), ('r/r', '/opt/r/r'), ('', '/opt')] | 76 [('r', '/opt/r'), ('r/r', '/opt/r/r'), ('', '/opt')] |
77 """ | 77 """ |
78 for path in paths: | 78 for path in paths: |
79 path = os.path.normpath(path) | 79 path = os.path.normpath(path) |
80 yield (prefix + '/' + | 80 yield (prefix + '/' + |
82 | 82 |
83 def geturlcgivars(baseurl, port): | 83 def geturlcgivars(baseurl, port): |
84 """ | 84 """ |
85 Extract CGI variables from baseurl | 85 Extract CGI variables from baseurl |
86 | 86 |
87 >>> geturlcgivars("http://host.org/base", "80") | 87 >>> geturlcgivars(b"http://host.org/base", b"80") |
88 ('host.org', '80', '/base') | 88 ('host.org', '80', '/base') |
89 >>> geturlcgivars("http://host.org:8000/base", "80") | 89 >>> geturlcgivars(b"http://host.org:8000/base", b"80") |
90 ('host.org', '8000', '/base') | 90 ('host.org', '8000', '/base') |
91 >>> geturlcgivars('/base', 8000) | 91 >>> geturlcgivars(b'/base', 8000) |
92 ('', '8000', '/base') | 92 ('', '8000', '/base') |
93 >>> geturlcgivars("base", '8000') | 93 >>> geturlcgivars(b"base", b'8000') |
94 ('', '8000', '/base') | 94 ('', '8000', '/base') |
95 >>> geturlcgivars("http://host", '8000') | 95 >>> geturlcgivars(b"http://host", b'8000') |
96 ('host', '8000', '/') | 96 ('host', '8000', '/') |
97 >>> geturlcgivars("http://host/", '8000') | 97 >>> geturlcgivars(b"http://host/", b'8000') |
98 ('host', '8000', '/') | 98 ('host', '8000', '/') |
99 """ | 99 """ |
100 u = util.url(baseurl) | 100 u = util.url(baseurl) |
101 name = u.host or '' | 101 name = u.host or '' |
102 if u.port: | 102 if u.port: |