Skip to content

Commit

Permalink
Merge branch 'release/3.53.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
wolph committed Sep 14, 2021
2 parents 6717b31 + 8a96eef commit cb73782
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion progressbar/__about__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
long running operations.
'''.strip().split())
__email__ = 'wolph@wol.ph'
__version__ = '3.53.2'
__version__ = '3.53.3'
__license__ = 'BSD'
__copyright__ = 'Copyright 2015 Rick van Hattem (Wolph)'
__url__ = 'https://github.com/WoLpH/python-progressbar'
15 changes: 8 additions & 7 deletions progressbar/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from __future__ import absolute_import
import distutils.util
import atexit
import io
import os
Expand Down Expand Up @@ -173,13 +172,15 @@ def env_flag(name, default=None):
Accepts environt variables formatted as y/n, yes/no, 1/0, true/false,
on/off, and returns it as a boolean
If the environt variable is not defined, or has an unknown value, returns
`default`
If the environment variable is not defined, or has an unknown value,
returns `default`
'''
try:
return bool(distutils.util.strtobool(os.environ.get(name, '')))
except ValueError:
return default
v = os.getenv(name)
if v and v.lower() in ('y', 'yes', 't', 'true', 'on', '1'):
return True
if v and v.lower() in ('n', 'no', 'f', 'false', 'off', '0'):
return False
return default


class WrappingIO:
Expand Down

0 comments on commit cb73782

Please sign in to comment.