Skip to content

Commit

Permalink
added strtobool docstring and removed unnecessary elifs
Browse files Browse the repository at this point in the history
  • Loading branch information
x86-69 authored and zerwes committed May 10, 2024
1 parent 8236f9f commit ad96434
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions hiyapyco/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,12 +521,14 @@ def load(*args, **kwargs):
return hiyapyco.data()

def strtobool(val):
"""
minimal implementation of the strtobool function (replaces deprecated distutils)
"""
val = val.lower()
if val in ("y", "yes", "t", "true", "on", "1"):
return 1
elif val in ("n", "no", "f", "false", "off", "0"):
if val in ("n", "no", "f", "false", "off", "0"):
return 0
else:
raise ValueError("invalid truth value %r" % (val,))
raise ValueError("invalid truth value %r" % (val,))

# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 smartindent nu

0 comments on commit ad96434

Please sign in to comment.