
'![c           @  s=  d  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 Z d d l Z d d l	 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 e j j d  Z d e j k re j d Z e d k r	e j j e  Z n  n* e d k r!d Z n e j j e d  Z d	   Z d
   Z e j d d f k  rrd d f \ Z Z n d d f \ Z Z d   Z d   Z e   Z  d e!   Z" d e# f d     YZ$ d   Z% d   Z& d   Z' d   Z( d   Z) d   Z* d   Z+ i	 e j, d 6e- d 6e
 j. d 6e) d  6e' d! 6e* d" 6d#   d$ 6d%   d& 6e+ d' 6Z/ d(   Z0 d) d*  Z1 d+   Z2 d,   Z3 e j4 d-    Z5 d.   Z6 d/ e j7 f d0     YZ7 d1 e j8 f d2     YZ8 d3 e j9 f d4     YZ: d5 e; f d6     YZ< d7 e; f d8     YZ= d9 e< e= f d:     YZ> d; e j? d d<  Z@ d S(=   sI   utilities for Pylint configuration :

* pylintrc
* pylint.d (PYLINTHOME)
i(   t   print_functionN(   t   range(   t   utilst   ~t
   PYLINTHOMEs	   .pylint.dc         C  s5   |  j  t j d  }  t j j t d |  | d f  S(   Nt   _s   %s%s%ss   .stats(   t   replacet   ost   sept   patht   joint   PYLINT_HOME(   t	   base_namet   recurs(    (    s,   lib/python2.7/site-packages/pylint/config.pyt   _get_pdata_pathB   s    c         C  sQ   t  |  d  } y) t | t   } t j |  SWd  QXWn t k
 rL i  SXd  S(   Ni   (   R   t   opent
   _PICK_LOADt   picklet   loadt	   Exception(   t   baset	   data_filet   stream(    (    s,   lib/python2.7/site-packages/pylint/config.pyt   load_resultsG   s    i   i    t   wt   rt   wbt   rbc         C  s   t  j j t  sQ y t  j t  WqQ t k
 rM t d t d t j qQ Xn  t	 | d  } y, t
 | t   } t j |  |  Wd  QXWn6 t t f k
 r } t d | | f d t j n Xd  S(   Ns   Unable to create directory %st   filei   s   Unable to create file %s: %s(   R   R	   t   existsR   t   mkdirt   OSErrort   printt   syst   stderrR   R   t
   _PICK_DUMPR   t   dumpt   IOError(   t   resultsR   R   R   t   ex(    (    s,   lib/python2.7/site-packages/pylint/config.pyt   save_resultsT   s    c          C  s	  t  j j d  r" t  j j d  St  j j d  rD t  j j d  St  j j d  r"t  j j t  j    }  x t  j j t  j j |  d   rt  j j t  j j |  d   }  t  j j t  j j |  d   r t  j j |  d  St  j j t  j j |  d   rq t  j j |  d  Sqq Wn  d t  j k rZt  j j t  j d  rZt  j d } nu t  j j d  } | d k s| d k rd } nB t  j j | d  } t  j j |  st  j j | d d  } n  t  j j |  st  j j d	  rd	 } qd
 } n  | S(   sK   search the pylint rc file and return its path if it find it, else None
    t   pylintrcs	   .pylintrcs   __init__.pys   ..t   PYLINTRCR   s   /roots   .configs   /etc/pylintrcN(
   R   R	   R   t   abspatht   isfilet   getcwdR
   t   environt
   expandusert   None(   t   curdirR)   t	   user_home(    (    s,   lib/python2.7/site-packages/pylint/config.pyt   find_pylintrcb   s2    $!!!(			se  
The following environment variables are used:
    * PYLINTHOME
    Path to the directory where the persistent for the run will be stored. If
not found, it defaults to ~/.pylint.d/ or .pylint.d (in the current working
directory).
    * PYLINTRC
    Path to the configuration file. See the documentation for the method used
to search for configuration file.
t   UnsupportedActionc           B  s   e  Z d  Z RS(   sB   raised by set_option when it doesn't know what to do for an action(   t   __name__t
   __module__t   __doc__(    (    (    s,   lib/python2.7/site-packages/pylint/config.pyR4      s   c         C  sU   t  j |  } x? | D]7 } | |  k r d } t j | | | |  f   q q W| S(   Ns-   option %s: invalid value: %r, should be in %s(   R   t
   _check_csvt   optparset   OptionValueError(   t   choicest   namet   valuet   valuest	   csv_valuet   msg(    (    s,   lib/python2.7/site-packages/pylint/config.pyt   _multiple_choice_validator   s    #c         C  s5   | |  k r1 d } t  j | | | |  f   n  | S(   Ns-   option %s: invalid value: %r, should be in %s(   R9   R:   (   R;   R<   R=   R@   (    (    s,   lib/python2.7/site-packages/pylint/config.pyt   _choice_validator   s    c         C  s   t  j |  S(   N(   R   R8   (   R   R<   R=   (    (    s,   lib/python2.7/site-packages/pylint/config.pyt   _csv_validator   s    c         C  s    t  | d  r | St j |  S(   Nt   pattern(   t   hasattrt   ret   compile(   R   R<   R=   (    (    s,   lib/python2.7/site-packages/pylint/config.pyt   _regexp_validator   s    c         C  s/   g  t  |  | |  D] } t |  | |  ^ q S(   N(   RC   RH   (   R   R<   R=   t   val(    (    s,   lib/python2.7/site-packages/pylint/config.pyt   _regexp_csv_validator   s    c         C  s\   t  | t  r t |  S| d k r) t S| d k r9 t Sd } t j | |  | f   d  S(   Nt   yt   yest   nt   nos<   option %s: invalid yn value %r, should be in (y, yes, n, no)(   RK   RL   (   RM   RN   (   t
   isinstancet   intt   boolt   Truet   FalseR9   R:   (   t   optR   R=   R@   (    (    s,   lib/python2.7/site-packages/pylint/config.pyt   _yn_validator   s    
c         C  s+   | s d } t  j |   n  t j |  S(   Ns   indent string can't be empty.(   R9   R:   R   t   _unquote(   RT   R   R=   R@   (    (    s,   lib/python2.7/site-packages/pylint/config.pyt   _non_empty_string_validator   s    t   stringRP   t   regexpt
   regexp_csvt   csvt   ync         C  s   t  |  d | |  S(   NR;   (   RB   (   RT   R<   R=   (    (    s,   lib/python2.7/site-packages/pylint/config.pyt   <lambda>   s    t   choicec         C  s   t  |  d | |  S(   NR;   (   RA   (   RT   R<   R=   (    (    s,   lib/python2.7/site-packages/pylint/config.pyR]      s   
t   multiple_choicet   non_empty_stringc         C  s   |  t  k r t d |    n  y t  |  | | |  SWnS t k
 r y t  |  |  SWq t k
 r t j d | | |  f   q Xn Xd  S(   Ns   Unsupported type "%s"s"   %s value (%r) should be of type %s(   t
   VALIDATORSR   t	   TypeErrorR9   R:   (   t   opttypet   optdictt   optionR=   (    (    s,   lib/python2.7/site-packages/pylint/config.pyt   _call_validator   s    	t    c         C  s6   y | d } Wn t  k
 r" |  SXt | | | |   S(   s   return a validated value for an option according to its type

    optional argument name is only used for error message formatting
    t   type(   t   KeyErrorRf   (   R=   Rd   R<   t   _type(    (    s,   lib/python2.7/site-packages/pylint/config.pyt	   _validate   s
    c         C  sJ   g  |  j  D]< } t | d d  p% d | k r
 | j t j k	 r
 | ^ q
 S(   Nt   leveli    (   t   option_listt   getattrt   helpR9   t   SUPPRESS_HELP(   t   groupt   outputlevelRe   (    (    s,   lib/python2.7/site-packages/pylint/config.pyt   _level_options   s    c         C  s   |  j  d k s |  j r  | j S| j d d } y |  j  j j | } Wn t k
 ra d } nI X| j |  } | j	 | |  } t
 | j | |  } t j | |  } | t j k s | r |  j } n  | j j |  j t |   S(   s   Patch OptionParser.expand_default with custom behaviour

    This will handle defaults to avoid overriding values in the
    configuration file.
    i    i   N(   t   parserR0   t   default_tagRo   t
   _long_optst   options_managert   _all_optionsRi   t   get_option_deft   option_attrnameRn   t   configR   t   _format_option_valueR9   t
   NO_DEFAULTt   NO_DEFAULT_VALUER   t   str(   t   selfRe   t   optnamet   providerR=   Rd   (    (    s,   lib/python2.7/site-packages/pylint/config.pyt   _expand_default   s    
c          c  s2   t  j }  z t t  j _ d  VWd  |  t  j _ Xd  S(   N(   R9   t   HelpFormatterR   t   expand_default(   t   orig_default(    (    s,   lib/python2.7/site-packages/pylint/config.pyt   _patch_optparse	  s
    		c         C  s   t  |  j | |  S(   N(   RA   R;   (   RT   R<   R=   (    (    s,   lib/python2.7/site-packages/pylint/config.pyt#   _multiple_choices_validating_option  s    t   Optionc           B  s   e  Z e j j d Z e j j d d g Z e j e j j  Z e e d  <e	 e d <e
 e d <e e d <e e d <e e d <d   Z d	   Z e e j j d
 <d   Z RS(   RY   RZ   R[   R\   R_   R`   t   hideRl   c         O  sA   t  j j |  | |  t |  d  r= |  j r= t  j |  _ n  d  S(   NR   (   R9   R   t   __init__RE   R   Rp   Ro   (   R   t   optst   attrs(    (    s,   lib/python2.7/site-packages/pylint/config.pyR   $  s    c         C  s   |  j  d k r |  j d  k r3 t j d |    q t |  j t t f  s t j d t t  |  j   j	 d  d |    q n+ |  j d  k	 r t j d |  j  |    n  d  S(	   NR^   R_   s/   must supply a list of choices for type 'choice's1   choices must be a list of strings ('%s' supplied)t   'i   s#   must not supply choices for type %r(   R^   R_   (
   Rh   R;   R0   R9   t   OptionErrorRO   t   tuplet   listR   t   split(   R   (    (    s,   lib/python2.7/site-packages/pylint/config.pyt   _check_choice)  s    /i   c         C  st   |  j  | |  } |  j d k rR t | |  j  } | rR | j |  | } qR n  |  j |  j |  j | | | |  S(   Nt   named(   t   convert_valueRh   Rn   t   destt   updatet   take_actiont   action(   R   RT   R=   R>   Rt   t   existent(    (    s,   lib/python2.7/site-packages/pylint/config.pyt   process7  s    (   RY   RZ   R[   R\   R_   R`   (   R5   R6   R9   R   t   TYPESt   ATTRSt   copyt   TYPE_CHECKERRH   RJ   RC   RU   R   RW   R   R   t   CHECK_METHODSR   (    (    (    s,   lib/python2.7/site-packages/pylint/config.pyR     s   	 





		t   OptionParserc           B  s&   e  Z d    Z d d  Z d   Z RS(   c         O  s    t  j j |  d t | | d  S(   Nt   option_class(   R9   R   R   R   (   R   R   t   argst   kwargs(    (    s,   lib/python2.7/site-packages/pylint/config.pyR   I  s    c         C  s  | d  k r |  j } n  t | d d  } | j |   g  } | j | j d   | j   |  j r | j t j	 j
 |  |   | j d  n  x^ |  j D]S } | j | k r | j s t | |  r | j | j |   | j d  q q W| j   d j | d   S(   Nt   output_leveli    t   Optionss   
Rg   i(   R0   t	   formatterRn   t   store_option_stringst   appendt   format_headingt   indentRm   R9   t   OptionContainert   format_option_helpt   option_groupsRl   t   descriptionRs   t   format_helpt   dedentR
   (   R   R   Rr   t   resultRq   (    (    s,   lib/python2.7/site-packages/pylint/config.pyR   L  s"    
	
c         C  s%   | |  j  k r! t j |   n  | S(   s   Disable abbreviations.(   t	   _long_optR9   t   BadOptionError(   R   RT   (    (    s,   lib/python2.7/site-packages/pylint/config.pyt   _match_long_opt`  s    N(   R5   R6   R   R0   R   R   (    (    (    s,   lib/python2.7/site-packages/pylint/config.pyR   G  s   	t   _ManHelpFormatterc           B  s   e  Z d  d d d  d  Z d   Z d   Z d   Z d d  Z e d	    Z e d
    Z	 e d    Z
 e d    Z e d    Z RS(   i    i   iO   c         C  s    t  j j |  | | | |  d  S(   N(   R9   R   R   (   R   t   indent_incrementt   max_help_positiont   widtht   short_first(    (    s,   lib/python2.7/site-packages/pylint/config.pyR   j  s    	c         C  s   d | j    S(   Ns   .SH %s
(   t   upper(   R   t   heading(    (    s,   lib/python2.7/site-packages/pylint/config.pyR   o  s    c         C  s   | S(   N(    (   R   R   (    (    s,   lib/python2.7/site-packages/pylint/config.pyt   format_descriptionr  s    c         C  s   y | j  } Wn  t k
 r/ |  j |  } n X| j ry |  j |  } d j g  | j   D] } | j   ^ q[  } n d } d | | f S(   Nt    Rg   s   .IP "%s"
%s
(   t   option_stringst   AttributeErrort   format_option_stringsRo   R   R
   t
   splitlinest   strip(   R   Re   t	   optstringt	   help_textt   lRo   (    (    s,   lib/python2.7/site-packages/pylint/config.pyt   format_optionu  s    	1i   c         C  s   d } y | j    } Wn t k
 r5 | j   } n X|  j | | j  } t | d  rr |  j | | j  } n  d |  j | |  | |  j	 |  | f S(   NRg   t	   long_descs   %s
%s
%s
%s(
   t   _get_prog_nameR   t   get_prog_namet   format_short_descriptionR   RE   t   format_long_descriptionR   t   format_titlet   format_synopsis(   R   t	   optparsert   pkginfot   sectionR   t   pgmt
   short_desc(    (    s,   lib/python2.7/site-packages/pylint/config.pyt   format_head  s    c         C  s7   d j  d   t j   d  D  } d |  | | |  f S(   Nt   -c         s  s   |  ] } t  |  Vq d  S(   N(   R   (   t   .0t   num(    (    s,   lib/python2.7/site-packages/pylint/config.pys	   <genexpr>  s    i   s   .TH %s %s "%s" %s(   R
   t   timet	   localtime(   R   R   t   date(    (    s,   lib/python2.7/site-packages/pylint/config.pyR     s    #c         C  s   d |  | j    f S(   Ns   .SH NAME
.B %s
\- %s
(   R   (   R   R   (    (    s,   lib/python2.7/site-packages/pylint/config.pyR     s    c         C  s   d |  S(   Ns6   .SH SYNOPSIS
.B  %s
[
.I OPTIONS
] [
.I <arguments>
]
(    (   R   (    (    s,   lib/python2.7/site-packages/pylint/config.pyR     s    	c         C  sm   d j  d   | j   D  } | j d d  } | j   j |   rY | t |   } n  d |  | j   f S(   Ns   
c         s  s   |  ] } | j    Vq d  S(   N(   t   lstrip(   R   t   line(    (    s,   lib/python2.7/site-packages/pylint/config.pys	   <genexpr>  s   s   
.
s   

s   .SH DESCRIPTION
.B %s
%s
(   R
   R   R   t   lowert
   startswitht   lenR   (   R   R   (    (    s,   lib/python2.7/site-packages/pylint/config.pyR     s    c         C  sU   d t  |  d |  j  |  j |  j |  j f } t |  d  rQ | d |  j 7} n  | S(   Ns}   .SH SEE ALSO
/usr/share/doc/pythonX.Y-%s/

.SH BUGS
Please report bugs on the project's mailing list:
%s

.SH AUTHOR
%s <%s>
t   debian_namet	   copyrights   
.SH COPYRIGHT
%s
(   Rn   t   modnamet   mailinglistt   authort   author_emailRE   R   (   R   t   tail(    (    s,   lib/python2.7/site-packages/pylint/config.pyt   format_tail  s    (   R5   R6   R   R   R   R   R   t   staticmethodR   R   R   R   R   (    (    (    s,   lib/python2.7/site-packages/pylint/config.pyR   h  s   			t   OptionsManagerMixInc           B  s   e  Z d  Z d d d d  Z d d d  Z e d  Z d   Z d   Z	 d   Z
 d	   Z d
   Z d d d d  Z d d d  Z d   Z d d  Z d   Z d   Z d   Z d d  Z d d  Z d d  Z RS(   sL   Handle configuration from both a configuration file and command line optionsi    c         C  se   | |  _  |  j | d | g  |  _ t j   |  _ i  |  _ i  |  _ i  |  _ | |  _	 d |  _
 d  S(   Nt   versioni    (   t   config_filet   reset_parserst   options_providerst   collectionst   OrderedDictRx   t   _short_optionst   _nocallback_optionst	   _mygroupst   quiett	   _maxlevel(   R   t   usageR   R   R   (    (    s,   lib/python2.7/site-packages/pylint/config.pyR     s    						Rg   c         C  sX   t  j d d  |  _ t t d | d | |  _ |  |  j _ t |  j j j	  |  _
 d  S(   Nt   inline_comment_prefixest   #t   ;R   R   (   R   R   (   t   configparsert   ConfigParsert   cfgfile_parserR   R   t   cmdline_parserRw   t   setR   R   t   _optik_option_attrs(   R   R   R   (    (    s,   lib/python2.7/site-packages/pylint/config.pyR     s    c         C  s  | j  d k s t d   x] t t |  j   D]6 } | j  |  j | j  k r1 |  j j | |  Pq1 q1 W|  j j |  g  | j D] } d | d k r | ^ q } t | d d  } | r | r |  j	 | j
 j   | j | |  n0 x- | D]% \ } } |  j | |  j | |  q Wxt | D]l \ }	 }
 |	 j   }	 g  | j D]. } | d j d d  j   |	 k rC| ^ qC} |  j	 |	 |
 | |  q!Wd S(	   s   register an options provideri    s!   provider's priority can't be >= 0Rq   i   R   Rg   N(    (   t   priorityt   AssertionErrorR   R   R   t   insertR   t   optionsRn   t   add_option_groupR<   R   R7   t   add_optik_optionR   t   get(   R   R   t	   own_groupt   iRe   t   non_group_spec_optionst   groupsRT   Rd   t   gnamet   gdoct   goptions(    (    s,   lib/python2.7/site-packages/pylint/config.pyt   register_options_provider  s&    .c         C  s   | |  j  k r |  j  | } nx t j |  j d | j   } |  j j |  | j | _ | |  j  | <| d k r | |  j j k r |  j j	 |  n  x* | D]" \ } } |  j
 | | | |  q Wd  S(   Nt   titlet   DEFAULT(   R   R9   t   OptionGroupR   t
   capitalizeR  Rl   R   t	   _sectionst   add_sectionR  (   R   t
   group_nameR   R  R   Rq   RT   Rd   (    (    s,   lib/python2.7/site-packages/pylint/config.pyR    s    c         C  s\   |  j  | | |  \ } } | j | |   } | |  j | <t |  j | j pO d  |  _ d  S(   Ni    (   t   optik_optiont
   add_optionRx   t   maxR   Rl   (   R   R   t   optikcontainerRT   Rd   R   Re   (    (    s,   lib/python2.7/site-packages/pylint/config.pyR    s    c         C  s1  t  j  |  } d | k r+ | |  j | <n d | d <|  j | d <d | k r d | k r | j d  d k	 r | d d k r | d c d 7<n  | d =n  d t |  g } d	 | k r | |  j | d	 <| j d
 | d	  | d	 =n  x9 t | j	    D]% } | |  j
 k r | j |  q q W| | f S(   sj   get our personal option definition and return a suitable form for
        use with optik/optparse
        R   t   callbackt   defaultRo   t
   store_truet   store_falses    [current: %default]s   --t   shortR   N(   R  R  (   R   R   t   cb_set_provider_optionR  R0   R   R   R   R   t   keysR   t   pop(   R   R   RT   Rd   R   t   key(    (    s,   lib/python2.7/site-packages/pylint/config.pyR    s(    


c         C  sV   | j  d  r | d } n |  j | d } | d k rB d } n  |  j | |  d S(   s!   optik callback for option settings   --i   i   N(   R   R   R0   t   global_set_option(   R   Re   RT   R=   Rt   (    (    s,   lib/python2.7/site-packages/pylint/config.pyR  1  s    	c         C  s   |  j  | j | |  d S(   s)   set option on the correct option providerN(   Rx   t
   set_option(   R   RT   R=   (    (    s,   lib/python2.7/site-packages/pylint/config.pyR"  >  s    c         C  s|  i  } g  } x |  j  D] } x | j   D] \ } } | d k rM | j } n  | | k r_ q) n  g  | D]C \ }	 }
 } |
 j d  d k	 rf |
 j d  rf |	 |
 | f ^ qf } | s q) n  | | k r | j |  n  | j | g   } | | 7} q) Wq W| pt j } t	 j
 | |  } t } xS | D]K } | rHt d d | n  t	 j | | j   t | |  |  t } q)Wd S(   sr   write a configuration file according to the current configuration
        into the given stream or stdout
        Rh   t
   deprecateds   
R   N(   R   t   options_by_sectionR0   R<   R  R   t
   setdefaultR!   t   stdoutR   t   _get_encodingRS   R    t   format_sectionR   t   sortedRR   (   R   R   t   skipsectionst   encodingR%  t   sectionsR   R   R  RM   t   dt   vt
   alloptionst   printed(    (    s,   lib/python2.7/site-packages/pylint/config.pyt   generate_configB  s6    %i   c         C  s?   t    0 t |  j | | d | p( t j d |  j Wd  QXd  S(   NR   Rl   (   R   t   _generate_manpageR   R!   R'  R   (   R   R   R   R   (    (    s,   lib/python2.7/site-packages/pylint/config.pyt   generate_manpageb  s    
c         C  s"   x |  j  D] } | j   q
 Wd S(   s-   initialize configuration using default valuesN(   R   t   load_defaults(   R   R   (    (    s,   lib/python2.7/site-packages/pylint/config.pyt   load_provider_defaultsh  s    c           s0  d } x |   j  k r d j d g |  d } |   j k rE Pn  |   f d  } d d j d g |  } i d	 d
 6| d	 6| d 6}   j d }   j |   j | |  | j | | f f 7_ | d 7} q	 W| d k r   j } n  | d k	 r;t	 j
 j |  } t	 j
 j |  s;t d j |    q;n  | oPt	 j
 j |  } | r  j }	 t j | d d d  }
 |	 j |
  Wd QXxO t |	 j j    D]5 \ } } | j   r| r| |	 j | j   <qqWn    j rd S| rd j t	 j
 j |   } n d } t | d t j d S(   sr   read the configuration file but do not load it (i.e. dispatching
        values to each options provider)
        i   R   t   longs   -helpc           s$   t    j |   t j d  d  S(   Ni    (   R    Ro   R!   t   exit(   Re   RT   RI   t   pRl   (   R   (    s,   lib/python2.7/site-packages/pylint/config.pyt   helpfuncw  s    s   %s verbose help.R   t   moreR  R   Ro   i    s#   The config file {:s} doesn't exist!R   R,  t	   utf_8_sigNs   Using config file {0}s1   No config file found, using default configurationR   (   R   R
   Rx   R   R  R   R  R0   R   R   R	   R/   R   R%   t   formatR   t   ioR   t	   read_fileR   R  t   itemst   isupperR   R   R+   R    R!   R"   (   R   R   t	   helplevelRT   R:  t   helpmsgRd   R   t   use_config_fileRt   t   fpt   sectR>   R@   (    (   R   s,   lib/python2.7/site-packages/pylint/config.pyt   read_config_filem  sB    
	"	c         C  sx   |  j  } xh | j   D]Z } xQ | j |  D]@ \ } } y |  j | |  Wq, t t j f k
 rk q, q, Xq, Wq Wd S(   sd   dispatch values previously read from a configuration file to each
        options provider)
        N(   R   R-  R@  R"  Ri   R9   R   (   R   Rt   R   Re   R=   (    (    s,   lib/python2.7/site-packages/pylint/config.pyt   load_config_file  s    	c         K  s   |  j  |  S(   s4   override configuration according to given parameters(   t   load_configuration_from_config(   R   R   (    (    s,   lib/python2.7/site-packages/pylint/config.pyt   load_configuration  s    c         C  sP   xI | j    D]; \ } } | j d d  } |  j | } | j | |  q Wd  S(   NR   R   (   R@  R   Rx   R#  (   R   R{   RT   t	   opt_valueR   (    (    s,   lib/python2.7/site-packages/pylint/config.pyRI    s    c      
   C  s   t     | d k r& t j d } n t |  } |  j j d |  \ } } xh |  j D]] } | j } xK | j	 j
   D]: } t | | d  } | d k r qv n  t | | |  qv WqW W| SWd QXd S(   si   Override configuration according to command line parameters

        return additional arguments
        i   R   N(   R   R0   R!   t   argvR   R   t
   parse_argsR   R{   t   __dict__R  Rn   t   setattr(   R   R   R  R   R{   t   attrR=   (    (    s,   lib/python2.7/site-packages/pylint/config.pyt   load_command_line_configuration  s    
	c         C  sV   t  j |  j d | j   d | } | | _ t |  j |  |  _ |  j j |  d S(   s,   add a dummy option section for help purpose R  R   N(   R9   R  R   R  Rl   R  R   R  (   R   R  R   Rl   Rq   (    (    s,   lib/python2.7/site-packages/pylint/config.pyt   add_help_section  s    		c         C  s0   | |  j  j _ t    |  j  j   SWd QXd S(   s.   return the usage string for available options N(   R   R   R   R   R   (   R   Rl   (    (    s,   lib/python2.7/site-packages/pylint/config.pyRo     s    
N(    (   R5   R6   R7   R0   R   R   RR   R  R  R  R  R  R"  R2  R4  R6  RG  RH  RJ  RI  RQ  RR  Ro   (    (    (    s,   lib/python2.7/site-packages/pylint/config.pyR     s&   					 	1				t   OptionsProviderMixInc           B  sz   e  Z d  Z d Z d Z d Z d Z d   Z d   Z d d  Z
 d   Z d d d  Z d	   Z d
   Z d d  Z RS(   s-   Mixin to provide options to an OptionsManageriR  i    c         C  s   t  j   |  _ |  j   d  S(   N(   R9   t   ValuesR{   R5  (   R   (    (    s,   lib/python2.7/site-packages/pylint/config.pyR     s    c         C  s   xx |  j  D]m \ } } | j d  } | d k r
 | d k rO |  j |  } n  | j d  } |  j | | | |  q
 q
 Wd S(   s,   initialize the provider using default valuesR   R  R  N(   R  R  R0   Ry   R#  (   R   RT   Rd   R   R  (    (    s,   lib/python2.7/site-packages/pylint/config.pyR5    s    c         C  s:   | d k r |  j |  } n  | j d | j d d   S(   s-   get the config attribute corresponding to optR   R   R   N(   R0   Ry   R  R   (   R   RT   Rd   (    (    s,   lib/python2.7/site-packages/pylint/config.pyRz     s    c         C  s   t  |  j |  j |  d  S(   s*   get the current value for the given optionN(   Rn   R{   Rz   R0   (   R   RT   (    (    s,   lib/python2.7/site-packages/pylint/config.pyt   option_value  s    c         C  s  | d
 k r |  j |  } n  | d
 k	 r? t | | |  } n  | d
 k r` | j d d  } n  | d k r t |  j |  j | |  |  n_| d k r t |  j |  j | |  d  n1| d k r t |  j |  j | |  d  n| d k r|  j | |  } t |  j | d
  } | d
 k rt | t	 t
 f  rG| } n" | d
 k	 rig  } | j |  n  t |  j | |  qt | t
  rt |  j | | | f  q| j |  n2 | d	 k r| d	 d
 | | d
  n t |   d
 S(   s?   method called to set an option (registered in the options list)R   t   storeR  t   counti    R  i   R   R  N(   R  RW  (   R0   Ry   Rk   R  RO  R{   Rz   Rn   RO   R   R   R   R4   (   R   R   R=   R   Rd   t   _list(    (    s,   lib/python2.7/site-packages/pylint/config.pyR#    s8    """	c         C  s^   |  j  s t  x) |  j  D] } | d | k r | d Sq Wt j d | |  j f |   d S(   s7   return the dictionary defining an option given its namei    i   s   no such option %s in section %rN(   R  R   R9   R   R<   (   R   RT   Re   (    (    s,   lib/python2.7/site-packages/pylint/config.pyRy     s    	c         c  s   i  } xK |  j  D]@ \ } } | j | j d  g   j | | |  j |  f  q Wd | k rw d | j d  f Vn  x1 t | j    D] \ } } | j	   | f Vq Wd S(   st   return an iterator on options grouped by section

        (section, [list of (optname, optdict, optvalue)])
        Rq   N(
   R  R&  R  R   RU  R0   R   R*  R@  R   (   R   R-  R   Rd   R   R  (    (    s,   lib/python2.7/site-packages/pylint/config.pyR%  %  s    c         c  sJ   | d  k r |  j } n  x+ | D]# \ } } | | |  j |  f Vq Wd  S(   N(   R0   R  RU  (   R   R  R   Rd   (    (    s,   lib/python2.7/site-packages/pylint/config.pyt   options_and_values3  s    (    N(   R5   R6   R7   R   R<   R  Rl   R   R5  R0   Rz   RU  R#  Ry   R%  RY  (    (    (    s,   lib/python2.7/site-packages/pylint/config.pyRS    s   			!			t   ConfigurationMixInc           B  s   e  Z d  Z d   Z RS(   s]   basic mixin for simple configurations which don't need the
    manager / providers model
    c         O  s   | s | j  d d  n  | j  d d  t j |  | |  t j |   t |  d d   s g  |  _ xm |  j D]_ \ } } y | d j   d f } Wn t	 k
 r qn n X| |  j k rn |  j j
 |  qn qn Wn  |  j |  d t d  S(   NR   Rg   R   i   R   Rq   R  (   R&  R   R   RS  Rn   R0   R   R  R   Ri   R   R  RS   (   R   R   R   R   Rd   t   gdef(    (    s,   lib/python2.7/site-packages/pylint/config.pyR   >  s    	(   R5   R6   R7   R   (    (    (    s,   lib/python2.7/site-packages/pylint/config.pyRZ  :  s   i   c         C  sp   t    } | | _ |  | _ t | j |  | |  d | t |  j |  d | t | j |  d | d  S(   NR   (   R   R   Rt   R    R   R   R   (   R   R   R   R   Rl   R   (    (    s,   lib/python2.7/site-packages/pylint/config.pyR3  P  s    			(A   R7   t
   __future__R    t
   contextlibR   R   R>  R9   R   R   RF   R!   R   R   t	   six.movesR   t   pylintR   R	   R/   t	   USER_HOMER.   R   t   dirnameR
   R   R   t   version_infoR#   R   R(   R3   R*   t   globalst   ENV_HELPR   R4   RA   RB   RC   RH   RJ   RU   RW   RV   RP   RG   Ra   Rf   Rk   Rs   R   t   contextmanagerR   R   R   R   R   R   t   objectR   RS  RZ  R'  R3  (    (    (    s,   lib/python2.7/site-packages/pylint/config.pyt   <module>   s   						!									




			
	0!c a