Skip to content

Commit

Permalink
fix: Make str to bool noop if input is bool
Browse files Browse the repository at this point in the history
  • Loading branch information
czgu committed Oct 18, 2024
1 parent 7f132ae commit 37635c2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ repos:
# - '@trivago/[email protected]' # removing it since pre-commit install fails

- repo: https://github.com/PyCQA/flake8
rev: 3.9.2
rev: 7.1.1
hooks:
- id: flake8
files: "^querybook/(server|tests)/.*\\.py$"
Expand Down
4 changes: 3 additions & 1 deletion querybook/server/lib/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,10 @@ def get_default_args(func):
}


def str_to_bool(value: Optional[str]) -> bool:
def str_to_bool(value: Optional[str | bool]) -> bool:
if value is None:
return False
if isinstance(value, bool):
return value

return value.lower() in ("yes", "true", "t", "1")

0 comments on commit 37635c2

Please sign in to comment.