Mercurial > public > mercurial-scm > hg
comparison hgext/phabricator.py @ 52639:9db77d46de79
py3: drop redundant `u''` prefixes on string literals
Strings are unicode on Python 3. These were rewritten by `pyupgrade`.
It's arguably better to fix the `contrib` stuff upstream and then re-vendor it,
but I don't feel like waiting for that, and then all of the regression testing
involved to get a minor improvement in the codebase. It was last vendored 5
years ago, and will likely be a large change anyway to drop py2 support. Also,
we've already made minor formatting changes to it locally.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Mon, 06 Jan 2025 14:15:40 -0500 |
parents | f4733654f144 |
children | 24ee91ba9aa8 |
comparison
equal
deleted
inserted
replaced
52638:dc36535a5edc | 52639:9db77d46de79 |
---|---|
488 # json.dumps only accepts unicode strings | 488 # json.dumps only accepts unicode strings |
489 result = pycompat.rapply( | 489 result = pycompat.rapply( |
490 lambda x: encoding.unifromlocal(x) if isinstance(x, bytes) else x, | 490 lambda x: encoding.unifromlocal(x) if isinstance(x, bytes) else x, |
491 callconduit(ui, name, params), | 491 callconduit(ui, name, params), |
492 ) | 492 ) |
493 s = json.dumps(result, sort_keys=True, indent=2, separators=(u',', u': ')) | 493 s = json.dumps(result, sort_keys=True, indent=2, separators=(',', ': ')) |
494 ui.write(b'%s\n' % encoding.unitolocal(s)) | 494 ui.write(b'%s\n' % encoding.unitolocal(s)) |
495 | 495 |
496 | 496 |
497 def getrepophid(repo): | 497 def getrepophid(repo): |
498 """given callsign, return repository PHID or None""" | 498 """given callsign, return repository PHID or None""" |