__init__.py 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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 VMware, Inc., All rights reserved.
  6. # :license: BSD (3 Clause), see LICENSE for more details.
  7. from __future__ import absolute_import
  8. SERIES = 'DEVEL'
  9. VERSION = (3, 1, 0, 'b1')
  10. __version__ = '.'.join(map(str, 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'):
  25. import sys
  26. import __builtin__
  27. real_import = __builtin__.__import__
  28. def debug_import(name, locals=None, globals=None, fromlist=None,
  29. 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. __builtin__.__import__ = debug_import
  35. STATICA_HACK = True
  36. globals()['kcah_acitats'[::-1].upper()] = False
  37. if STATICA_HACK:
  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.base import Celery # noqa
  42. from celery.app.utils import bugreport # noqa
  43. from celery.app.task import Task # noqa
  44. from celery._state import current_app, current_task # noqa
  45. from celery.canvas import ( # noqa
  46. chain, chord, chunks, group, subtask, xmap, xstarmap,
  47. )
  48. from celery.utils import uuid # noqa
  49. # Lazy loading
  50. from .__compat__ import recreate_module
  51. old_module, new_module = recreate_module(__name__, # pragma: no cover
  52. by_module={
  53. 'celery.app': ['Celery', 'bugreport', 'shared_task'],
  54. 'celery.app.task': ['Task'],
  55. 'celery._state': ['current_app', 'current_task'],
  56. 'celery.canvas': ['chain', 'chord', 'chunks', 'group',
  57. 'subtask', 'xmap', 'xstarmap'],
  58. 'celery.utils': ['uuid'],
  59. },
  60. direct={'task': 'celery.task'},
  61. __package__='celery', __file__=__file__,
  62. __path__=__path__, __doc__=__doc__, __version__=__version__,
  63. __author__=__author__, __contact__=__contact__,
  64. __homepage__=__homepage__, __docformat__=__docformat__,
  65. VERSION=VERSION, SERIES=SERIES, VERSION_BANNER=VERSION_BANNER,
  66. )