HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/env/lib64/python3.10/site-packages/uszipcode/__pycache__/model.cpython-38.pyc
U

��a��@s�ddlZddlZddlZddlmZddlmZddlZddl	m
Z
ddlZddl
mZddlmZmZe
��ZGdd�dej�ZeGd	d
�d
eej��ZGdd�de�ZGd
d�de�ZGdd�de�ZdS)�N)�total_ordering)�Path�)�MAPPER_STATE_ABBR_SHORT_TO_LONG)�	haversine�Unitc@s eZdZdZdZdZdZdZdS)�ZipcodeTypeEnumz%
    zipcode type visitor class.
    ZSTANDARDzPO BOXZUNIQUEZMILITARYN)�__name__�
__module__�__qualname__�__doc__�StandardZPO_BoxZUniqueZMilitary�rr�D/Users/sanhehu/Documents/GitHub/uszipcode-project/uszipcode/model.pyrs
rc@s�eZdZdZdZejejdd�Ze�ej�Z	e�ej�Z
e�ej�Ze�ej
j�Ze�ej�Ze�ej�Zejejdd�Zejejdd�Ze�ej�Ze�ej�Ze�ej
j�Ze�ej�Ze�ej�Ze�ej�Ze�ej�Ze�ej�Ze�ej�Ze�ej�Ze�ej�Z e�ej�Z!e�ej�Z"e�ej�Z#e�ej�Z$d�%d�Z&e'dd��Z(e'e)d	�d
d��Z*e'e+d	�dd
��Z,e'e+d	�dd��Z-dd�Z.dd�dd�Z/dd�dd�Z0dd�Z1e2j3fe4e4e2d�dd�Z5d e6d�dd�Z7dS)!�AbstractSimpleZipcodez!
    Base class for Zipcode.
    T)�primary_key)�indexz7zipcode,zipcode_type,city,county,state,lat,lng,timezone�,cCs|jS)z+
        Alias of ``.major_city``.
        )�
major_city��selfrrr�cityGszAbstractSimpleZipcode.city)�returncCs|j|j|j|jd�S)z"
        Border boundary.
        )ZwestZeastZnorthZsouth)�bounds_west�bounds_east�bounds_north�bounds_southrrrr�boundsNs
�zAbstractSimpleZipcode.boundscCs
|j��S)zH
        Return state abbreviation, two letters, all uppercase.
        )�state�upperrrrr�
state_abbrZsz AbstractSimpleZipcode.state_abbrcCst�|j���S)z)
        Return state full name.
        )r�getrrrrrr�
state_longasz AbstractSimpleZipcode.state_longcCs
|jdk	S)z,
        For Python3 bool() method.
        N��zipcoderrrr�__bool__hszAbstractSimpleZipcode.__bool__)�othercCs.|jdks|jdkrtd��n|j|jkSdS)z0
        For ``>`` comparison operator.
        Nz2Empty Zipcode instance doesn't support comparison.)r$�
ValueError�rr&rrr�__lt__ns
�zAbstractSimpleZipcode.__lt__cCs|j|jkS)z1
        For ``==`` comparison operator.
        r#r(rrr�__eq__xszAbstractSimpleZipcode.__eq__cCs
t|j�S)z#
        For hash() method
        )�hashr$rrrr�__hash__~szAbstractSimpleZipcode.__hash__)�lat�lng�unitcCst|j|jf||f|d�S)z�
        Calculate the distance of the center of this zipcode from a coordinator.

        :param lat: latitude.
        :param lng: longitude.
        )r/)rr-r.)rr-r.r/rrr�	dist_from�szAbstractSimpleZipcode.dist_from��include_nullcCs|j|d�}tj|dd�S)z"
        Convert to json.
        r1�)�indent)�to_OrderedDict�json�dumps)rr2�datarrr�to_json�szAbstractSimpleZipcode.to_jsonN)T)8r	r
rr�__abstract__�sa�Column�Stringr$�zipcode_typerZpost_office_city�sam�types�CompressedJSONTypeZcommon_city_listZcountyr�Floatr-r.�timezoneZradius_in_milesZarea_code_list�Integer�
population�population_density�land_area_in_sqmi�water_area_in_sqmi�
housing_units�occupied_housing_units�median_home_value�median_household_incomerrrr�split�_settings_major_attrs�propertyr�dictr�strr r"r%r)r*r,rZMILES�floatr0�boolr9rrrrrsV�

	rc@s�eZdZdZe�ejj�Z	e�ejj�Z
e�ejj�Ze�ejj�Ze�ejj�Z
e�ejj�Ze�ejj�Ze�ejj�Ze�ejj�Ze�ejj�Ze�ejj�Ze�ejj�Ze�ejj�Ze�ejj�Ze�ejj�Ze�ejj�Ze�ejj�Ze�ejj�Ze�ejj�Ze�ejj�Ze�ejj�Ze�ejj�Ze�ejj�Ze�ejj�Z e�ejj�Z!e�ejj�Z"e�ejj�Z#e�ejj�Z$e�ejj�Z%e�ejj�Z&e�ejj�Z'e�ejj�Z(e�ejj�Z)e�ejj�Z*dS)�AbstractComprehensiveZipcodeTN)+r	r
rr:r;r<r?r@rAZpolygonZpopulation_by_yearZpopulation_by_ageZpopulation_by_genderZpopulation_by_raceZhead_of_household_by_ageZfamilies_vs_singlesZhouseholds_with_kidsZchildren_by_ageZhousing_typeZyear_housing_was_builtZhousing_occupancyZvacancy_reasonZowner_occupied_home_valuesZ$rental_properties_by_number_of_roomsZ+monthly_rent_including_utilities_studio_aptZ$monthly_rent_including_utilities_1_bZ$monthly_rent_including_utilities_2_bZ(monthly_rent_including_utilities_3plus_bZemployment_statusZ"average_household_income_over_timeZhousehold_incomeZannual_individual_earningsZEsources_of_household_income____percent_of_households_receiving_incomeZLsources_of_household_income____average_income_per_household_by_income_sourceZPhousehold_investment_income____percent_of_households_receiving_investment_incomeZLhousehold_investment_income____average_income_per_household_by_income_sourceZOhousehold_retirement_income____percent_of_households_receiving_retirement_incomZLhousehold_retirement_income____average_income_per_household_by_income_sourceZsource_of_earningsZ7means_of_transportation_to_work_for_workers_16_and_overZtravel_time_to_work_in_minutesZ1educational_attainment_for_population_25_and_overZschool_enrollment_age_3_to_17rrrrrT�sf��������rTc@seZdZdZdS)�
SimpleZipcodeZsimple_zipcodeN�r	r
r�
__tablename__rrrrrU�srUc@seZdZdZdS)�ComprehensiveZipcodeZcomprehensive_zipcodeNrVrrrrrX�srX)r6�enum�typing�	functoolsr�pathlib_mater�
sqlalchemyr;�sqlalchemy.orm�orm�sqlalchemy_mater?r rrr�declarative_base�Base�Enumr�ExtendedBaserrTrUrXrrrr�<module>s 
w<