Unverified Commit 9938c92f authored by Andrew Zhou's avatar Andrew Zhou Committed by GitHub
Browse files

Add error on non-list target-version in config file (#1284)

parent 544ea9c2
Loading
Loading
Loading
Loading
+6 −0
Changes for black.py: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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)