U
    /e                     @  sn   d Z ddlmZ ddlZeeZddlZddlZddl	Z	ddl
m  mZ ddlmZ dZdd Ze ZdS )	a   Geometry data for US States.

This module contains one dict: ``data``.

The data is indexed by the two letter state code (e.g., 'CA', 'TX') and has the
following structure:

.. code-block:: python

    In [4]: data["OR"]
    Out[4]:
    {
        'name': 'Oregon',
        'region': 'Northwest',
        'lats': [46.29443, ..., 46.26068],
        'lons': [-124.03622, ..., -124.15935]
    }

    )annotationsN   )package_path)datac               	   C  s   t d} i }ttd}t|d}t| tj|ddd}|D ]}|\}}}}	}
t	
|	}g }g }t|dD ]f\}}|dkr||  ||  d	d
 |j D }ttdd |D  \}}|| || qv||||d||< qDW 5 Q R X |S )z

    NaNz"US_Regions_State_Boundaries.csv.gzzutf-8,")	delimiter	quotecharz).//outerBoundaryIs/LinearRing/coordinatesr   c                 s  s    | ]}| d dd V  qdS )r   Nr   )split).0c r   >/tmp/pip-unpacked-wheel-f5fndrjf/bokeh/sampledata/us_states.py	<genexpr>Y   s     z_read_data.<locals>.<genexpr>c                 S  s    g | ]\}}t |t |fqS r   )float)r   lonlatr   r   r   
<listcomp>Z   s     z_read_data.<locals>.<listcomp>)nameregionlatslons)r   gzipopenr   codecs
iterdecodenextcsvreaderet
fromstring	enumeratefindallappendtextr   listzipextend)nanr   fdecodedr   rowr   r   codeZgeometrydummyxmlr   r   iZpolyZcoordsr   r   r   r   r   
_read_dataD   s6    




r1   )__doc__
__future__r   logging	getLogger__name__logr   r   r   xml.etree.ElementTreeetreeElementTreer    Zutil.sampledatar   __all__r1   r   r   r   r   r   <module>   s   
'