ó
CÿWc           @@ sd  d  d l  m Z m Z m Z d  d l Z d  d l 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 Z d  d l Z d  d l m Z d d l m Z d d	 l m Z d
 e f d „  ƒ  YZ d „  Z d „  Z d e j f d „  ƒ  YZ d d „ Z d Z d „  Z  d „  Z! d d d „ Z" e# d „ Z$ e ƒ  d Z% [ d S(   i    (   t   absolute_importt   print_functiont   unicode_literalsN(   t   OrderedDict(   t   dirname(   t   iter_entry_points(   t   ShowHelpi   (   t   get_versions(   t   print_colorst   colorc           B@ s,   e  Z d  Z d d „ Z d „  Z d „  Z RS(   u<   
    Deprecated: please use clyent.colors.Color instead
    c         C@ s   d  S(   N(    (   t   selft   textt
   color_list(    (    s.   lib/python2.7/site-packages/clyent/__init__.pyt   __init__   s    c         C@ s   d  S(   N(    (   R
   (    (    s.   lib/python2.7/site-packages/clyent/__init__.pyt	   __enter__   s    c         C@ s   d  S(   N(    (   R
   t   errt   type_t   tb(    (    s.   lib/python2.7/site-packages/clyent/__init__.pyt   __exit__   s    (    (   t   __name__t
   __module__t   __doc__R   R   R   (    (    (    s.   lib/python2.7/site-packages/clyent/__init__.pyR	      s   	c         C@ s1  t  |  j ƒ  ƒ } | j d ƒ r6 | d | | d <n  t |  t j ƒ r’ | j d d  ƒ i  } x$ |  j ƒ  D] } | j	 | | j
 <qk W| | d <n  d „  |  j j d j ƒ  Dƒ } | j t |  ƒ t |  ƒ j ƒ | d <| d d k r| j d ƒ r|  j
 j ƒ  | d <n  | j d d  ƒ | j d d  ƒ | S(	   Nu   helpu   choicesc         S@ s   i  |  ] \ } } | | “ q S(    (    (   t   .0t   kt   v(    (    s.   lib/python2.7/site-packages/clyent/__init__.pys
   <dictcomp>-   s   	 u   actionu   storeu   metavaru   typeu   default(   t   dictt   _get_kwargst   gett
   isinstancet   argparset   _SubParsersActiont   popt   Nonet   _get_subactionst   helpt   destt	   containert   _registriest   itemst   typeR   t   upper(   t   actiont   a_datat   choicest   choicet   reg(    (    s.   lib/python2.7/site-packages/clyent/__init__.pyt   json_action    s      % c         C@ s…   i |  j  d 6|  j d 6g  |  j D]$ } | j t j k r! t | ƒ ^ q! d 6} |  j r g  |  j D] } t | ƒ ^ qb | d <n  | S(   Nu   descriptionu   titleu   actionsu   groups(	   t   descriptiont   titlet   _group_actionsR"   R   t   SUPPRESSR.   t   _action_groupst
   json_group(   t   groupt   at   grp_datat   g(    (    s.   lib/python2.7/site-packages/clyent/__init__.pyR4   7   s    
8	)t	   json_helpc           B@ s#   e  Z d  e j d „ Z d „  Z RS(   i    c         K@ s#   t  j j |  d | d | | d  S(   Nt   nargsR"   (   R   t   ActionR   (   R
   R:   R"   t   kwargs(    (    s.   lib/python2.7/site-packages/clyent/__init__.pyR   C   s    c         C@ s¨   d |  _  i | j d 6| j ƒ  d d 6| j d 6| j d 6} g  | d <x4 | j D]) } | j rR | d j t | ƒ ƒ qR qR Wt	 j
 | t j d d	 ƒt d ƒ ‚ d  S(
   Ni    u   progi   u   usageu   descriptionu   epilogu   groupst   indenti   (   R:   t   progt   format_usageR/   t   epilogR3   R1   t   appendR4   t   jsont   dumpt   syst   stdoutt
   SystemExit(   R
   t   parsert	   namespacet   valuest   option_stringt   docsR5   (    (    s.   lib/python2.7/site-packages/clyent/__init__.pyt   __call__F   s    	

	(   R   R   R   R2   R   RL   (    (    (    s.   lib/python2.7/site-packages/clyent/__init__.pyR9   B   s   c         C@ sE  |  j  d ƒ } | j d d d d d d d d	 d
 ƒ| j d d d d d d d d	 d ƒ| j d d d d d	 d d d d t j d t j ƒ| j d d d d d	 d d d d t j ƒ| j d d d d d d d d	 d ƒ| j d d d d d d d d	 d ƒ|  j d d t ƒ| rA|  j d d d d d  d! | f ƒn  d  S("   Nu   outputu   --show-tracebackR)   u   store_constt   constu   alwayst   defaultu   ttyR"   uG   Show the full traceback for chalmers user errors (default: %(default)s)u   --hide-tracebacku   neverR#   u   show_tracebacku0   Hide the full traceback for chalmers user errorsu   -vu	   --verboseu&   print debug information ot the consoleu	   log_levelu   -qu   --quietu(   Only show warnings or errors the consoleu   --coloru   always display with colorsu
   --no-coloru   coloru   never display with colorsu   --json-helpu   -Vu	   --versionu   versiont   versionu*   %%(prog)s Command line client (version %s)(   t   add_argument_groupt   add_argumentt   loggingt   INFOt   DEBUGt   WARNINGR9   (   RG   RO   t   ogroup(    (    s.   lib/python2.7/site-packages/clyent/__init__.pyt   add_default_argumentsV   s,    u   .pyu   .pycu   .pyoc         C@ sD   g  t  j t |  j ƒ g ƒ D]$ \ } } } | j d ƒ s | ^ q S(   Nu   _(   t   pkgutilt   iter_modulesR   t   __file__t
   startswith(   t   modulet   _t   name(    (    s.   lib/python2.7/site-packages/clyent/__init__.pyt   get_sub_command_namest   s    c         c@ sM   t  |  ƒ } t |  j p |  j d | ƒ} x | D] } t | | ƒ Vq1 Wd  S(   Nt   fromlist(   R_   t
   __import__t   __package__R   t   getattr(   R\   t   namest   this_moduleR^   (    (    s.   lib/python2.7/site-packages/clyent/__init__.pyt   get_sub_commandsx   s    c   	      C@ sÂ   |  j  d d d d ƒ } | rE x$ t | ƒ D] } | j | ƒ q+ Wn  | r{ x- t | ƒ D] } | j ƒ  } | | ƒ qX Wn  x@ | j j ƒ  D]/ \ } } | j d | ƒ | j d d t	 ƒq‹ Wd  S(   NR0   u   Commandst   metavaru    t   sub_command_nameu   --json-helpR)   (
   t   add_subparsersRf   t
   add_parserR   t   loadR+   R&   t   set_defaultsRQ   R9   (	   RG   R\   t   entry_point_namet
   subparserst   command_modulet   entry_pointRj   t   keyt
   sub_parser(    (    s.   lib/python2.7/site-packages/clyent/__init__.pyt   add_subparser_modules€   s    c         C@ s{   t  j d ƒ } | j d t |  d d ƒ ƒ y |  j |  ƒ SWn7 t k
 rv |  j j ƒ  | ro t d ƒ ‚ qw d Sn Xd  S(   Nu
   cli-loggeru   Command 'chalmers %s'u   sub_command_nameu   ?i   (	   RR   t	   getLoggert   errorRc   t   mainR   Rr   t
   print_helpRF   (   t   argst   exitt
   cli_logger(    (    s.   lib/python2.7/site-packages/clyent/__init__.pyt   run_command‘   s    u   version(   u   .pyu   .pycu   .pyo(&   t
   __future__R    R   R   R   t   collectionsR   t   impRB   RR   t   ost   os.pathR   t   pkg_resourcesR   RX   RD   t   clyent.errorsR   t   _versionR   t   colorsR   t   objectR	   R.   R4   R;   R9   R    RW   t   MODULE_EXTENSIONSR_   Rf   Rs   t   TrueR{   t   __version__(    (    (    s.   lib/python2.7/site-packages/clyent/__init__.pyt   <module>   s2   				