ó
Lñ¦[c           @   sG   d  d l  m Z e ƒ  Z e d „ Z d „  Z d „  Z d d „ Z d S(   iÿÿÿÿ(   t   localc         C   sH   y t  t d ƒ d SWn, t t f k
 rC |  sD t d ƒ ‚ qD n Xd S(   s‚  Returns the current click context.  This can be used as a way to
    access the current context object from anywhere.  This is a more implicit
    alternative to the :func:`pass_context` decorator.  This function is
    primarily useful for helpers such as :func:`echo` which might be
    interested in changing its behavior based on the current context.

    To push the current context, :meth:`Context.scope` can be used.

    .. versionadded:: 5.0

    :param silent: is set to `True` the return value is `None` if no context
                   is available.  The default behavior is to raise a
                   :exc:`RuntimeError`.
    t   stackiÿÿÿÿs!   There is no active click context.N(   t   getattrt   _localt   AttributeErrort
   IndexErrort   RuntimeError(   t   silent(    (    s,   lib/python2.7/site-packages/click/globals.pyt   get_current_context   s
    c         C   s    t  j j d g  ƒ j |  ƒ d S(   s*   Pushes a new context to the current stack.R   N(   R   t   __dict__t
   setdefaultt   append(   t   ctx(    (    s,   lib/python2.7/site-packages/click/globals.pyt   push_context   s    c           C   s   t  j j ƒ  d S(   s%   Removes the top level from the stack.N(   R   R   t   pop(    (    (    s,   lib/python2.7/site-packages/click/globals.pyt   pop_context"   s    c         C   s6   |  d k	 r |  St d t ƒ } | d k	 r2 | j Sd S(   s«   "Internal helper to get the default value of the color flag.  If a
    value is passed it's returned unchanged, otherwise it's looked up from
    the current context.
    R   N(   t   NoneR   t   Truet   color(   R   R   (    (    s,   lib/python2.7/site-packages/click/globals.pyt   resolve_color_default'   s
    N(	   t	   threadingR    R   t   FalseR   R   R   R   R   (    (    (    s,   lib/python2.7/site-packages/click/globals.pyt   <module>   s
   			