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