X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Futil%2Fsfatime.py;h=aab0663575b38e90ef965893bfc92f5f8b480721;hb=HEAD;hp=9752d325c7929d4c9983c274caf75bc995b5f285;hpb=0a9902d2a55a0a9ac03601345c4284293669012b;p=sfa.git diff --git a/sfa/util/sfatime.py b/sfa/util/sfatime.py index 9752d325..aab06635 100644 --- a/sfa/util/sfatime.py +++ b/sfa/util/sfatime.py @@ -20,7 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE WORK OR THE USE OR OTHER DEALINGS # IN THE WORK. #---------------------------------------------------------------------- -from __future__ import print_function + import time import datetime @@ -29,7 +29,6 @@ import calendar import re from sfa.util.sfalogging import logger -from sfa.util.py23 import StringType SFATIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ" @@ -59,7 +58,7 @@ For safety this can also handle inputs that are either timestamps, or datetimes # prepare the input for the checks below by # casting strings ('1327098335') to ints - if isinstance(input, StringType): + if isinstance(input, str): try: input = int(input) except ValueError: @@ -75,12 +74,12 @@ For safety this can also handle inputs that are either timestamps, or datetimes if isinstance(input, datetime.datetime): #logger.info ("argument to utcparse already a datetime - doing nothing") return input - elif isinstance(input, StringType): + elif isinstance(input, str): t = dateutil.parser.parse(input) if t.utcoffset() is not None: t = t.utcoffset() + t.replace(tzinfo=None) return t - elif isinstance(input, (int, float, long)): + elif isinstance(input, (int, float)): return datetime.datetime.fromtimestamp(input) else: logger.error("Unexpected type in utcparse [%s]" % type(input))