Skip to content

Commit

Permalink
feat(requirements): internalize humanfriendly
Browse files Browse the repository at this point in the history
  • Loading branch information
Caceresenzo committed Oct 26, 2024
1 parent bc1f25b commit cb816df
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
24 changes: 24 additions & 0 deletions crunch/external/humanfriendly.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# https://pypi.org/project/humanfriendly/

# from humanfriendly/text.py
def format(text, *args, **kw):
if args:
text %= args
if kw:
text = text.format(**kw)
return text


# from humanfriendly/__init__.py
def coerce_boolean(value):
if isinstance(value, str):
normalized = value.strip().lower()
if normalized in ('1', 'yes', 'true', 'on'):
return True
elif normalized in ('0', 'no', 'false', 'off', ''):
return False
else:
msg = "Failed to coerce string to boolean! (%r)"
raise ValueError(format(msg, value))
else:
return bool(value)
2 changes: 1 addition & 1 deletion crunch/store.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import os

import dotenv
import humanfriendly

from . import constants
from .external import humanfriendly

debug: bool = None
web_base_url: str = None
Expand Down
1 change: 0 additions & 1 deletion requirements/default.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ click
coloredlogs
dataclasses_json
gitignorefile
humanfriendly
importlib_metadata
inflection
inquirer
Expand Down
1 change: 0 additions & 1 deletion requirements/runner.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ click

dataclasses_json

humanfriendly

inflection

Expand Down

0 comments on commit cb816df

Please sign in to comment.