
U@Pc           @   s  d  Z  d 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 Z d d l Z d d l Z d d l m Z m Z m Z d   Z d   Z e e d  Z e e d	  Z e e d
  Z e e d  Z e e d  Z e e d  Z e e d  Z e e d  Z e e d  Z e e d  Z e e d  Z e e d  Z  e d  Z! d   Z" d   Z# d e	 j$ f d     YZ$ d e	 j% f d     YZ% d e	 j& e j' f d     YZ& d e j( f d     YZ d e) f d      YZ* d S(!   s  
Command-line and common processing for Docutils front-end tools.

Exports the following classes:

* `OptionParser`: Standard Docutils command-line processing.
* `Option`: Customized version of `optparse.Option`; validation support.
* `Values`: Runtime settings; objects are simple structs
  (``object.attribute``).  Supports cumulative list settings (attributes).
* `ConfigParser`: Standard Docutils config file processing.

Also exports the following functions:

* Option callbacks: `store_multiple`, `read_config_file`.
* Setting validators: `validate_encoding`,
  `validate_encoding_error_handler`,
  `validate_encoding_and_error_handler`,
  `validate_boolean`, `validate_ternary`, `validate_threshold`,
  `validate_colon_separated_string_list`,
  `validate_comma_separated_string_list`,
  `validate_dependency_file`.
