ó
mÜJ]c           @` sĽ   d  Z  d d l m Z m Z m Z m Z d d l Z e j e  Z	 d d l
 Z
 d d l Z d d l Z d d l j j Z d d l m Z d Z d   Z e   Z d S(	   u1  
This modules exposes geometry data for Unites States. It exposes a dictionary 'data' which is
indexed by the two letter state code (e.g., 'CA', 'TX') and has the following dictionary as the
associated value:

    data['CA']['name']
    data['CA']['region']
    data['CA']['lats']
    data['CA']['lons']

i    (   t   absolute_importt   divisiont   print_functiont   unicode_literalsNi   (   t   package_pathu   datac          C` sŁ  t  d  }  i  } t j t d   v} t j | d  } t |  t j | d t	 d  d t	 d  } x)| D]!} | \ } } } }	 }
 t
 j |	  } g  } g  } xÂ t | j d   D]Ť \ } } | d	 k rő | j |   | j |   n  d
   | j j   D } t t g  | D]$ \ } } t  |  t  |  f ^ q   \ } } | j |  | j |  qŔ Wi | d 6| d 6| d 6| d 6| | <qt WWd QX| S(   u   

    u   NaNu"   US_Regions_State_Boundaries.csv.gzu   utf-8t	   delimiteru   ,t	   quotecharu   "u)   .//outerBoundaryIs/LinearRing/coordinatesi    c         s` s"   |  ] } | j  d   d  Vq d S(   u   ,i   N(   t   split(   t   .0t   c(    (    s9   lib/python2.7/site-packages/bokeh/sampledata/us_states.pys	   <genexpr>S   s    u   nameu   regionu   latsu   lonsN(   t   floatt   gzipt   openR   t   codecst
   iterdecodet   nextt   csvt   readert   strt   ett
   fromstringt	   enumeratet   findallt   appendt   textR   t   listt   zipt   extend(   t   nant   datat   ft   decodedR   t   rowt   regiont   namet   codet   geometryt   dummyt   xmlt   latst   lonst   it   polyt   coordst   lont   lat(    (    s9   lib/python2.7/site-packages/bokeh/sampledata/us_states.pyt
   _read_data>   s4    
'"	:(   u   data(   t   __doc__t
   __future__R    R   R   R   t   loggingt	   getLoggert   __name__t   logR   R   R   t   xml.etree.cElementTreet   etreet   cElementTreeR   t   util.sampledataR   t   __all__R.   R   (    (    (    s9   lib/python2.7/site-packages/bokeh/sampledata/us_states.pyt   <module>   s   "	'