comparison env/lib/python3.9/site-packages/dateutil/parser/__init__.py @ 0:4f3585e2f14b draft default tip

"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author shellac
date Mon, 22 Mar 2021 18:12:50 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4f3585e2f14b
1 # -*- coding: utf-8 -*-
2 from ._parser import parse, parser, parserinfo, ParserError
3 from ._parser import DEFAULTPARSER, DEFAULTTZPARSER
4 from ._parser import UnknownTimezoneWarning
5
6 from ._parser import __doc__
7
8 from .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
21 def __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
36 def __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
55 from ._parser import _timelex, _resultbase
56 from ._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)