Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle case of str to bool env variable in config #2966

Merged
merged 6 commits into from
Oct 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions awswrangler/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,9 @@ def _apply_type(name: str, value: Any, dtype: type[_ConfigValueType], nullable:
raise exceptions.InvalidArgumentValue(
f"{name} configuration does not accept a null value. Please pass {dtype}."
)
# Handle case where string is empty, "False" or "0". Anything else is True
if isinstance(value, str) and dtype is bool:
return value.lower() not in ("false", "0", "")
try:
return dtype(value) if isinstance(value, dtype) is False else value
except ValueError as ex:
Expand Down
Loading