changeset 52647:ab7b4fba8bde

pyupgrade: drop a few redundant types in `isinstance` lists This was rewritten by the `constant_fold` fixer in `pyupgrade`. I suspect that one of these `int`s were `long` in the py2 days, and some automated py2 -> py3 tool wasn't smart enough to elide these.
author Matt Harbison <matt_harbison@yahoo.com>
date Mon, 06 Jan 2025 01:06:59 -0500
parents cb769c0ffe35
children abc327f9628b
files mercurial/formatter.py mercurial/templatefilters.py
diffstat 2 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/formatter.py	Mon Jan 06 00:38:32 2025 -0500
+++ b/mercurial/formatter.py	Mon Jan 06 01:06:59 2025 -0500
@@ -148,7 +148,7 @@
     Returns False if the object is unsupported or must be pre-processed by
     formatdate(), formatdict(), or formatlist().
     """
-    return isinstance(obj, (type(None), bool, int, int, float, bytes))
+    return isinstance(obj, (type(None), bool, int, float, bytes))
 
 
 class _nullconverter:
--- a/mercurial/templatefilters.py	Mon Jan 06 00:38:32 2025 -0500
+++ b/mercurial/templatefilters.py	Mon Jan 06 01:06:59 2025 -0500
@@ -332,7 +332,7 @@
         return b'false'
     elif obj is True:
         return b'true'
-    elif isinstance(obj, (int, int, float)):
+    elif isinstance(obj, (int, float)):
         return pycompat.bytestr(obj)
     elif isinstance(obj, bytes):
         return b'"%s"' % encoding.jsonescape(obj, paranoid=paranoid)