Patchwork [1,of,5] byteify-strings: simplify default value for `--treat-as-kwargs`

login
register
mail settings
Submitter Raphaël Gomès
Date Aug. 2, 2019, 3:01 p.m.
Message ID <4a3e6c4ac759ed0d7678.1564758082@alphare-carbon.lan>
Download mbox | patch
Permalink /patch/41133/
State Accepted
Headers show

Comments

Raphaël Gomès - Aug. 2, 2019, 3:01 p.m.
# HG changeset patch
# User Raphaël Gomès <rgomes@octobus.net>
# Date 1564755240 -7200
#      Fri Aug 02 16:14:00 2019 +0200
# Node ID 4a3e6c4ac759ed0d7678980328c0dec3824192ea
# Parent  f95b59ffc307c4549d9640a81d750a99bd75f423
# EXP-Topic byteify-strings
byteify-strings: simplify default value for `--treat-as-kwargs`
Yuya Nishihara - Aug. 3, 2019, 12:21 a.m.
On Fri, 02 Aug 2019 17:01:22 +0200, Raphaël Gomès wrote:
> # HG changeset patch
> # User Raphaël Gomès <rgomes@octobus.net>
> # Date 1564755240 -7200
> #      Fri Aug 02 16:14:00 2019 +0200
> # Node ID 4a3e6c4ac759ed0d7678980328c0dec3824192ea
> # Parent  f95b59ffc307c4549d9640a81d750a99bd75f423
> # EXP-Topic byteify-strings
> byteify-strings: simplify default value for `--treat-as-kwargs`

Queued the first two, thanks.

Patch

diff -r f95b59ffc307 -r 4a3e6c4ac759 contrib/byteify-strings.py
--- a/contrib/byteify-strings.py	Fri Aug 02 10:18:22 2019 +0200
+++ b/contrib/byteify-strings.py	Fri Aug 02 16:14:00 2019 +0200
@@ -276,15 +276,13 @@ 
                     help='edit files in place')
     ap.add_argument('--dictiter', action='store_true', default=False,
                     help='rewrite iteritems() and itervalues()'),
-    ap.add_argument('--treat-as-kwargs', nargs="+",
+    ap.add_argument('--treat-as-kwargs', nargs="+", default=[],
                     help="ignore kwargs-like objects"),
     ap.add_argument('files', metavar='FILE', nargs='+', help='source file')
     args = ap.parse_args()
     opts = {
         'dictiter': args.dictiter,
-        'treat-as-kwargs': set(
-            args.treat_as_kwargs
-        ) if args.treat_as_kwargs else set()
+        'treat-as-kwargs': set(args.treat_as_kwargs),
     }
     for fname in args.files:
         if args.inplace: