MCPcopy Create free account
hub / github.com/dateutil/dateutil / ParserError

Class ParserError

src/dateutil/parser/_parser.py:1589–1605  ·  view source on GitHub ↗

Exception subclass used for any failure to parse a datetime string. This is a subclass of :py:exc:`ValueError`, and should be raised any time earlier versions of ``dateutil`` would have raised ``ValueError``. .. versionadded:: 2.8.1

Source from the content-addressed store, hash-verified

1587
1588
1589class ParserError(ValueError):
1590 """Exception subclass used for any failure to parse a datetime string.
1591
1592 This is a subclass of :py:exc:`ValueError`, and should be raised any time
1593 earlier versions of ``dateutil`` would have raised ``ValueError``.
1594
1595 .. versionadded:: 2.8.1
1596 """
1597 def __str__(self):
1598 try:
1599 return self.args[0] % self.args[1:]
1600 except (TypeError, IndexError):
1601 return super(ParserError, self).__str__()
1602
1603 def __repr__(self):
1604 args = ", ".join("'%s'" % arg for arg in self.args)
1605 return "%s(%s)" % (self.__class__.__name__, args)
1606
1607
1608class UnknownTimezoneWarning(RuntimeWarning):

Callers 2

test_parsererror_reprFunction · 0.90
parseMethod · 0.85

Calls

no outgoing calls

Tested by 1

test_parsererror_reprFunction · 0.72