Mercurial > hg
changeset 42388:04eb3c5607af
contrib: fix import-checker to operate on str instead of bytes
I believe this is fallout from other Python 3 cleanups, and our code
linting tools are now leaning towards operating on str and not
bytes. I don't feel strongly, so I've just restored this tool to
working on Python 3.
Differential Revision: https://phab.mercurial-scm.org/D6453
author | Augie Fackler <augie@google.com> |
---|---|
date | Wed, 29 May 2019 09:55:35 -0400 |
parents | 91452f62dd53 |
children | 055687fe4c47 |
files | contrib/import-checker.py |
diffstat | 1 files changed, 10 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/import-checker.py Tue May 28 16:12:11 2019 -0700 +++ b/contrib/import-checker.py Wed May 29 09:55:35 2019 -0400 @@ -649,15 +649,15 @@ ... print("%s %s %d" % (_forcestr(m), _forcestr(f), l)) ... print(repr(_forcestr(s))) >>> lines = [ - ... b'comment', - ... b' >>> from __future__ import print_function', - ... b" >>> ' multiline", - ... b" ... string'", - ... b' ', - ... b'comment', - ... b' $ cat > foo.py <<EOF', - ... b' > from __future__ import print_function', - ... b' > EOF', + ... 'comment', + ... ' >>> from __future__ import print_function', + ... " >>> ' multiline", + ... " ... string'", + ... ' ', + ... 'comment', + ... ' $ cat > foo.py <<EOF', + ... ' > from __future__ import print_function', + ... ' > EOF', ... ] >>> test(b"example.t", lines) example[2] doctest.py 1 @@ -694,7 +694,7 @@ yield src.read(), modname, f, 0 py = True if py or f.endswith('.t'): - with open(f, 'rb') as src: + with open(f, 'r') as src: for script, modname, t, line in embedded(f, modname, src): yield script, modname.encode('utf8'), t, line