Skip to content

Commit 2f7446d

Browse files
committed
Trust tox4's type conversion
1 parent e7bd271 commit 2f7446d

1 file changed

Lines changed: 2 additions & 14 deletions

File tree

tox_docker/tox4/config.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,6 @@ def image_required(image: Image) -> Image:
1919
return image
2020

2121

22-
def getboolean(val: str) -> bool:
23-
# Same implementation as:
24-
# https://docs.python.org/3/library/configparser.html#configparser.ConfigParser.getboolean
25-
lower_val = val.lower().strip()
26-
if lower_val in ("yes", "on", "true", "1"):
27-
return True
28-
if lower_val in ("no", "off", "false", "0"):
29-
return False
30-
raise ValueError(f"{val!r} is not a boolean")
31-
32-
3322
class DockerConfigSet(ConfigSet):
3423
def register_config(self) -> None:
3524
self.add_config(
@@ -41,10 +30,9 @@ def register_config(self) -> None:
4130
)
4231
self.add_config(
4332
keys=["privileged"],
44-
of_type=str,
45-
default="false",
33+
of_type=bool,
34+
default=False,
4635
desc="give extended privileges to this container",
47-
post_process=getboolean,
4836
)
4937
self.add_config(
5038
keys=["environment"],

0 commit comments

Comments
 (0)