summaryrefslogtreecommitdiff
path: root/venv/lib/python3.11/site-packages/rich_click/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'venv/lib/python3.11/site-packages/rich_click/utils.py')
-rw-r--r--venv/lib/python3.11/site-packages/rich_click/utils.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/venv/lib/python3.11/site-packages/rich_click/utils.py b/venv/lib/python3.11/site-packages/rich_click/utils.py
new file mode 100644
index 0000000..128f8b1
--- /dev/null
+++ b/venv/lib/python3.11/site-packages/rich_click/utils.py
@@ -0,0 +1,16 @@
+from typing import Any, Optional
+
+
+def truthy(o: Any) -> Optional[bool]:
+ """Check if string or other obj is truthy."""
+ if isinstance(o, str):
+ if o.lower() in {"y", "yes", "t", "true", "1"}:
+ return True
+ elif o.lower() in {"n", "no", "f", "false", "0"}:
+ return False
+ else:
+ return None
+ elif o is None:
+ return None
+ else:
+ return bool(o)