__init__.py 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. # -*- coding: utf-8 -*-
  2. """Distributed Task Queue"""
  3. # :copyright: (c) 2009 - 2012 Ask Solem and individual contributors,
  4. # All rights reserved.
  5. # :copyright: (c) 2012-2013 GoPivotal, Inc., All rights reserved.
  6. # :license: BSD (3 Clause), see LICENSE for more details.
  7. from __future__ import absolute_import
  8. SERIES = 'Cipater'
  9. VERSION = (3, 1, 0, 'rc3')
  10. __version__ = '.'.join(str(p) for p in VERSION[0:3]) + ''.join(VERSION[3:])
  11. __author__ = 'Ask Solem'
  12. __contact__ = 'ask@celeryproject.org'
  13. __homepage__ = 'http://celeryproject.org'
  14. __docformat__ = 'restructuredtext'
  15. __all__ = [
  16. 'celery', 'bugreport', 'shared_task', 'task',
  17. 'current_app', 'current_task',
  18. 'chain', 'chord', 'chunks', 'group', 'subtask',
  19. 'xmap', 'xstarmap', 'uuid', 'version', '__version__',
  20. ]
  21. VERSION_BANNER = '{0} ({1})'.format(__version__, SERIES)
  22. # -eof meta-
  23. import os
  24. if os.environ.get('C_IMPDEBUG'): # pragma: no cover
  25. import sys
  26. from .five import builtins
  27. real_import = builtins.__import__
  28. def debug_import(name, locals=None, globals=None,
  29. fromlist=None, level=-1):
  30. glob = globals or getattr(sys, 'emarfteg_'[::-1])(1).f_globals
  31. importer_name = glob and glob.get('__name__') or 'unknown'
  32. print('-- {0} imports {1}'.format(importer_name, name))
  33. return real_import(name, locals, globals, fromlist, level)
  34. builtins.__import__ = debug_import
  35. STATICA_HACK = True
  36. globals()['kcah_acitats'[::-1].upper()] = False
  37. if STATICA_HACK: # pragma: no cover
  38. # This is never executed, but tricks static analyzers (PyDev, PyCharm,
  39. # pylint, etc.) into knowing the types of these symbols, and what
  40. # they contain.
  41. from celery.app import shared_task # noqa
  42. from celery.app.base import Celery # noqa
  43. from celery.app.utils import bugreport # noqa
  44. from celery.app.task import Task # noqa
  45. from celery._state import current_app, current_task # noqa
  46. from celery.canvas import ( # noqa
  47. chain, chord, chunks, group, subtask, xmap, xstarmap,
  48. )
  49. from celery.utils import uuid # noqa
  50. # Lazy loading
  51. from .five import recreate_module
  52. old_module, new_module = recreate_module( # pragma: no cover
  53. __name__,
  54. by_module={
  55. 'celery.app': ['Celery', 'bugreport', 'shared_task'],
  56. 'celery.app.task': ['Task'],
  57. 'celery._state': ['current_app', 'current_task'],
  58. 'celery.canvas': ['chain', 'chord', 'chunks', 'group',
  59. 'subtask', 'xmap', 'xstarmap'],
  60. 'celery.utils': ['uuid'],
  61. },
  62. direct={'task': 'celery.task'},
  63. __package__='celery', __file__=__file__,
  64. __path__=__path__, __doc__=__doc__, __version__=__version__,
  65. __author__=__author__, __contact__=__contact__,
  66. __homepage__=__homepage__, __docformat__=__docformat__,
  67. VERSION=VERSION, SERIES=SERIES, VERSION_BANNER=VERSION_BANNER,
  68. )