def parsedate_to_datetime(data): *dtuple, tz = _parsedate_tz(data) if tz is None: return datetime.datetime(*dtuple[:6]) return datetime.datetime(*dtuple[:6], tzinfo=datetime.timezone( datetime.timedelta(seconds=tz)))
def parsedate_to_datetime(data): *dtuple, tz = _parsedate_tz(data) if tz is None: return (datetime.datetime)(*dtuple[:6]) else: return (datetime.datetime)(*dtuple[:6], **{ 'tzinfo': datetime.timezone(datetime.timedelta(seconds=tz)) })
def parsedate_to_datetime(data): parsed_date_tz = _parsedate_tz(data) if parsed_date_tz is None: raise ValueError('Invalid date value or format "%s"' % str(data)) *dtuple, tz = parsed_date_tz if tz is None: return datetime.datetime(*dtuple[:6]) return datetime.datetime(*dtuple[:6], tzinfo=datetime.timezone(datetime.timedelta(seconds=tz)))
def parsedate_tz(data): if not data: return None return _parsedate_tz(data)
def parsedate_to_datetime(data): (*dtuple, tz) = _parsedate_tz(data) if tz is None: return datetime.datetime(*dtuple[:6]) return datetime.datetime(tzinfo=datetime.timezone(datetime.timedelta(seconds=tz)), *dtuple[:6])
def parsedate_tz(data): return None if not data else _parsedate_tz(data)