
    -eD                       U d Z ddlmZ ddlZ ej        e          ZddlZddlm	c m
Z ddlmZ ddlmZmZ ddlZerddlmZ ddlmZmZ erdd	lmZ d
ZeZded<   eZded<    G d de          ZddZ  e             Z!dS )a   This modules exposes geometry data for Unites States.

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

The data is indexed by two-tuples of ``(state_id, county_id)`` that
have the following dictionaries as values:

.. code-block:: ipython

    In [25]: data[(1,1)]
    Out[25]:
    {
        'name': 'Autauga',
        'detailed name': 'Autauga County, Alabama',
        'state': 'al',
        'lats': [32.4757, ..., 32.48112],
        'lons': [-86.41182, ..., -86.41187]
    }

Entries for ``'name'`` can have duplicates for certain states (e.g. Virginia).
The combination of ``'detailed name'`` and ``'state'`` will always be unique.

.. bokeh-sampledata-xref:: us_counties
    )annotationsN)nan)TYPE_CHECKING	TypedDict)NDArray   )external_pathopen_csv)	TypeAlias)datar   StateCountyc                  B    e Zd ZU ded<   ded<   ded<   ded<   ded<   dS )	
CountyDatastrnamedetailed_namestatezNDArray[np.float64]latslonsN)__name__
__module____qualname____annotations__     <lib/python3.11/site-packages/bokeh/sampledata/us_counties.pyr   r   T   sH         IIIJJJr   r   return&dict[tuple[State, County], CountyData]c                    i } t          t          d                    5 }t          |           t          j        |dd          }|D ]p}|\  }}}}}}}}}}	}
}}t          j        |          }g }g }t          |                    d                    D ]\  }}|dk    r4|	                    t                     |	                    t                     t          |j        t                    sJ d |j                                        D             }t          t!          d |D                        \  }}|                    |           |                    |           t%          |||t'          j        |          t'          j        |          	          | t+          |	          t+          |
          f<   r	 d
d
d
           n# 1 swxY w Y   | S )z

    zUS_Counties.csv,")	delimiter	quotecharz).//outerBoundaryIs/LinearRing/coordinatesr   c              3  P   K   | ]!}|                     d           dd         V  "dS )r!   Nr   )split).0cs     r   	<genexpr>z_read_data.<locals>.<genexpr>n   s5      FFq!''#,,rr*FFFFFFr   c                P    g | ]#\  }}t          |          t          |          f$S r   )float)r'   lonlats      r   
<listcomp>z_read_data.<locals>.<listcomp>o   s-    %V%V%V83uSzz5::&>%V%V%Vr   )r   r   r   r   r   N)r
   r	   nextcsvreaderet
fromstring	enumeratefindallappendr   
isinstancetextr   r&   listzipextendr   nparrayint)r   fr1   rowr   _r   geometrydet_namestate_id	county_idxmlr   r   ipolycoordsr-   r,   s                      r   
_read_datarJ   [   s    46D	- 122	3	3 qQA<<< 	 	CX[UD!UAxAq(HiQRTU-))C "D "D$S[[1\%]%]^^ ! !4q55KK$$$KK$$$!$)S11111FFDIOO4E4EFFF%V%Vv%V%V%V WXXSC   C    4> (x~~x~~5 5 5D#h--Y011	              2 Ks   FGGG)r   r   )"__doc__
__future__r   logging	getLoggerr   logr0   xml.etree.ElementTreeetreeElementTreer2   mathr   typingr   r   numpyr<   numpy.typingr   util.sampledatar	   r
   typing_extensionsr   __all__r>   r   r   r   r   rJ   r   r   r   r   <module>rZ      sj    6 # " " " " " g!! 


 " " " " " " " " "       + + + + + + + +     %$$$$$$ 6 5 5 5 5 5 5 5 ,++++++                    J z||r   