
P'^c        	   @@ sR  d  Z  d d l m Z m Z d d l Z d d l Z d d l Z d d l Z d d l m	 Z	 d d l
 m Z d d l m Z m Z d d l m Z m Z m Z m Z d d l m Z d d	 l m Z d d
 l m Z d d l m Z m Z m Z d d l m Z d d l m  Z  d d l! m" Z" d d l# m$ Z$ d d l% m& Z& d d g Z' d Z( d Z) e j* j+ d e,  Z- d d d d d d d g d f d d d  d! g d" f d# d$ d% d& d' d( d) g d f g Z/ e- re/ j0 d* d+ g d, f  n  d-   Z1 d d.  Z2 d/ e f d0     YZ3 d1 e f d2     YZ4 d3 e f d4     YZ5 d5 e f d6     YZ6 d7 e f d8     YZ7 d9 e f d:     YZ8 d; e8 f d<     YZ9 d= e8 f d>     YZ: d? e f d@     YZ; dA e f dB     YZ< dC e f dD     YZ= dE e f dF     YZ> dG e f dH     YZ? dI e f dJ     YZ@ dK   ZA eB dL k rNe2   n  d S(M   u@   

The :program:`celery` umbrella command.

.. program:: celery

i    (   t   absolute_importt   unicode_literalsN(   t   partial(   t   import_module(   t   string_tt   values(   t   EX_OKt
   EX_FAILUREt   EX_UNAVAILABLEt   EX_USAGE(   t   term(   t   text(   t   maybe_iso8601(   t   Commandt   Optiont
   Extensions(   t   amqp(   t   beat(   t   events(   t   graph(   t   workeru   CeleryCommandu   mainu   
---- -- - - ---- Commands- -------------- --- ------------

{commands}
---- -- - - --------- -- - -------------- --- ------------

Type '{prog_name} <command> --help' for help using a specific command.
uG   Migrating task {state.count}/{state.strtotal}: {body[task]}[{body[id]}]u   C_DEBUGu   Mainu   workeru   eventsu   beatu   shellu   multiu   amqpu   greenu   Remote Controlu   statusu   inspectu   controlu   blueu   Utilsu   purgeu   listu   migrateu   callu   resultu   reportu   Debugu   graphu   redc         C@ s$   t  |  t j  r |  S|  r  t St S(   N(   t
   isinstancet   numberst   IntegralR   R   (   t   ret(    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyt   determine_exit_status@   s    c         C@ sv   y^ t  d k r& t j t  t j d <n  t   } | j   d d l m } |   | j |   Wn t k
 rq n Xd  S(   Nu   __main__i    (   t   freeze_support(	   t   __name__t   syst   modulest   CeleryCommandt   maybe_patch_concurrencyt   billiardR   t   execute_from_commandlinet   KeyboardInterrupt(   t   argvt   cmdR   (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyt   mainF   s    	
t   multic           B@ s)   e  Z d  Z e Z d   Z d d  Z RS(   u    Start multiple worker instances.c         C@ s   d S(   N(    (    (   t   self(    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyt   get_optionsZ   s    c         C@ sB   d d l  m } | d |  j d |  j  } | j | g | |  S(   Ni    (   t	   MultiToolt   quiett   no_color(   t   celery.bin.multiR)   R*   R+   R!   (   R'   t	   prog_nameR#   t   commandR)   R&   (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyt   run_from_argv]   s    N(   R   t
   __module__t   __doc__t   Falset   respects_app_optionR(   t   NoneR/   (    (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyR&   V   s   	t   list_c           B@ s)   e  Z d  Z d Z d   Z d d  Z RS(   u   Get info from broker.

    Examples::

        celery list bindings

    NOTE: For RabbitMQ the management plugin is required.
    u
   [bindings]c         @ s   y | j    } Wn  t k
 r2   j d   n X  f d   } | d d d  | d d d  x* | D]" } | | d | d	 | d
  qi Wd  S(   Nu$   Your transport cannot list bindings.c         @ s     j  d j |  | |   S(   Nu   {0:<28} {1:<28} {2}(   t   outt   format(   t   qt   et   r(   R'   (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyt   fmtv   s    u   Queueu   Exchangeu   Routing Keyu   -i   u   destinationu   sourceu   routing_keyu   ----------------u   ----------------u   ----------------(   t   get_bindingst   NotImplementedErrort   Error(   R'   t
   managementt   bindingsR;   t   b(    (   R'   s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyt   list_bindingsp   s    c         O@ s   i |  j  d 6} d j |  } | s@ |  j d j |    n  | | k rj |  j d j | |    n  |  j j   1 } |  j j j |  j   | | | j	  Wd  QXd  S(   Nu   bindingsu   , u   You must specify one of {0}u(   unknown topic {0!r} (choose one of: {1})(
   RB   t   joint
   UsageErrorR7   t   appt
   connectionR   t   TaskConsumert   declaret   manager(   R'   t   whatt   _t   kwt   topicst	   availablet   conn(    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyt   run}   s    N(   R   R0   R1   t   argsRB   R4   RP   (    (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyR5   e   s   	t   callc           B@ s   e  Z d  Z d Z e j e d d d d e d d d d e d	 d d
 e d d d d d e d d d e d d d d d e d d d e d d d e d d d f	 Z d   Z RS(   u   Call a task by name.

    Examples::

        celery call tasks.add --args='[2, 2]'
        celery call tasks.add --args='[2, 2]' --countdown=10
    u   <task_name>u   --argsu   -at   helpu   positional arguments (json).u   --kwargsu   -ku   keyword arguments (json).u   --etau   scheduled time (ISO-8601).u   --countdownt   typeu   floatu$   eta in seconds from now (float/int).u	   --expiresu!   expiry time (ISO-8601/float/int).u   --serializert   defaultu   jsonu   defaults to json.u   --queueu   custom queue name.u
   --exchangeu   custom exchange name.u   --routing-keyu   custom routing key.c         O@ sp  | j  d  p d } t | t  r6 t j |  } n  | j  d  pH i  } t | t  rl t j |  } n  | j  d  p~ d  } y t |  } WnD t t f k
 r y t	 |  } Wq t t f k
 r   q Xn X|  j
 j | d | d | d | j  d  d | j  d	  d
 | j  d  d | j  d  d | j  d  d t	 | j  d   d | 	} |  j | j  d  S(   Nu   argsu   kwargsu   expiresRQ   t   kwargst	   countdownu	   countdownt
   serializeru
   serializert   queueu   queuet   exchangeu   exchanget   routing_keyu   routing_keyt   etau   etat   expires(    (   t   getR   R   t   anyjsont   loadsR4   t   floatt	   TypeErrort
   ValueErrorR   RE   t	   send_taskR6   t   id(   R'   t   nameRK   RL   RQ   RV   R]   t   res(    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyRP      s.    	(   R   R0   R1   RQ   R   t   option_listR   RP   (    (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyRR      s   t   purgec           B@ sW   e  Z d  Z d Z d Z d Z d Z e j e	 d d d d d	 d
 f Z e
 d  Z RS(   uo   Erase all messages from all known task queues.

    WARNING: There is no undo operation for this command.

    u   {warning}: This will remove all tasks from {queues}: {names}.
         There is no undo for this operation!

(to skip this prompt use the -f option)
u)   Are you sure you want to delete all tasksu9   Purged {mnum} {messages} from {qnum} known task {queues}.u'   No messages purged from {qnum} {queues}u   --forceu   -ft   actionu
   store_trueRS   u   Do not prompt for verificationc         K@ s  t  t |  j j j j     } t |  } | s |  j |  j j	 d |  j
 j d  d t j | d  d d j |    |  j |  j d d  d k r d  Sn  |  j j j   } | r |  j n |  j } |  j | j	 d	 | d
 | d t j | d  d t j | d    d  S(   Nt   warningu   WARNINGt   queuesu   queuet   namesu   , u   yesu   not   mnumt   qnumt   messagesu   message(   u   yesu   no(   t   listt   sortedRE   R   Rl   t   keyst   lenR6   t   warn_preludeR7   t   coloredt   redR   t	   pluralizeRC   t   askt   warn_promptt   controlRi   t
   fmt_purgedt	   fmt_empty(   R'   t   forceRV   Rm   Ro   Rp   R;   (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyRP      s    !%(   R   R0   R1   Ru   Rz   R|   R}   R   Rh   R   R2   RP   (    (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyRi      s   t   resultc           B@ sQ   e  Z d  Z d Z e j e d d d d e d d d d d	 f Z d
   Z RS(   u  Gives the return value for a given task id.

    Examples::

        celery result 8f511516-e2f5-4da4-9d2f-0fb83a86e500
        celery result 8f511516-e2f5-4da4-9d2f-0fb83a86e500 -t tasks.add
        celery result 8f511516-e2f5-4da4-9d2f-0fb83a86e500 --traceback

    u	   <task_id>u   --tasku   -tRS   u    name of task (if custom backend)u   --tracebackRj   u
   store_trueu   show traceback insteadc   	      O@ s   |  j  j } | j d  } | j d t  } | rI |  j  j | j } n  | |  } | rg | j } n | j   } |  j |  j |  d  d  S(   Nu   tasku	   tracebacki   (   RE   t   AsyncResultR^   R2   t   taskst	   tracebackR6   t   pretty(	   R'   t   task_idRQ   RV   t
   result_clst   taskR   R   t   value(    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyRP      s    (   R   R0   R1   RQ   R   Rh   R   RP   (    (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyR      s   	t   _RemoteControlc           B@ s   e  Z d Z d Z e Z e j e	 d  d d d d d e	 d d d d f Z d	   Z
 e d
 d d e d   Z e d
 d d e d   Z e d    Z d   Z d   Z d   Z d   Z RS(   u	   --timeoutu   -tRT   u   floatRS   u,   Timeout in seconds (float) waiting for replyu   --destinationu   -du/   Comma separated list of destination node names.c         O@ sG   | j  d t  |  _ | j  d t  |  _ t t |   j | |   d  S(   Nu	   show_bodyu
   show_reply(   t   popt   Truet	   show_bodyt
   show_replyt   superR   t   __init__(   R'   RQ   RV   (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyR     s    i    u    c         C@ s   | r. d t  j |  j | d | d  } n d  } yN t |  |  } t  j d t  j d j | | |  | j  |  | g  SWnA t k
 r t  j d t  j | t	 | |   |  | g  SXd  S(   Nu   |i   i   u
   {0}{1} {2}(
   R   t   indentt   choicesR4   t   getattrRC   R7   R1   t   AttributeErrort   str(   R'   R.   R   t   prefixt   colorRS   t   meth(    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyt   get_command_info  s    (c         @ s]     r   n d      r%  d n d  d j        f d   t  j  D  S(   Nc         S@ s   |  S(   N(    (   t   x(    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyt   <lambda>.  t    u    u    u   
c         3@ s*   |  ]  }  j  |       Vq d  S(   N(   R   (   t   .0t   c(   R   RS   R   R   R'   (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pys	   <genexpr>0  s   (   RC   Rr   R   (   R'   R   R   R   RS   (    (   R   RS   R   R   R'   s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyt   list_commands,  s    c         C@ s%   d j  d |  j d d d t  g  S(   Nu   
u
   [Commands]R   i   RS   (   RC   R   R   (   R'   (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyt   epilog3  s    c         C@ s   d j  | |  j  S(   Nu0   %prog {0} [options] {1} <command> [arg1 .. argN](   R7   RQ   (   R'   R.   (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyt   usage:  s    c         O@ s   t  d   d  S(   Nu   call(   R=   (   R'   RQ   RV   (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyRR   >  s    c         O@ s1   | s! |  j  d j |     n  |  j | |  S(   Nu#   Missing {0.name} method. See --help(   RD   R7   t   do_call_method(   R'   RQ   RV   (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyRP   A  s    c   	   
   K@ sY  | d } | d k r1 |  j  d j |     n  | |  j k r^ |  j d j |  |    n  |  j j   j j d k r |  j  d   n  | j d  } | j d  p |  j | d } | r t	 | t
  r g  | j d	  D] } | j   ^ q } n  t |  | |  j  } | | d
 | d | d |  j | d } | sU|  j  d d t  n  | S(   Ni    u   helpu   Did you mean '{0.name} --help'?u   Unknown {0.name} method {1}u   sqlu/   Broadcast not supported by SQL broker transportu   destinationu   timeoutu   ,t   timeoutt   destinationt   callbacki   u(   No nodes replied within time constraint.t   status(   R>   R7   R   RD   RE   RF   t	   transportt   driver_typeR^   R   R   t   splitt   stripR   RR   t   say_remote_command_replyR   (	   R'   RQ   RV   t   methodR   R   t   destt   handlert   replies(    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyR   G  s(    
 +N(   R   R0   R4   Rf   R   R2   t   leafR   Rh   R   R   t   classmethodR   R   t   propertyR   R   RR   RP   R   (    (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyR     s$   				t   inspectc           B@ s   e  Z d  Z d Z i d% d 6d& d 6d' d 6d( d
 6d) d 6d* d 6d+ d 6d, d 6d- d 6d. d 6d/ d 6d0 d 6d1 d 6d2 d  6Z d!   Z d" d#  Z e d$  Z RS(3   u  Inspect the worker at runtime.

    Availability: RabbitMQ (amqp), Redis, and MongoDB transports.

    Examples::

        celery inspect active --timeout=5
        celery inspect scheduled -d worker1@example.com
        celery inspect revoked -d w1@e.com,w2@e.com

    u   inspectg      ?u#   dump active tasks (being processed)u   activeu   dump queues being consumed fromu   active_queuesu*   dump scheduled tasks (eta/countdown/retry)u	   scheduledu-   dump reserved tasks (waiting to be processed)u   reservedu   dump worker statisticsu   statsu   dump of revoked task idsu   revokedu   dump of registered tasksu
   registeredg?u   ping worker(s)u   pingu   get value of logical clocku   clocku   dump worker configurationu   confu   get bugreport infou   reportu   sample memory (requires psutil)u	   memsampleu%   dump memory samples (requires psutil)u   memdumpg      N@u'   create object graph (requires objgraph)u   objgraphc         O@ s(   |  j  j j |   } t | |  |   S(   N(   RE   R{   R   R   (   R'   R   RQ   t   optionst   i(    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyRR     s    u   Requestc         O@ s   |  j  d | |  S(   Nu   objgraph(   RR   (   R'   t   type_RQ   RV   (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyt   objgraph  s    c         O@ s   |  j  d | |  S(   Nu   conf(   RR   (   R'   t   with_defaultsRQ   RV   (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyt   conf  s    (   g      ?u#   dump active tasks (being processed)(   g      ?u   dump queues being consumed from(   g      ?u*   dump scheduled tasks (eta/countdown/retry)(   g      ?u-   dump reserved tasks (waiting to be processed)(   g      ?u   dump worker statistics(   g      ?u   dump of revoked task ids(   g      ?u   dump of registered tasks(   g?u   ping worker(s)(   g      ?u   get value of logical clock(   g      ?u   dump worker configuration(   g      ?u   get bugreport info(   g      ?u   sample memory (requires psutil)(   g      ?u%   dump memory samples (requires psutil)(   g      N@u'   create object graph (requires objgraph)(	   R   R0   R1   Rf   R   RR   R   R2   R   (    (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyR   b  s(   
	R{   c           B@ s   e  Z d  Z d Z i	 d d 6d  d 6d! d 6d" d
 6d# d 6d$ d 6d% d 6d& d 6d' d 6Z d   Z d d  Z d d  Z d( d( d  Z	 d   Z
 d( d  Z d( d d( d  Z d   Z RS()   u  Workers remote control.

    Availability: RabbitMQ (amqp), Redis, and MongoDB transports.

    Examples::

        celery control enable_events --timeout=5
        celery control -d worker1@example.com enable_events
        celery control -d w1.e.com,w2.e.com enable_events

        celery control -d w1.e.com add_consumer queue_name
        celery control -d w1.e.com cancel_consumer queue_name

        celery control -d w1.e.com add_consumer queue exchange direct rkey

    u   controlg      ?u   tell worker(s) to enable eventsu   enable_eventsu    tell worker(s) to disable eventsu   disable_eventsu)   tell worker(s) to start consuming a queueu   add_consumeru(   tell worker(s) to stop consuming a queueu   cancel_consumeru7   tell worker(s) to modify the rate limit for a task typeu
   rate_limitu8   tell worker(s) to modify the time limit for a task type.u
   time_limitu   change autoscale settingsu	   autoscaleu   start more pool processesu	   pool_growu   use less pool processesu   pool_shrinkc         O@ s"   t  |  j j |  d t | |  S(   Nt   reply(   R   RE   R{   R   (   R'   R   RQ   R   (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyRR     s    i   c         K@ s   |  j  | t |  |  S(   u   [N=1](   RR   t   int(   R'   R   t   nRV   (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyt	   pool_grow  s    c         K@ s   |  j  | t |  |  S(   u   [N=1](   RR   R   (   R'   R   R   RV   (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyt   pool_shrink  s    c         K@ s"   |  j  | t |  t |  |  S(   u   [max] [min](   RR   R   (   R'   R   t   maxt   minRV   (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyt	   autoscale  s    c         K@ s   |  j  | | | |  S(   u0   <task_name> <rate_limit> (e.g. 5/s | 5/m | 5/h)>(   RR   (   R'   R   t	   task_namet
   rate_limitRV   (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyR     s    c         K@ s%   |  j  | | t |  t |  |  S(   u#   <task_name> <soft_secs> [hard_secs](   RR   Ra   (   R'   R   R   t   softt   hardRV   (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyt
   time_limit  s    u   directc         K@ s   |  j  | | | | | |  S(   u'   <queue> [exchange [type [routing_key]]](   RR   (   R'   R   RY   RZ   t   exchange_typeR[   RV   (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyt   add_consumer  s    c         K@ s   |  j  | | |  S(   u   <queue>(   RR   (   R'   R   RY   RV   (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyt   cancel_consumer  s    (   g      ?u   tell worker(s) to enable events(   g      ?u    tell worker(s) to disable events(   g      ?u)   tell worker(s) to start consuming a queue(   g      ?u(   tell worker(s) to stop consuming a queue(   g      ?u7   tell worker(s) to modify the rate limit for a task type(   g      ?u8   tell worker(s) to modify the time limit for a task type.(   g      ?u   change autoscale settings(   g      ?u   start more pool processes(   g      ?u   use less pool processesN(   R   R0   R1   Rf   R   RR   R   R   R4   R   R   R   R   R   (    (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyR{     s*   
		R   c           B@ s    e  Z d  Z e j Z d   Z RS(   u%   Show list of workers that are online.c         O@ s   t  d |  j d | j d t  d |  j d |  j d t d t d t  } | j d	 |  } | sx |  j d
 d t	  n  t
 |  } | j d t  s |  j d j | t j | d    n  d  S(   NRE   R+   u   no_colort   stdoutt   stderrR   R   R*   u   pingu'   No nodes replied within time constraintR   u   quietu   
{0} {1} online.u   node(   R   RE   R^   R2   R   R   R   RP   R>   R   Rt   R6   R7   R   Rx   (   R'   RQ   RV   t   IR   t	   nodecount(    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyRP     s    	(   R   R0   R1   R   Rh   RP   (    (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyR     s   	t   migratec           B@ s   e  Z d  Z d Z e j e d d d d d d e d d	 d d
 d d d d e d d d d d d e d d d d e d d d d e d d d d d d f Z e Z d   Z	 d   Z
 RS(   u%  Migrate tasks from one broker to another.

    Examples::

        celery migrate redis://localhost amqp://guest@localhost//
        celery migrate django:// redis://localhost

    NOTE: This command is experimental, make sure you have
          a backup of the tasks before you continue.
    u   <source_url> <dest_url>u   --limitu   -nRT   u   intRS   u    Number of tasks to consume (int)u	   --timeoutu   -tu   floatRU   g      ?u,   Timeout in seconds (float) waiting for tasksu   --ack-messagesu   -aRj   u
   store_trueu    Ack messages from source broker.u   --tasksu   -Tu    List of task names to filter on.u   --queuesu   -Qu   List of queues to migrate.u	   --foreveru   -Fu'   Continually migrate tasks until killed.c         C@ s&   |  j  |  j j d | d |   d  S(   Nt   statet   body(   R6   t   progress_fmtR7   (   R'   R   R   t   message(    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyt   on_migrate_task  s    c         K@ sI   d d l  m } d d l m } | | |  | |  d |  j | d  S(   Ni    (   t
   Connection(   t   migrate_tasksR   (   t   kombuR   t   celery.contrib.migrateR   R   (   R'   t   sourceR   RV   R   R   (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyRP     s    (   R   R0   R1   RQ   R   Rh   R   t   MIGRATE_PROGRESS_FMTR   R   RP   (    (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyR     s$   
	t   shellc           B@ s#  e  Z d  Z e j e d d d d d d d d e d	 d
 d d d d d d e d d d d d d d d e d d d d d d e d d d d d e d d d d d f Z e e e e e e d  Z d   Z d   Z	 d   Z
 d   Z d   Z d   Z d   Z d    Z d!   Z RS("   u  Start shell session with convenient access to celery symbols.

    The following symbols will be added to the main globals:

        - celery:  the current application.
        - chord, group, chain, chunks,
          xmap, xstarmap subtask, Task
        - all registered tasks.

    u	   --ipythonu   -IRj   u
   store_trueR   u   force_ipythonRS   u   force iPython.u	   --bpythonu   -Bu   force_bpythonu   force bpython.u   --pythonu   -Pu   force_pythonu   force default Python shell.u   --without-tasksu   -Tu   don't add tasks to locals.u
   --eventletu   use eventlet.u   --geventu   use gevent.c   	      K@ sM  t  j j d t j    | r, t d  n  | r? t d  n  d d  l } d d  l } |  j j	 j
   i |  j d 6|  j d 6| j d 6| j d 6| j d 6| j d	 6| j d
 6| j d 6| j d 6| j d 6| j d 6|  _ | s|  j j t d   t |  j j  D   n  | r#|  j   S| r3|  j   S| rC|  j   S|  j   S(   Ni    u   celery.concurrency.eventletu   celery.concurrency.geventu   appu   celeryu   Tasku   chordu   groupu   chainu   chunksu   xmapu   xstarmapu   subtasku	   signaturec         s@ s0   |  ]& } | j  j d   s | j | f Vq d S(   u   celery.N(   Rf   t
   startswithR   (   R   R   (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pys	   <genexpr>A  s    (   R   t   patht   insertt   ost   getcwdR   t   celeryt   celery.task.baseRE   t   loadert   import_default_modulest   Taskt   chordt   groupt   chaint   chunkst   xmapt   xstarmapt   subtaskt	   signaturet   localst   updatet   dictR   R   t   invoke_fallback_shellt   invoke_bpython_shellt   invoke_ipython_shellt   invoke_default_shell(	   R'   t   force_ipythont   force_bpythont   force_pythont   without_taskst   eventlett   geventRV   R   (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyRP   (  s:    








#


c         C@ sg   y d d  l  } WnF t k
 rX y d d  l } Wn t k
 rJ |  j   SX|  j   Sn X|  j   Sd  S(   Ni    (   t   IPythont   ImportErrort   bpythonR   R   R   (   R'   R   R   (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyR   M  s    c         C@ s|   d d  l  } y d d  l } Wn t k
 r/ n6 Xd d  l } | j | j |  j  j  | j d  | j	 d |  j  d  S(   Ni    u   tab:completet   local(
   t   codet   readlineR   t   rlcompletert   set_completert	   CompleterR   t   completet   parse_and_bindt   interact(   R'   R   R   R   (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyR   Z  s    c         C@ sR   xK |  j  |  j |  j |  j |  j f D]% } y |   SWq% t k
 rI q% Xq% Wd  S(   N(   t   _ipythont   _ipython_pre_10t   _ipython_terminalt   _ipython_010t   _no_ipythonR   (   R'   t   ip(    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyR   g  s    c         C@ s*   d d l  m } | d g  d |  j  d  S(   Ni    (   t   start_ipythonR#   t   user_ns(   R   R
  R   (   R'   R
  (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyR  p  s    c         C@ sP   d d l  m } | j   } | j d g   | j j j |  j  | j   d  S(   Ni    (   t   TerminalIPythonAppR#   (	   t   IPython.frontend.terminal.ipappR  t   instancet
   initializeR   R  R   R   t   start(   R'   R  RE   (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyR  t  s
    c         C@ s-   d d l  m } | j d |  j  j   d  S(   Ni    (   t   embedR  (   t   IPython.terminalR  t   TerminalInteractiveShellR   t   mainloop(   R'   R  (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyR  {  s    c         C@ s0   d d l  m } | d g  d |  j  j   d  S(   Ni    (   t   IPShellR#   R  (   t   IPython.ShellR  R   R  (   R'   R  (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyR    s    c         C@ s   t  d   d  S(   Nu   no suitable ipython found(   R   (   R'   (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyR    s    c         C@ s    d d  l  } | j |  j  d  S(   Ni    (   R   R  R   (   R'   R   (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyR     s    (   R   R0   R1   R   Rh   R   R2   RP   R   R   R   R  R  R  R  R  R   (    (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyR     s8   
	#									RS   c           B@ s    e  Z d  Z d   Z d   Z RS(   u   Show help screen and exit.c         C@ s   d j  |   S(   Nu"   %prog <command> [options] {0.args}(   R7   (   R'   R.   (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyR     s    c         O@ sB   |  j  j   |  j t j d |  j d t j d |  j    t	 S(   NR-   t   commandsRv   (
   t   parsert
   print_helpR6   t   HELPR7   R-   R   R   Rv   R	   (   R'   RQ   RV   (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyRP     s
    	(   R   R0   R1   R   RP   (    (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyRS     s   	t   reportc           B@ s   e  Z d  Z d   Z RS(   u2   Shows information useful to include in bugreports.c         O@ s   |  j  |  j j    t S(   N(   R6   RE   t	   bugreportR   (   R'   RQ   RV   (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyRP     s    (   R   R0   R1   RP   (    (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyR    s   R   c           B@ s9  e  Z d  Z d Z i e d 6e d 6e d 6e d 6e d 6e	 d 6e
 d 6e d	 6e d
 6e d 6e d 6e d 6e d 6e d 6e d 6e d 6e d 6Z e Z d  Z e d  d   Z d  d  Z d  d  Z d d  Z d   Z d   Z  d  d  Z! e d d  d  d   Z" e d d  d   Z# d   Z$ d   Z% d   Z& RS(!   u   celeryu   {self.namespace}.commandsu   amqpu   beatu   callu   controlu   eventsu   graphu   helpu   inspectu   listu   migrateu   multiu   purgeu   reportu   resultu   shellu   statusu   workerc         C@ s   | |  j  | p | j <| S(   N(   R  R   (   t   clst   funRf   (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyt   register_command  s    c         C@ s  y |  j  | } Wn( t k
 r; |  j  d d g } } n X|  j  j |  pX |  j  d } ya | d |  j d |  j d |  j d |  j d t |  j d |  j	 |  j
 | d d | d	 SWnM |  j k
 r } |  j |  | j S|  j k
 r} |  j |  | j SXd  S(
   Nu   helpRE   t   on_errorR+   R*   t   on_usage_errorR.   i   i    (   R  t   KeyErrorR^   RE   R   R+   R*   R   R!  R/   R-   RD   R   R>   (   R'   R.   R#   R  t   exc(    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyt   execute  s"    c         C@ sc   | r d } n d } |  j  |  j j d j |    |  j  d j | j d |  d |    d  S(   Nu!   {self.prog_name} {command} --helpu   {self.prog_name} --helpu
   Error: {0}u   Please try '{0}'R'   R.   (   t   errorRv   t   magentaR7   (   R'   R#  R.   t   helps(    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyR!    s    	"i    c         C@ s	  | rg  } x | t  |  k  r | | } | j d  rJ | j |  n | j d  r yN | | d } | j d  r | j |  n | j | | g  | d 7} Wq t k
 r | j |  Pq Xn P| d 7} q W| | r | | | S| j   g | n  g  S(   Nu   --u   -i   (   Rt   R   t   appendt   extendt
   IndexErrorR   (   R'   R#   t   indext   restR   t   nxt(    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyt   _relocate_args_from_start  s,    

c         C@ s   | d k r t  j d j S| S(   Nu   __main__.pyu   __main__(   R   R   t   __file__(   R'   Rf   (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyt   prepare_prog_name  s    c         C@ s{   |  j  |  |  _ |  j |  } |  j d  |  \ } } y | d } Wn! t k
 rj d d g } } n X|  j | |  S(   Ni    u   help(   R0  R-   R.  t   prepare_argsR4   R*  R$  (   R'   R-   R#   RK   R.   (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyt   handle_argv	  s    c         C@ s   | d  k r t j n | } d | d d !k r: t |  _ n  y) t j t t t |   j	 |    Wn t
 k
 r t j t  n Xd  S(   Nu   multii   i   (   R4   R   R#   R2   R3   t   exitR   R   R   R!   R"   R   (   R'   R#   (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyR!     s    	 c         C@ s   | d  k r t j   n | } | r1 | j | n d   } |  j | } d j | |   } | j ry d t j | |  St j	 d d t j d j |  |  | j
 | d j |  |  g  S(   Nc         S@ s   |  S(   N(    (   R   (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyR      R   u
   celery {0}u   |u    u
   {0} --help(   R4   R
   Rv   Rm   R  R7   R   R   R   RC   R   (   R'   R.   R   R   Rv   t   objR$   (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyR     s    	c         @ s    d  k r t j   n    j } g  } xj t D]b \ } }   | j t j d j | |     d j	      f d   | D  d g  q4 Wd j	 |  j
   S(   Nu   + {0}: u   
c         3@ s+   |  ]! }  j  |  d      Vq d S(   i   N(   R   (   R   R.   (   R   Rv   R   R'   (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pys	   <genexpr>4  s   u    (   R4   R
   Rv   t   whitet   command_classesR)  R   R   R7   RC   R   (   R'   R   Rv   R5  R   R  R  (    (   R   Rv   R   R'   s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyR   +  s    	
c         C@ s9   t  |  d k r5 d | d d !k r5 d g d g f Sd  S(   Ni   u   workeri    i   u   -Pu   --pool(   Rt   (   R'   R#   (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyt   with_pool_option:  s    %c         C@ s   |  j    d  S(   N(   t   load_extension_commands(   R'   (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyt   on_concurrency_setup@  s    c         C@ sJ   t  |  j j d |   |  j  j   } | rF t j d | d f  n  d  S(   NR'   u
   Extensionsu   magenta(   R   t   ext_fmtR7   R  t   loadR6  R(  (   R'   Rm   (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyR8  C  s    N('   R   R0   t	   namespaceR:  R   R   RR   R{   R   R   RS   R   R5   R   R&   Ri   R  R   R   R   R   R  R   t   enable_config_from_cmdlineR-   R   R4   R  R$  R!  R.  R0  R2  R!   R   R   R7  R9  R8  (    (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyR     sJ   

%		

		c          O@ s!   t  j } |  r | |  d  S| S(   uO   Deprecated: Use classmethod :meth:`CeleryCommand.register_command`
    instead.i    (   R   R  (   RQ   RV   t	   _register(    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyR.   J  s    	u   __main__(C   R1   t
   __future__R    R   R_   R   R   R   t	   functoolsR   t	   importlibR   t   celery.fiveR   R   t   celery.platformsR   R   R   R	   t   celery.utilsR
   R   t   celery.utils.timeutilsR   t   celery.bin.baseR   R   R   t   celery.bin.amqpR   t   celery.bin.beatR   t   celery.bin.eventsR   t   celery.bin.graphR   t   celery.bin.workerR   t   __all__R  R   t   environR^   R2   t   DEBUGR4   R6  R(  R   R%   R&   R5   RR   Ri   R   R   R   R{   R   R   R   RS   R  R   R.   R   (    (    (    s3   /tmp/pip-unpacked-wheel-gV1wwp/celery/bin/celery.pyt   <module>   s^   "	$	'7% Z)C)	