Mercurial > public > mercurial-scm > hg
changeset 52653:b3e68fd7864b
pyupgrade: primitive types directly where possible
This was rewritten by the `type_of_primitive` fixer in `pyupgrade`.
Interesting that 9db77d46de79 missed a bunch of these `u''` prefixes.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Mon, 06 Jan 2025 01:39:53 -0500 |
parents | 0e713555ecdc |
children | f19a3f1437f3 |
files | mercurial/fancyopts.py mercurial/mail.py mercurial/scmutil.py mercurial/templatefilters.py tests/dummysmtpd.py |
diffstat | 5 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/fancyopts.py Mon Jan 06 01:37:43 2025 -0500 +++ b/mercurial/fancyopts.py Mon Jan 06 01:39:53 2025 -0500 @@ -273,7 +273,7 @@ return _callableopt(default) elif isinstance(default, list): return _listopt(default[:]) - elif type(default) is type(1): + elif type(default) is int: return _intopt(default) else: return _simpleopt(default)
--- a/mercurial/mail.py Mon Jan 06 01:37:43 2025 -0500 +++ b/mercurial/mail.py Mon Jan 06 01:39:53 2025 -0500 @@ -519,7 +519,7 @@ pass # On Python 3, decode_header() may return either bytes or unicode # depending on whether the header has =?<charset>? or not - if isinstance(part, type(u'')): + if isinstance(part, str): uparts.append(part) continue try:
--- a/mercurial/scmutil.py Mon Jan 06 01:37:43 2025 -0500 +++ b/mercurial/scmutil.py Mon Jan 06 01:39:53 2025 -0500 @@ -214,7 +214,7 @@ except error.ResponseError as inst: ui.error(_(b"abort: %s") % inst.args[0]) msg = inst.args[1] - if isinstance(msg, type(u'')): + if isinstance(msg, str): msg = pycompat.sysbytes(msg) if msg is None: ui.error(b"\n")
--- a/mercurial/templatefilters.py Mon Jan 06 01:37:43 2025 -0500 +++ b/mercurial/templatefilters.py Mon Jan 06 01:39:53 2025 -0500 @@ -336,7 +336,7 @@ return pycompat.bytestr(obj) elif isinstance(obj, bytes): return b'"%s"' % encoding.jsonescape(obj, paranoid=paranoid) - elif isinstance(obj, type(u'')): + elif isinstance(obj, str): raise error.ProgrammingError( b'Mercurial only does output with bytes: %r' % obj )