Development of an internal social media platform with personalised dashboards for students
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

__init__.py 1.7KB

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