Skip to content

Commit

Permalink
remove deprecate dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
masci committed Apr 27, 2024
1 parent 51be2c7 commit 28018b6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,5 @@ exclude_lines = [
module = [
"simplemma.*",
"litellm.*",
"distutils.*",
]
ignore_missing_imports = true
19 changes: 18 additions & 1 deletion src/banks/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,31 @@
#
# SPDX-License-Identifier: MIT
import os
from distutils.util import strtobool

from jinja2 import Environment, select_autoescape

from banks.extensions import GenerateExtension, HFInferenceEndpointsExtension
from banks.filters import lemmatize
from banks.loader import MultiLoader


def strtobool(val: str) -> bool:
"""Convert a string representation of truth to True or False.
True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values
are 'n', 'no', 'f', 'false', 'off', and '0'. Raises ValueError if
'val' is anything else.
"""
val = val.lower()
if val in ("y", "yes", "t", "true", "on", "1"):
return True
elif val in ("n", "no", "f", "false", "off", "0"):
return False
else:
msg = f"invalid truth value {val}"
raise ValueError(msg)


async_enabled = strtobool(os.environ.get("BANKS_ASYNC_ENABLED", "false"))

# Init the Jinja env
Expand Down

0 comments on commit 28018b6

Please sign in to comment.