Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/sshpeer.py @ 43106:d783f945a701
py3: finish porting iteritems() to pycompat and remove source transformer
This commit finishes porting .iteritems() to pycompat.iteritems()
for the mercurial package.
The translation of .iteritems() to .items() was the last conversion
performed by the source transformer. With the porting to pycompat
complete, we no longer have a need for the source transformer. So
the source transformer has been removed. Good riddance! The code
base is now compatible with Python 2 and Python 3.
For the record, as the person who introduced the source transformer,
it brings me joy to delete it. It accomplished its goal to facilitate
a port to Python 3 without overly burdening people on some painful
low-level differences between Python 2 and 3. It is unfortunate we
still have to wallpaper over many differences with the pycompat
shim. But it is what it is.
Differential Revision: https://phab.mercurial-scm.org/D7015
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 07 Oct 2019 00:04:04 -0400 |
parents | c59eb1560c44 |
children | 5d77f571a563 |
comparison
equal
deleted
inserted
replaced
43105:649d3ac37a12 | 43106:d783f945a701 |
---|---|
477 wireargs[b'*'] = args | 477 wireargs[b'*'] = args |
478 break | 478 break |
479 else: | 479 else: |
480 wireargs[k] = args[k] | 480 wireargs[k] = args[k] |
481 del args[k] | 481 del args[k] |
482 for k, v in sorted(wireargs.iteritems()): | 482 for k, v in sorted(pycompat.iteritems(wireargs)): |
483 self._pipeo.write(b"%s %d\n" % (k, len(v))) | 483 self._pipeo.write(b"%s %d\n" % (k, len(v))) |
484 if isinstance(v, dict): | 484 if isinstance(v, dict): |
485 for dk, dv in v.iteritems(): | 485 for dk, dv in pycompat.iteritems(v): |
486 self._pipeo.write(b"%s %d\n" % (dk, len(dv))) | 486 self._pipeo.write(b"%s %d\n" % (dk, len(dv))) |
487 self._pipeo.write(dv) | 487 self._pipeo.write(dv) |
488 else: | 488 else: |
489 self._pipeo.write(v) | 489 self._pipeo.write(v) |
490 self._pipeo.flush() | 490 self._pipeo.flush() |