Fix broken import of os.environ.get

It's not a module, but a dict-like object. This makes sure to use it
like that. In order to replicate the old behavior, this does not use
.get with a default value and instead returns None.
This commit is contained in:
Max Nordlund gmail 2018-01-02 12:47:15 +01:00 committed by Casper da Costa-Luis
parent 01af3ac032
commit 26d0ff1fab
No known key found for this signature in database
GPG Key ID: 986B408043AE090D
1 changed files with 3 additions and 5 deletions

View File

@ -224,12 +224,10 @@ def _environ_cols_linux(fp): # pragma: no cover
try:
return array('h', ioctl(fp, TIOCGWINSZ, '\0' * 8))[1]
except:
try:
from os.environ import get
except ImportError:
return None
if 'COLUMNS' in os.environ:
return int(os.environ['COLUMNS']) - 1
else:
return int(get('COLUMNS', 1)) - 1
return None
def _term_move_up(): # pragma: no cover