Skip to content

Commit

Permalink
Tidy up the Unit constructor for the py2 case, so that it is easier t…
Browse files Browse the repository at this point in the history
…o see that the code can be deleted when the codebase becomes py3 only.
  • Loading branch information
pelson committed Jan 22, 2019
1 parent 5994477 commit ba5fbcd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cf_units/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -809,8 +809,8 @@ def __init__(self, unit, calendar=None):
else:
unit = str(unit).strip()

# For the sake of python 2, ensure that the string is a unicode.
if not isinstance(unit, six.text_type):
if six.PY2:
# Ensure that the string is a unicode object.
unit = six.text_type(unit.decode('utf8'))

if unit.lower().endswith(' utc'):
Expand Down

0 comments on commit ba5fbcd

Please sign in to comment.