summaryrefslogtreecommitdiff
path: root/dateutil/parser
diff options
context:
space:
mode:
authorPaul Ganssle <paul@ganssle.io>2017-11-01 13:45:36 -0400
committerPaul Ganssle <paul@ganssle.io>2017-12-06 12:43:57 +0000
commit6fca9a55cbe3f4d8ced17989ca3e3c757172fcf0 (patch)
tree4e96d5c89198be5d645a93488b9cb9919b693503 /dateutil/parser
parent9a135d017792b9f5ff87a0f916dc5eb65f51ec47 (diff)
downloaddateutil-git-6fca9a55cbe3f4d8ced17989ca3e3c757172fcf0.tar.gz
Tweak parser/isoparser documentation
Diffstat (limited to 'dateutil/parser')
-rw-r--r--dateutil/parser/__init__.py3
-rw-r--r--dateutil/parser/isoparser.py17
2 files changed, 15 insertions, 5 deletions
diff --git a/dateutil/parser/__init__.py b/dateutil/parser/__init__.py
index 2d6b1a3..abe7b41 100644
--- a/dateutil/parser/__init__.py
+++ b/dateutil/parser/__init__.py
@@ -3,7 +3,10 @@ from ._parser import parse, parser, parserinfo
from ._parser import DEFAULTPARSER, DEFAULTTZPARSER
from ._parser import InvalidDateError, InvalidDatetimeError, InvalidTimeError
+from .isoparser import Isoparser, isoparse
+
__all__ = ['parse', 'parser', 'parserinfo',
+ 'isoparse', 'Isoparser',
'InvalidDatetimeError', 'InvalidDateError', 'InvalidTimeError']
diff --git a/dateutil/parser/isoparser.py b/dateutil/parser/isoparser.py
index 074aef2..50a8564 100644
--- a/dateutil/parser/isoparser.py
+++ b/dateutil/parser/isoparser.py
@@ -1,10 +1,17 @@
# -*- coding: utf-8 -*-
+"""
+This module offers a parser for ISO-8601 strings
+
+It is intended to support all valid date, time and datetime formats per the
+ISO-8601 specification, with a stricter mode for the most common subset.
+"""
from datetime import datetime, timedelta, time, date
import calendar
from dateutil import tz
import re
+__all__ = ["isoparse", "Isoparser"]
class Isoparser(object):
def __init__(self, sep='T', default_year=None):
@@ -30,7 +37,7 @@ class Isoparser(object):
def isoparse(self, dt_str, common_only=False):
"""
- Parse an ISO-8601 datetime string into a :py:`datetime.datetime`.
+ Parse an ISO-8601 datetime string into a :class:`datetime.datetime`.
An ISO-8601 datetime string consists of a date portion, followed
optionally by a time portion - the date and time portions are separated
@@ -52,7 +59,7 @@ class Isoparser(object):
- ``YYYY-Www-D`` or ``YYYYWwwD`` - ISO week and day
The ISO week and day numbering follows the same logic as
- :py:`datetime.date.isocalendar`.
+ :func:`datetime.date.isocalendar`.
Supported time formats are:
@@ -88,11 +95,11 @@ class Isoparser(object):
If true, parsing the uncommon formats will throw an error.
:return:
- Returns a :py:`datetime.datetime` representing the string.
+ Returns a :class:`datetime.datetime` representing the string.
Unspecified components default to their lowest value, with the
exception of year, which will use the value passed to the
``default_year`` parameter of the method's bound
- :class:`dateutil.parser.isoparser.Isoparser` instance. If that
+ :class:`Isoparser` instance. If that
would produce an invalid date (e.g. ``'--02-29'`` parsed with a
non-leap-year default date), the default will be the last leap
year to occur before the default year.
@@ -114,7 +121,7 @@ class Isoparser(object):
def parse_isodate(self, datestr):
"""
- Parse the date portion of an ISO strin.
+ Parse the date portion of an ISO string.
:param datestr:
The string portion of an ISO string, without a separator