cat: drop unnecessary internal roundtrip of kwargs
authorMatt Harbison <matt_harbison@yahoo.com>
Wed, 01 Mar 2023 11:33:57 -0500
changeset 50373 4fafc6642bee
parent 50268 ffdfb1066ac6
child 50374 4a73df6eb67d
cat: drop unnecessary internal roundtrip of kwargs PyCharm seems to stick with the type at the initial assignment, so it flagged the `get()` with a bytes key since the method argument has str keys. It wasn't a bug, but then the bytes form is otherwise unused, and converted back to str.
mercurial/cmdutil.py
--- a/mercurial/cmdutil.py	Thu Mar 02 15:34:45 2023 +0100
+++ b/mercurial/cmdutil.py	Wed Mar 01 11:33:57 2023 -0500
@@ -2754,7 +2754,6 @@
 
 def cat(ui, repo, ctx, matcher, basefm, fntemplate, prefix, **opts):
     err = 1
-    opts = pycompat.byteskwargs(opts)
 
     def write(path):
         filename = None
@@ -2768,7 +2767,7 @@
             except OSError:
                 pass
         with formatter.maybereopen(basefm, filename) as fm:
-            _updatecatformatter(fm, ctx, matcher, path, opts.get(b'decode'))
+            _updatecatformatter(fm, ctx, matcher, path, opts.get('decode'))
 
     # Automation often uses hg cat on single files, so special case it
     # for performance to avoid the cost of parsing the manifest.
@@ -2803,7 +2802,7 @@
                 basefm,
                 fntemplate,
                 subprefix,
-                **pycompat.strkwargs(opts),
+                **opts,
             ):
                 err = 0
         except error.RepoLookupError: