mirror of
https://github.com/thegeeklab/git-batch.git
synced 2024-11-21 10:30:39 +00:00
fix: remove deprecated distutils (#307)
This commit is contained in:
parent
81ee9798bf
commit
5ca1f57567
@ -2,7 +2,6 @@
|
||||
"""Global utility methods and classes."""
|
||||
|
||||
import os
|
||||
from distutils.util import strtobool
|
||||
|
||||
|
||||
def normalize_path(path):
|
||||
@ -12,6 +11,30 @@ def normalize_path(path):
|
||||
return None
|
||||
|
||||
|
||||
def strtobool(value):
|
||||
"""Convert a string representation of truth to true or false."""
|
||||
|
||||
_map = {
|
||||
"y": True,
|
||||
"yes": True,
|
||||
"t": True,
|
||||
"true": True,
|
||||
"on": True,
|
||||
"1": True,
|
||||
"n": False,
|
||||
"no": False,
|
||||
"f": False,
|
||||
"false": False,
|
||||
"off": False,
|
||||
"0": False
|
||||
}
|
||||
|
||||
try:
|
||||
return _map[str(value).lower()]
|
||||
except KeyError as err:
|
||||
raise ValueError(f'"{value}" is not a valid bool value') from err
|
||||
|
||||
|
||||
def to_bool(string):
|
||||
return bool(strtobool(str(string)))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user