Skip to content

Commit bbb6bdb

Browse files
committed
Remove deprecated distutils call for strbool
1 parent 1ed333a commit bbb6bdb

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

backend/server.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
11
#!/usr/bin/env python3
2-
from distutils.util import strtobool
32

43
# Auto scaling websocket proxy for Chrome CDP
54

6-
from distutils.util import strtobool
5+
def strtobool(val):
6+
"""Convert a string representation of truth to true (1) or false (0).
7+
8+
True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values
9+
are 'n', 'no', 'f', 'false', 'off', and '0'.
10+
"""
11+
val = val.lower()
12+
if val in ('y', 'yes', 't', 'true', 'on', '1'):
13+
return True
14+
elif val in ('n', 'no', 'f', 'false', 'off', '0'):
15+
return False
16+
else:
17+
raise ValueError(f"invalid truth value {val!r}")
18+
719
from http_server import start_http_server
820
from ports import PortSelector
921
from loguru import logger

0 commit comments

Comments
 (0)