From ba5fbcd432f417ed49b0055ea5f29ac3c1591f4f Mon Sep 17 00:00:00 2001 From: Phil Elson Date: Tue, 22 Jan 2019 11:46:24 +0000 Subject: [PATCH] Tidy up the Unit constructor for the py2 case, so that it is easier to see that the code can be deleted when the codebase becomes py3 only. --- cf_units/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cf_units/__init__.py b/cf_units/__init__.py index 5aae07f9..e2197366 100644 --- a/cf_units/__init__.py +++ b/cf_units/__init__.py @@ -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'):