Author: tomaz
Date: Thu May 23 23:09:48 2013
New Revision: 1485894
URL: http://svn.apache.org/r1485894
Log:
Remove unnecessary check.
Modified:
libcloud/trunk/libcloud/utils/iso8601.py
Modified: libcloud/trunk/libcloud/utils/iso8601.py
URL:
http://svn.apache.org/viewvc/libcloud/trunk/libcloud/utils/iso8601.py?rev=1485894&r1=1485893&r2=1485894&view=diff
==============================================================================
--- libcloud/trunk/libcloud/utils/iso8601.py (original)
+++ libcloud/trunk/libcloud/utils/iso8601.py Thu May 23 23:09:48 2013
@@ -33,8 +33,6 @@ datetime.datetime(2007, 1, 25, 12, 0, tz
from datetime import datetime, timedelta, tzinfo
import re
-from libcloud.utils.py3 import basestring
-
__all__ = ["parse_date", "ParseError"]
# Adapted from http://delete.me.uk/2005/03/iso8601.html
@@ -51,7 +49,7 @@ class ParseError(Exception):
ZERO = timedelta(0)
class Utc(tzinfo):
"""UTC
-
+
"""
def utcoffset(self, dt):
return ZERO
@@ -65,7 +63,7 @@ UTC = Utc()
class FixedOffset(tzinfo):
"""Fixed offset in hours and minutes from UTC
-
+
"""
def __init__(self, offset_hours, offset_minutes, name):
self.__offset = timedelta(hours=offset_hours, minutes=offset_minutes)
@@ -79,13 +77,13 @@ class FixedOffset(tzinfo):
def dst(self, dt):
return ZERO
-
+
def __repr__(self):
return "<FixedOffset %r>" % self.__name
def parse_timezone(tzstring, default_timezone=UTC):
"""Parses ISO 8601 time zone specs into tzinfo offsets
-
+
"""
if tzstring == "Z":
return default_timezone
@@ -104,14 +102,12 @@ def parse_timezone(tzstring, default_tim
def parse_date(datestring, default_timezone=UTC):
"""Parses ISO 8601 dates into datetime objects
-
+
The timezone is parsed from the date string. However it is quite common to
have dates without a timezone (not strictly correct). In this case the
default timezone specified in default_timezone is used. This is UTC by
default.
"""
- if not isinstance(datestring, basestring):
- raise ParseError("Expecting a string %r" % datestring)
m = ISO8601_REGEX.match(datestring)
if not m:
raise ParseError("Unable to parse date string %r" % datestring)