
\c           @   s8   d  Z  d d l m Z m Z e   Z d e d  Z d S(   sY  
    babel.lists
    ~~~~~~~~~~~

    Locale dependent formatting of lists.

    The default locale for the functions in this module is determined by the
    following environment variables, in that order:

     * ``LC_ALL``, and
     * ``LANG``

    :copyright: (c) 2015-2019 by the Babel Team.
    :license: BSD, see LICENSE for more details.
i(   t   Localet   default_localet   standardc         C   s  t  j |  } |  s d St |   d k r3 |  d S| | j k rm t d | | t t | j   f   n  | j | } t |   d k r | d j |    S| d j |  d |  d  } x+ |  d d !D] } | d	 j | |  } q W| d
 j | |  d  } | S(   s  
    Format the items in `lst` as a list.

    >>> format_list(['apples', 'oranges', 'pears'], locale='en')
    u'apples, oranges, and pears'
    >>> format_list(['apples', 'oranges', 'pears'], locale='zh')
    u'apples\u3001oranges\u548cpears'
    >>> format_list(['omena', 'peruna', 'aplari'], style='or', locale='fi')
    u'omena, peruna tai aplari'

    These styles are defined, but not all are necessarily available in all locales.
    The following text is verbatim from the Unicode TR35-49 spec [1].

    * standard:
      A typical 'and' list for arbitrary placeholders.
      eg. "January, February, and March"
    * standard-short:
      A short version of a 'and' list, suitable for use with short or abbreviated placeholder values.
      eg. "Jan., Feb., and Mar."
    * or:
      A typical 'or' list for arbitrary placeholders.
      eg. "January, February, or March"
    * or-short:
      A short version of an 'or' list.
      eg. "Jan., Feb., or Mar."
    * unit:
      A list suitable for wide units.
      eg. "3 feet, 7 inches"
    * unit-short:
      A list suitable for short units
      eg. "3 ft, 7 in"
    * unit-narrow:
      A list suitable for narrow units, where space on the screen is very limited.
      eg. "3′ 7″"

    [1]: https://www.unicode.org/reports/tr35/tr35-49/tr35-general.html#ListPatterns

    :param lst: a sequence of items to format in to a list
    :param style: the style to format the list with. See above for description.
    :param locale: the locale
    t    i   i    sF   Locale %s does not support list formatting style %r (supported are %s)i   t   2t   startit   middlet   end(   R    t   parset   lent   list_patternst
   ValueErrort   listt   sortedt   format(   t   lstt   stylet   localet   patternst   resultt   elem(    (    s*   lib/python2.7/site-packages/babel/lists.pyt   format_list   s$    *N(   t   __doc__t
   babel.coreR    R   t   DEFAULT_LOCALER   (    (    (    s*   lib/python2.7/site-packages/babel/lists.pyt   <module>   s   	