From 78317a4cfb2cc7958ebd553ff6d7cc1aff0d8296 Mon Sep 17 00:00:00 2001 From: Michal Siska <94260368+515k4@users.noreply.github.com> Date: Mon, 15 Nov 2021 17:51:56 +0100 Subject: [PATCH] Removed distutils import from autoload/black.vim (#2607) (#2610) --- CHANGES.md | 4 ++++ autoload/black.vim | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 0d409d778af..c565fbe50ca 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -12,6 +12,10 @@ - Add support for parenthesized with (#2586) - Declare support for Python 3.10 for running Black (#2562) +### Integrations + +- Fixed vim plugin with Python 3.10 by removing deprecated distutils import (#2610) + ## 21.10b0 ### _Black_ diff --git a/autoload/black.vim b/autoload/black.vim index 9ff5c2341fe..6c3bbfea81d 100644 --- a/autoload/black.vim +++ b/autoload/black.vim @@ -3,8 +3,13 @@ import collections import os import sys import vim -from distutils.util import strtobool +def strtobool(text): + if text.lower() in ['y', 'yes', 't', 'true' 'on', '1']: + return True + if text.lower() in ['n', 'no', 'f', 'false' 'off', '0']: + return False + raise ValueError(f"{text} is not convertable to boolean") class Flag(collections.namedtuple("FlagBase", "name, cast")): @property