* `make_paths_absolute`.
* SettingSpec manipulation: `filter_settings_spec`.
t   reStructuredTextiN(   t   SUPPRESS_HELP(   t   locale_encodingt   ErrorOutputt   ErrorStringc         O   sX   x! | D] } t  | j | d  q Wx- | j   D] \ } } t  | j | |  q1 Wd S(   s   
    Store multiple values in `parser.values`.  (Option callback.)

    Store `None` for each attribute named in `args`, and store the value for
    each key (attribute name) in `kwargs`.
    N(   t   setattrt   valuest   Nonet   items(   t   optiont   optt   valuet   parsert   argst   kwargst	   attributet   key(    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyt   store_multiple.   s    c         C   sM   y | j  |  } Wn  t k
 r5 } | j |  n X| j j | |  d S(   sQ   
    Read a configuration file during option processing.  (Option callback.)
    N(   t   get_config_file_settingst
   ValueErrort   errorR   t   update(   R	   R
   R   R   t   new_settingsR   (    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyt   read_config_file:   s
    c         C   sR   y t  j |  Wn: t k
 rM t d |  | f  d  t j   d f  n X| S(   Ns$   setting "%s": unknown encoding: "%s"i   (   t   codecst   lookupt   LookupErrorR   t   syst   exc_info(   t   settingR   t   option_parsert   config_parsert   config_section(    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyt   validate_encodingD   s    c         C   sL   y t  j |  Wn4 t k
 rG t d |  d  t j   d f  n X| S(   Ns   unknown encoding error handler: "%s" (choices: "strict", "ignore", "replace", "backslashreplace", "xmlcharrefreplace", and possibly others; see documentation for the Python ``codecs`` module)i   (   R   t   lookup_errorR   R   R   R   (   R   R   R   R   R    (    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyt   validate_encoding_error_handlerN   s    c         C   s   d | k ru | j  d  \ } } t |  d | | | |  | r[ | j | |  d |  q{ t | j |  d |  n | } t |  | | | |  | S(   s   
    Side-effect: if an error handler is included in the value, it is inserted
    into the appropriate place as if it was a separate setting/option.
    t   :t   _error_handler(   t   splitR#   t   setR   R   R!   (   R   R   R   R   R    t   encodingt   handler(    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyt#   validate_encoding_and_error_handler[   s    


c         C   si   t  | t  r | Sy | j | j   j   SWn4 t k
 rd t d |  d t j	   d f  n Xd S(   s|   Check/normalize boolean settings:
         True:  '1', 'on', 'yes', 'true'
         False: '0', 'off', 'no','false', ''
    s   unknown boolean value: "%s"i   N(
   t
   isinstancet   boolt   booleanst   stript   lowert   KeyErrorR   R   R   R   (   R   R   R   R   R    (    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyt   validate_booleanq   s    c         C   sS   t  | t  s | d k r | Sy | j | j   j   SWn t k
 rN | SXd S(   s   Check/normalize three-value settings:
         True:  '1', 'on', 'yes', 'true'
         False: '0', 'off', 'no','false', ''
         any other value: returned as-is.
    N(   R+   R,   R   R-   R.   R/   R0   (   R   R   R   R   R    (    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyt   validate_ternary   s    c         C   s+   t  |  } | d k  r' t d   n  | S(   Ni    s(   negative value; must be positive or zero(   t   intR   (   R   R   R   R   R    (    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyt   validate_nonnegative_int   s    c         C   su   y t  |  SWn` t k
 rp y | j | j   SWqq t t f k
 rl t d |  d  t j	 d f  qq Xn Xd  S(   Ns   unknown threshold: %r.i   (
   R3   R   t
   thresholdsR/   R0   t   AttributeErrorR   R   R   R   (   R   R   R   R   R    (    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyt   validate_threshold   s    c         C   sG   t  | t  s! | j d  } n" | j   } | j | j d   | S(   NR$   (   R+   t   listR&   t   popt   extend(   R   R   R   R   R    t   last(    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyt$   validate_colon_separated_string_list   s
    c         C   sr   t  | t  s | g } n  | j   } g  | j d  D]$ } | j d  r7 | j d  ^ q7 } | j |  | S(   sH   Check/normalize list arguments (split at "," and strip whitespace).
    u   ,u    	
(   R+   R8   R9   R&   R.   R:   (   R   R   R   R   R    R;   t   iR   (    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyt   validate_comma_separated_list   s    :c         C   s)   | s
 d S| j  d  r | S| d Sd  S(   Ns   ./t   /(   t   endswith(   R   R   R   R   R    (    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyt   validate_url_trailing_slash   s
    c         C   s9   y t  j j |  SWn t k
 r4 t  j j d   SXd  S(   N(   t   docutilst   utilst   DependencyListt   IOErrorR   (   R   R   R   R   R    (    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyt   validate_dependency_file   s    c         C   sd   t  |  | | | |  } xE | D]= } t j j |  } | | k r t d | | f   q q W| S(   Ns$   invalid class value %r (perhaps %r?)(   R>   RB   t   nodest   make_idR   (   R   R   R   R   R    t   clst
   normalized(    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyt   validate_strip_class   s    c         C   s   | d k r t j   } n  x} | D]u } | |  k r" |  | } t | t  rr g  | D] } t | |  ^ qT } n | r t | |  } n  | |  | <q" q" Wd S(   s   
    Interpret filesystem path settings relative to the `base_path` given.

    Paths are values in `pathdict` whose keys are in `keys`.  Get `keys` from
    `OptionParser.relative_path_settings`.
    N(   R   t   ost   getcwduR+   R8   t   make_one_path_absolute(   t   pathdictt   keyst	   base_pathR   R   t   path(    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyt   make_paths_absolute   s    
"c         C   s   t  j j t  j j |  |   S(   N(   RL   RR   t   abspatht   join(   RQ   RR   (    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyRN      s    c   	      O   s   t  |   } x t d t |  d  D] } g  } x | | D] } g  | d D]+ } | j d  rM | d j d d  ^ qM d } | | k r q< n  | | j   k r | j | |  q< | j |  q< Wt |  | | <q% Wt |  S(   s  Return a copy of `settings_spec` excluding/replacing some settings.

    `settings_spec` is a tuple of configuration settings with a structure
    described for docutils.SettingsSpec.settings_spec.

    Optional positional arguments are names of to-be-excluded settings.
    Keyword arguments are option specification replacements.
    (See the html4strict writer for an example.)
    i   i   i   s   --t   -t   _i    (   R8   t   ranget   lent
   startswitht   replaceRP   t   appendt   tuple(	   t   settings_spect   excludeR[   t   settingsR=   t   newoptst   opt_spect
   opt_stringt   opt_name(    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyt   filter_settings_spec   s    
(t   Valuesc           B   s)   e  Z d  Z d   Z d   Z d   Z RS(   s   
    Updates list attributes by extension rather than by replacement.
    Works in conjunction with the `OptionParser.lists` instance attribute.
    c         O   sN   t  j j |  | |  t |  d  s5 |  j d  k rJ t j j   |  _ n  d  S(   Nt   record_dependencies(	   t   optparseRf   t   __init__t   hasattrRg   R   RB   RC   RD   (   t   selfR   R   (    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyRi     s    c         C   s   t  | t  r | j } n  | j   } xb | j j   D]Q } t |  |  r7 | | k r7 t |  |  } | r | | | 7} | | =q q7 q7 W|  j |  d  S(   N(	   R+   Rf   t   __dict__t   copyt   listsRP   Rj   t   getattrt   _update_loose(   Rk   t
   other_dictR   R   R   (    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyR     s    c         C   s   |  j  d |  j  S(   s    Return a shallow copy of `self`.t   defaults(   t	   __class__Rl   (   Rk   (    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyRm   #  s    (   t   __name__t
   __module__t   __doc__Ri   R   Rm   (    (    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyRf   	  s   		t   Optionc           B   s'   e  Z e j j d  d g Z d   Z RS(   t	   validatort	   overridesc   	      C   s   t  j j |  | | | |  } |  j } | r |  j r t | |  } y |  j | | |  } WnE t k
 r } t  j d | t |  f  d t
 j   d f  n Xt | | |  n  |  j r t | |  j d  q n  | S(   s   
        Call the validator function on applicable settings and
        evaluate the 'overrides' option.
        Extends `optparse.Option.process`.
        s   Error in option "%s":
    %si   N(   Rh   Rw   t   processt   destRx   Ro   t	   Exceptiont   OptionValueErrorR   R   R   R   R   Ry   (	   Rk   R
   R   R   R   t   resultR   t	   new_valueR   (    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyRz   ,  s     			(   Rt   Ru   Rh   Rw   t   ATTRSRz   (    (    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyRw   (  s   t   OptionParserc        8   B   s  e  Z d  Z d d d g Z d j   Z i d d 6d d 6d	 d
 6d d 6d d 6Z i	 e d 6e d 6e d 6e d 6e d 6e d 6e d 6e d 6e d 6Z	 e
 e j d d  p e p d Z d Z d d d d g i  f d d d  g i d! d" 6e d# 6f d$ d% g i d& d" 6d' d( 6f d) d* d+ g i d, d" 6d- d. 6d/ d( 6f d0 d1 d2 g i d, d" 6d3 d. 6d/ d( 6f d4 d5 g i d, d" 6d d. 6d/ d( 6f d6 d7 d8 g i d! d" 6e d# 6f d9 d: g i d; d< 6f d= d> g i d? d" 6e d? 6d dB 6f dC dD g i dE d( 6d, d" 6dF d. 6dF dG 6f dH dI g i dE d( 6d, d" 6dJ d. 6f dK dL g i dE d( 6d& d" 6f dM dN g i d! d" 6d dG 6e d# 6f dO dP g i dQ d( 6d& d" 6f dR dS g i d! d" 6dT d( 6d dG 6e d# 6f dU dV g i d& d" 6dT d( 6f dW dX g i d! d" 6e d# 6f dY dZ g i d& d" 6d[ d( 6f d\ d] g i d^ d" 6d_ d( 6d` d< 6e d# 6f da db g i d^ d" 6dc d( 6d` d< 6e d# 6f dd de df g i e dg 6d dG 6dh d( 6di d< 6e d# 6f dj dk dl g i d, d" 6d d. 6dh d( 6f dm dn do g i d, d" 6d d. 6dh d( 6f dp dq g i e dg 6dr d( 6d dG 6di d< 6e d# 6f ds dt g i d, d" 6d d. 6dr d( 6f du dv g i e dg 6dw d( 6d dG 6di d< 6e d# 6f dx dy g i d! d" 6e d# 6f dz d{ g i d& d" 6d| d( 6f d} d~ g i d d( 6d d< 6f d d g i d! d" 6d dG 6e d# 6f d d g i d d( 6d& d" 6f d d d g i d d< 6e d# 6f d d g i d dG 6e d# 6f d d d g i d d< 6d dG 6e d# 6f d d g i d dG 6e d# 6f d e e f d d g i d d< 6e dG 6e d# 6f d e d g i e dG 6e d# 6f d d d g i d d( 6d dG 6d d< 6f d d g i d d< 6e d# 6d dG 6f d d g i d d< 6d d 6d? d" 6e d? 6f d d d g i d d" 6f d d d g i d d" 6f e d g i d dG 6f e d g i d dG 6f e d g i d! d" 6f e d g i d! d" 6f e d g i d! d" 6f e d g i d! d" 6f e d g i d^ d" 6d d( 6e d# 6f e d g i d! d" 6f f2 f Z i d d 6d d 6d d 6d d 6Z d Z d Z d e j  e j! e j" j   d e j# f Z$ d d d d  Z% d   Z& d   Z' d   Z( d   Z) d   Z* d   Z+ d   Z, d   Z- d   Z. RS(   s  
    Parser for command-line and library use.  The `settings_spec`
    specification here and in other Docutils components are merged to build
    the set of command-line options and runtime settings for this process.

    Common settings (defined below) and component-specific settings must not
    conflict.  Short options are reserved for common settings, and components
    are restrict to using long options.
    s   /etc/docutils.confs   ./docutils.confs   ~/.docutilss(   info 1 warning 2 error 3 severe 4 none 5i   t   infoi   t   warningi   R   i   t   severei   t   nonet   1t   ont   yest   truet   0t   offt   not   falset    R(   t   asciit   backslashreplaces   General Docutils Optionss'   Specify the document title as metadata.s   --titles2   Include a "Generated by Docutils" credit and link.s   --generators   -gt
   store_truet   actionRx   s"   Do not include a generator credit.s   --no-generatort   store_falset	   generatorR{   s2   Include the date at the end of the document (UTC).s   --dates   -dt   store_consts   %Y-%m-%dt   constt	   datestamps   Include the time & date (UTC).s   --times   -ts   %Y-%m-%d %H:%M UTCs'   Do not include a datestamp of any kind.s   --no-datestamps&   Include a "View document source" link.s   --source-links   -ss3   Use <URL> for a source link; implies --source-link.s   --source-urls   <URL>t   metavars-   Do not include a "View document source" link.s   --no-source-linkt   callbackt   source_linkt
   source_urlt   callback_argss4   Link from section headers to TOC entries.  (default)s   --toc-entry-backlinkst   toc_backlinkst   entryt   defaults0   Link from section headers to the top of the TOC.s   --toc-top-backlinkst   tops+   Disable backlinks to the table of contents.s   --no-toc-backlinkss6   Link from footnotes/citations to references. (default)s   --footnote-backlinkss/   Disable backlinks from footnotes and citations.s   --no-footnote-backlinkst   footnote_backlinkss0   Enable section numbering by Docutils.  (default)s   --section-numberingt   sectnum_xforms&   Disable section numbering by Docutils.s   --no-section-numberings/   Remove comment elements from the document tree.s   --strip-commentss6   Leave comment elements in the document tree. (default)s   --leave-commentst   strip_commentss   Remove all elements with classes="<class>" from the document tree. Warning: potentially dangerous; use with caution. (Multiple-use option.)s   --strip-elements-with-classR\   t   strip_elements_with_classess   <class>s   Remove all classes="<class>" attributes from elements in the document tree. Warning: potentially dangerous; use with caution. (Multiple-use option.)s   --strip-classt   strip_classess   Report system messages at or higher than <level>: "info" or "1", "warning"/"2" (default), "error"/"3", "severe"/"4", "none"/"5"s   --reports   -rt   choicest   report_levels   <level>s4   Report all system messages.  (Same as "--report=1".)s	   --verboses   -vs3   Report no system messages.  (Same as "--report=5".)s   --quiets   -qsd   Halt execution at system messages at or above <level>.  Levels as in --report.  Default: 4 (severe).s   --haltt
   halt_levels6   Halt at the slightest problem.  Same as "--halt=info".s   --strictsj   Enable a non-zero exit status for non-halting system messages at or above <level>.  Default: 5 (disabled).s   --exit-statust   exit_status_levels3   Enable debug-level system messages and diagnostics.s   --debugs    Disable debug output.  (default)s
   --no-debugt   debugs-   Send the output of system messages to <file>.s
   --warningst   warning_streams   <file>s1   Enable Python tracebacks when Docutils is halted.s   --tracebacks%   Disable Python tracebacks.  (default)s   --no-tracebackt	   tracebacksi   Specify the encoding and optionally the error handler of input text.  Default: <locale-dependent>:strict.s   --input-encodings   -is   <name[:handler]>sl   Specify the error handler for undecodable characters.  Choices: "strict" (default), "ignore", and "replace".s   --input-encoding-error-handlert   stricts^   Specify the text encoding and optionally the error handler for output.  Default: UTF-8:strict.s   --output-encodings   -os   utf-8s   Specify error handler for unencodable output characters; "strict" (default), "ignore", "replace", "xmlcharrefreplace", "backslashreplace".s   --output-encoding-error-handlersJ   Specify text encoding and error handler for error output.  Default: %s:%s.s   --error-encodings   -esS   Specify the error handler for unencodable characters in error output.  Default: %s.s   --error-encoding-error-handlers<   Specify the language (as BCP 47 language tag).  Default: en.s
   --languages   -lt   language_codet   ens   <name>s)   Write output file dependencies to <file>.s   --record-dependenciess6   Read configuration settings from <file>, if it exists.s   --configt   stringt   types,   Show this program's version number and exit.s	   --versions   -Vt   versions    Show this help message and exit.s   --helps   -ht   helps   --id-prefixs   --auto-id-prefixt   ids   --dump-settingss   --dump-internalss   --dump-transformss   --dump-pseudo-xmls   --expose-internal-attributet   expose_internalss   --strict-visitort   _disable_configt   _sourcet   _destinationt   _config_filest   generals+   %%prog (Docutils %s [%s], Python %s, on %s)i    c      
   O   s  i  |  _  g  |  _ t j j |  d t d d d t j d d  | | |  j s^ |  j	 |  _ n  t
 |  j  |  _ |  f t |  |  _ |  j |  j  |  j | p i   | r|  j d ry |  j   } Wn  t k
 r } |  j |  n X|  j | j  n  d S(   s   
        `components` is a list of Docutils components each containing a
        ``.settings_spec`` attribute.  `defaults` is a mapping of setting
        default overrides.
        t   option_classt   add_help_optiont	   formattert   widthiN   R   N(   Rn   t   config_filesRh   R   Ri   Rw   R   t   TitledHelpFormatterR   t   version_templateR8   t   relative_path_settingsR]   t
   componentst   populate_from_componentst   set_defaults_from_dictRr   t   get_standard_config_settingsR   R   Rl   (   Rk   R   Rr   t   read_config_filesR   R   t   config_settingsR   (    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyRi     s$    			
	c         C   s`  x#| D]} | d k r q n  | j } |  j j | j  x t d t |  d  D] } | | | d !\ } } } | r t j |  | |  } |  j |  n |  } xW | D]O \ }	 }
 } | j	 d |	 |
 |  } | j
 d  d k r d |  j | j <q q W| j rT |  j j | j  qT qT Wq Wx3 | D]+ } | r-| j r-|  j j | j  q-q-Wd S(   sE  
        For each component, first populate from the `SettingsSpec.settings_spec`
        structure, then from the `SettingsSpec.settings_defaults` dictionary.
        After all components have been processed, check for and populate from
        each component's `SettingsSpec.settings_default_overrides` dictionary.
        i    i   R   R   R\   i   N(   R   R^   R   R:   RX   RY   Rh   t   OptionGroupt   add_option_groupt
   add_optiont   getRn   R{   t   settings_defaultsRr   R   t   settings_default_overrides(   Rk   R   t	   componentR^   R=   t   titlet   descriptiont   option_spect   groupt	   help_textt   option_stringsR   R	   (    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyR   >  s,    		
		c         C   s   y t  j d j t  j  } Wn t k
 r9 |  j } n Xt  j j } d t  j k r y d d l } Wq t	 k
 r d   } q Xn  g  | D] } | j
   r | |  ^ q S(   s:   Return list of config files, from environment or standard.t   DOCUTILSCONFIGt   HOMEiNc         S   s   |  S(   N(    (   t   x(    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyt   <lambda>n  s    (   RL   t   environR&   t   pathsepR0   t   standard_config_filesRR   t
   expandusert   pwdt   ImportErrorR.   (   Rk   R   t   expandR   t   f(    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyt   get_standard_config_files]  s    c         C   s=   t    } x- |  j   D] } | j |  j |  |   q W| S(   N(   Rf   R   R   R   (   Rk   R`   t   filename(    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyR   q  s    	c         C   s   t    } | j | |   |  j j | j  t j j |  } i  } t   } x| |  j	 D]q } | si qW n  x\ t
 | j p{ d  | j f D]; } | | k r q n  d | | <| j | j |  |   q WqW Wt | j |  j |  | j S(   sA   Returns a dictionary containing appropriate config file settings.i   (    (   t   ConfigParsert   readR   R:   t   _filesRL   RR   t   dirnameRf   R   R]   t   config_section_dependenciesR    R   t   get_sectionRS   Rl   R   (   Rk   t   config_fileR   RQ   t   appliedR`   R   t   section(    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyR   w  s$    		
!c         C   s>   |  j  |  \ | _ | _ t | j |  j  |  j | _ | S(   s/   Store positional arguments as runtime settings.(   t
   check_argsR   R   RS   Rl   R   R   R   (   Rk   R   R   (    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyt   check_values  s    c         C   s   d  } } | r7 | j d  } | d k r7 d  } q7 n  | rd | j d  } | d k rd d  } qd n  | rz |  j d  n  | r | | k r |  j d  n  | | f S(   Ni    RV   s   Maximum 2 arguments allowed.s_   Do not specify the same file for both source and destination.  It will clobber the source file.(   R   R9   R   (   Rk   R   t   sourcet   destination(    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyR     s    
c         C   s   |  j  j |  d  S(   N(   Rr   R   (   Rk   Rr   (    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyR     s    c         C   s   t  |  j  } |  j | _ | S(   s(   Needed to get custom `Values` instances.(   Rf   Rr   R   R   (   Rk   Rr   (    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyt   get_default_values  s    c         C   sV   x? |  j  |  g D]- } x$ | j D] } | j | k r! | Sq! Wq Wt d |   d S(   s  
        Get an option by its dest.

        If you're supplying a dest which is shared by several options,
        it is undefined which option of those is returned.

        A KeyError is raised if there is no option with the supplied
        dest.
        s   No option with dest == %r.N(   t   option_groupst   option_listR{   R0   (   Rk   R{   R   R	   (    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyt   get_option_by_dest  s
    
N(   R   R   (   R   (    (/   Rt   Ru   Rv   R   R&   t   threshold_choicesR5   t   Truet   FalseR-   Ro   R   t   stderrR   R   t   default_error_encodingt$   default_error_encoding_error_handlerR1   R   RK   R7   R*   R#   RF   R   R   R<   R^   R   R   R    RB   t   __version__t   __version_details__R   t   platformR   Ri   R   R   R   R   R   R   R   R   R   (    (    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyR   D  sb  
	)&














	

	

	




	


 								R   c           B   se   e  Z i d d 6d d 6d d 6Z d Z d Z d	   Z d
   Z d   Z d   Z d   Z	 d   Z
 RS(   s   pep_html writert
   stylesheett   pep_stylesheett   stylesheet_patht   pep_stylesheet_patht   templatet   pep_templates  
The "[option]" section is deprecated.  Support for old-format configuration
files may be removed in a future Docutils release.  Please revise your
configuration files.  See <http://docutils.sf.net/docs/user/config.html>,
section "Old-Format Configuration Files".
sh   Unable to read configuration file "%s": content not encoded as UTF-8.
Skipping "%s" configuration file.
c         O   s/   t  j j |  | |  g  |  _ t   |  _ d  S(   N(   t   CPt   RawConfigParserRi   R   R   t   _stderr(   Rk   R   R   (    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyRi     s    	c         C   s2  t  |  t t f k r$ | g } n  x| D] } y t j | d d  } Wn t k
 r` q+ n XyB t j d k  r t j	 j
 |  | |  n t j	 j |  | |  Wn; t k
 r |  j j |  j | | f  | j   q+ n X| j   |  j j |  |  j d  r|  j |  n  |  j | |  q+ Wd  S(   Nt   rs   utf-8i   i   t   options(   i   i   (   R   t   strt   unicodeR   t   openRE   R   t   version_infoR  R  t   readfpt	   read_filet   UnicodeDecodeErrorR  t   writet   not_utf8_errort   closeR   R\   t   has_sectiont   handle_old_configt   validate_settings(   Rk   t	   filenamesR   R   t   fp(    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyR     s(    

c         C   s   t  j |  j t | d  |  j d  } |  j d  sG |  j d  n  x | j   D] \ } } | |  j k r |  j | \ } } |  j |  s |  j |  q n d } | } |  j	 | |  sT |  j
 | | |  qT qT W|  j d  d  S(   Ni    R  R   (   t   warningst   warn_explicitt   old_warningt   ConfigDeprecationWarningR   R  t   add_sectionR   t   old_settingst
   has_optionR'   t   remove_section(   Rk   R   R  R   R   R   R   (    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyR    s    
c   	   
   C   s%  x|  j    D]} x|  j |  D] } y | j |  } Wn t k
 rR q# n X| j r |  j | |  } y% | j | | | d |  d | } WnK t k
 r } t d | | t |  | | f  d t
 j   d f  n X|  j | | |  n  | j r# |  j | | j d  q# q# Wq Wd S(   si   
        Call the validator function and implement overrides on all applicable
        settings.
        R   R    sA   Error in config file "%s", section "[%s]":
    %s
        %s = %si   N(   t   sectionsR  R   R0   Rx   R   R|   R   R   R   R   R   R'   Ry   (	   Rk   R   R   R   R   R	   R   R   R   (    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyR    s(    	'	c         C   s   | j    j d d  S(   sW   
        Transform '-' to '_' so the cmdline form of option names can be used.
        RV   RW   (   R/   R[   (   Rk   t	   optionstr(    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyt   optionxform"  s    c         C   sL   i  } |  j  |  rH x0 |  j |  D] } |  j | |  | | <q% Wn  | S(   sf   
        Return a given section as a dictionary (empty if the section
        doesn't exist).
        (   R  R  R   (   Rk   R   t   section_dictR	   (    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyR   (  s
    (   s   pep_html writerR   (   s   pep_html writerR   (   s   pep_html writers   template(   Rt   Ru   R  R  R  Ri   R   R  R  R"  R   (    (    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyR     s   
							R  c           B   s   e  Z d  Z RS(   s3   Warning for deprecated configuration file features.(   Rt   Ru   Rv   (    (    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyR  4  s   (+   Rv   t   __docformat__RL   t   os.pathR   R  R   R  R   Rh   R   RB   t   docutils.utilst   docutils.nodest   docutils.utils.error_reportingR   R   R   R   R   R   R!   R#   R*   R1   R2   R4   R7   R<   R>   RA   RF   RK   RS   RN   Re   Rf   Rw   R   t   SettingsSpecR  t   DeprecationWarningR  (    (    (    s5   /usr/lib/python2.7/dist-packages/docutils/frontend.pyt   <module>   sH   		
				 {v