Skip to content

Commit

Permalink
Replace distutils usage in amcrest.utils
Browse files Browse the repository at this point in the history
Closes: #234
  • Loading branch information
mweinelt committed May 28, 2024
1 parent 3c3fa58 commit 5bb5dc9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/amcrest/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from typing import List

# pylint: disable=no-name-in-module
from distutils import util
from typing import List, Tuple, Union

DATEFMT = "%Y-%m-%d %H:%M:%S"
Expand Down Expand Up @@ -53,7 +52,12 @@ def str2bool(value: Union[str, int]) -> bool:
False values: n, no, false, off, 0
"""
if isinstance(value, str):
return bool(util.strtobool(value))
if value in ["y", "yes", "true", "t", "on", "1"]:
return True
elif value in ["n", "no", "false", "off", "0"]:
return False
else:
raise ValueError
return bool(value)


Expand Down

0 comments on commit 5bb5dc9

Please sign in to comment.