Mercurial > public > mercurial-scm > hg
comparison mercurial/utils/procutil.py @ 48913:f254fc73d956
global: bulk replace simple pycompat.iteritems(x) with x.items()
pycompat.iteritems() just calls .items().
This commit applies a regular expression search and replace to convert
simple instances of pycompat.iteritems() with .items(). There are still
a handful of calls to pycompat.iteritems() remaining. But these all have
more complicated expressions that I wasn't comfortable performing an
automated replace on. In addition, some simple replacements were withheld
because they broke pytype. These will be handled by their own changesets.
Differential Revision: https://phab.mercurial-scm.org/D12318
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 03 Mar 2022 18:28:30 -0800 |
parents | 3681b4c56618 |
children | 642e31cb55f0 |
comparison
equal
deleted
inserted
replaced
48912:a0674e916fb6 | 48913:f254fc73d956 |
---|---|
340 | 340 |
341 | 341 |
342 def filter(s, cmd): | 342 def filter(s, cmd): |
343 """filter a string through a command that transforms its input to its | 343 """filter a string through a command that transforms its input to its |
344 output""" | 344 output""" |
345 for name, fn in pycompat.iteritems(_filtertable): | 345 for name, fn in _filtertable.items(): |
346 if cmd.startswith(name): | 346 if cmd.startswith(name): |
347 return fn(s, cmd[len(name) :].lstrip()) | 347 return fn(s, cmd[len(name) :].lstrip()) |
348 return pipefilter(s, cmd) | 348 return pipefilter(s, cmd) |
349 | 349 |
350 | 350 |
446 return b'1' | 446 return b'1' |
447 return pycompat.bytestr(val) | 447 return pycompat.bytestr(val) |
448 | 448 |
449 env = dict(encoding.environ) | 449 env = dict(encoding.environ) |
450 if environ: | 450 if environ: |
451 env.update((k, py2shell(v)) for k, v in pycompat.iteritems(environ)) | 451 env.update((k, py2shell(v)) for k, v in environ.items()) |
452 env[b'HG'] = hgexecutable() | 452 env[b'HG'] = hgexecutable() |
453 return env | 453 return env |
454 | 454 |
455 | 455 |
456 if pycompat.iswindows: | 456 if pycompat.iswindows: |