Skip to content

Commit 684b48c

Browse files
committed
Removes distutils
1 parent 328ae27 commit 684b48c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tasks.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""Tasks for use with Invoke."""
22
import os
33
import sys
4-
from distutils.util import strtobool
54
from invoke import task
65

76
try:
@@ -16,14 +15,20 @@ def is_truthy(arg):
1615
Examples:
1716
>>> is_truthy('yes')
1817
True
19-
2018
Args:
2119
arg (str): Truthy string (True values are y, yes, t, true, on and 1; false values are n, no,
2220
f, false, off and 0. Raises ValueError if val is anything else.
2321
"""
2422
if isinstance(arg, bool):
2523
return arg
26-
return bool(strtobool(arg))
24+
25+
val = str(arg).lower()
26+
if val in ("y", "yes", "t", "true", "on", "1"):
27+
return True
28+
elif val in ("n", "no", "f", "false", "off", "0"):
29+
return False
30+
else:
31+
raise ValueError(f"Invalid truthy value: `{arg}`")
2732

2833

2934
PYPROJECT_CONFIG = toml.load("pyproject.toml")

0 commit comments

Comments
 (0)