1from ._parser import (
2 DEFAULTPARSER,
3 DEFAULTTZPARSER,
4 ParserError,
5 UnknownTimezoneWarning,
6 __doc__,
7 parse,
8 parser,
9 parserinfo,
10)
11from .isoparser import isoparse, isoparser
12
13__all__ = ['parse', 'parser', 'parserinfo',
14 'isoparse', 'isoparser',
15 'ParserError',
16 'UnknownTimezoneWarning']
17
18
19###
20# Deprecate portions of the private interface so that downstream code that
21# is improperly relying on it is given *some* notice.
22
23
24def __deprecated_private_func(f):
25 import warnings
26 from functools import wraps
27
28 msg = ('{name} is a private function and may break without warning, '
29 'it will be moved and or renamed in future versions.')
30 msg = msg.format(name=f.__name__)
31
32 @wraps(f)
33 def deprecated_func(*args, **kwargs):
34 warnings.warn(msg, DeprecationWarning)
35 return f(*args, **kwargs)
36
37 return deprecated_func
38
39def __deprecate_private_class(c):
40 import warnings
41
42 msg = ('{name} is a private class and may break without warning, '
43 'it will be moved and or renamed in future versions.')
44 msg = msg.format(name=c.__name__)
45
46 class private_class(c):
47 __doc__ = c.__doc__
48
49 def __init__(self, *args, **kwargs):
50 warnings.warn(msg, DeprecationWarning)
51 super().__init__(*args, **kwargs)
52
53 private_class.__name__ = c.__name__
54
55 return private_class
56
57
58from ._parser import _parsetz, _resultbase, _timelex, _tzparser
59
60_timelex = __deprecate_private_class(_timelex)
61_tzparser = __deprecate_private_class(_tzparser)
62_resultbase = __deprecate_private_class(_resultbase)
63_parsetz = __deprecated_private_func(_parsetz)