Return-Path: X-Original-To: apmail-libcloud-commits-archive@www.apache.org Delivered-To: apmail-libcloud-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D3365DA79 for ; Thu, 23 May 2013 23:10:11 +0000 (UTC) Received: (qmail 35485 invoked by uid 500); 23 May 2013 23:10:11 -0000 Delivered-To: apmail-libcloud-commits-archive@libcloud.apache.org Received: (qmail 35463 invoked by uid 500); 23 May 2013 23:10:11 -0000 Mailing-List: contact commits-help@libcloud.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@libcloud.apache.org Delivered-To: mailing list commits@libcloud.apache.org Received: (qmail 35455 invoked by uid 99); 23 May 2013 23:10:11 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 May 2013 23:10:11 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 May 2013 23:10:09 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 7DD032388900; Thu, 23 May 2013 23:09:48 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1485894 - /libcloud/trunk/libcloud/utils/iso8601.py Date: Thu, 23 May 2013 23:09:48 -0000 To: commits@libcloud.apache.org From: tomaz@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130523230948.7DD032388900@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 "" % 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)