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

Class ParserError

src/dateutil/parser/_parser.py:1583–1599  ·  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

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

Callers 2

test_parsererror_reprFunction · 0.90
parseMethod · 0.85

Calls

no outgoing calls

Tested by 1

test_parsererror_reprFunction · 0.72