From: Andrew Zhou Date: Fri, 8 May 2020 13:01:42 +0000 (-0500) Subject: Add error on non-list target-version in config file (#1284) X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/9938c92fd72deda1156aca79946d7996a5365eaa?ds=inline Add error on non-list target-version in config file (#1284) --- diff --git a/black.py b/black.py index ff4f098..b3f387a 100644 --- a/black.py +++ b/black.py @@ -296,6 +296,12 @@ def read_pyproject_toml( if not config: return None + target_version = config.get("target_version") + if target_version is not None and not isinstance(target_version, list): + raise click.BadOptionUsage( + "target-version", f"Config key target-version must be a list" + ) + default_map: Dict[str, Any] = {} if ctx.default_map: default_map.update(ctx.default_map)