-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(requirements): internalize
humanfriendly
- Loading branch information
1 parent
bc1f25b
commit cb816df
Showing
4 changed files
with
25 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ click | |
coloredlogs | ||
dataclasses_json | ||
gitignorefile | ||
humanfriendly | ||
importlib_metadata | ||
inflection | ||
inquirer | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ click | |
|
||
dataclasses_json | ||
|
||
humanfriendly | ||
|
||
inflection | ||
|
||
|