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/lib/python3.10/site-packages/uszipcode/__pycache__/db.cpython-38.pyc
U

Y�aB�@szdZddlZddlmZddlmZddlmZddlZ	dZ
dZee��d�Z
ee
d	�Zee
d
�Zeeeed�dd
�ZdS)av
The dataset for ``uszipcode`` is from multiple source, and integrated by Sanhe Hu.

- 2012-01-22 federal governmanet zipcode data from
  http://federalgovernmentzipcodes.us/
- 2010 zcta2010 population, wage, houseunit, land, water area data from
  from http://proximityone.com/cen2010_zcta_dp.htm
- 2015-10-01 geometry google map geocoding data from http://maps.google.com
�N)�Path)�repr_data_size)�atomic_writezZhttps://github.com/MacHu-GWU/uszipcode-project/releases/download/1.0.1.db/simple_db.sqlitezahttps://github.com/MacHu-GWU/uszipcode-project/releases/download/1.0.1.db/comprehensive_db.sqlitez
.uszipcodezsimple_db.sqlitezcomprehensive_db.sqlite)�db_file_path�download_url�
chunk_size�
progress_sizec		Cs�t|�jjddd�td|�d|�d��tj|dd�}d}|}t|ddd	��R}|�|�D]@}|sfq�|�|�||7}||krZtd
�	t
|���||7}qZW5QRXtd�dS)NT)�parents�exist_okz	Download z from z ...)�streamr�wb)�mode�	overwritez  {} downloaded ...z  Complete!)r�parent�mkdir�print�requests�getrZiter_content�write�formatr)	rrrr�responseZdownloaded_sizeZnext_log_threshold�f�chunk�r�A/Users/sanhehu/Documents/GitHub/uszipcode-project/uszipcode/db.py�download_db_files
r)�__doc__r�pathlib_materZpathlib_mate.helperr�atomicwritesrZsqlalchemy_mateZsam�SIMPLE_DB_FILE_DOWNLOAD_URL�"COMPREHENSIVE_DB_FILE_DOWNLOAD_URL�homeZUSZIPCODE_HOME�DEFAULT_SIMPLE_DB_FILE_PATH�"DEFAULT_COMPREHENSIVE_DB_FILE_PATH�str�intrrrrr�<module>s


