Skip to content

Commit

Permalink
Uses str_to_bool 1.0.3
Browse files Browse the repository at this point in the history
It was specially made for us; thank you @sassanh!
  • Loading branch information
hoijui committed Dec 13, 2024
1 parent d9eca04 commit 96fa929
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 19 deletions.
18 changes: 1 addition & 17 deletions krawl/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,10 @@
from collections.abc import Mapping, MutableMapping
from copy import deepcopy
from datetime import datetime
# from str_to_bool import str_to_bool
from str_to_bool import str_to_bool
from pathlib import Path
from typing import Any

"""Implementation of str_to_bool from Python 3.8.2.""" # HACK Copied from library python-strtobool, because it does not support python < 3.9
def str_to_bool(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
if val in ('n', 'no', 'f', 'false', 'off', '0'):
return False
msg = f'Invalid truth value "{val}"'
raise ValueError(msg)

import yaml
from cerberus import TypeDefinition, Validator
from cerberus.errors import REQUIRED_FIELD, BasicErrorHandler, ValidationError
Expand Down
13 changes: 12 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pathvalidate = "^2.3.2"
langdetect = "^1.0.8"
PyYAML = "^6.0"
requests-oauthlib = "^1.3.0"
# python-strtobool = "^1.0.0"
python-strtobool = "^1.0.3"
requests = "^2.26.0"
python-dateutil = "^2.8.2"
validators = "^0.18.2"
Expand Down

0 comments on commit 96fa929

Please sign in to comment.