o
    Df                     @   s  d Z ddlZddlZddlmZmZmZ ddlmZ ddl	m
Z
mZ ddlmZmZmZ ejde de d	d
Zejddddd ejddZejdddZejddd ejddddgdd ejddd ejdd d ejd!d"d ejd#d$dd ejd%d&dd ejd'd(dd ejd)d*dd ejd+d,dd ejd-d.d ejddd/dd d0d1 Zd2d3 Zed4kre  dS dS )5zE
This is the main entry point for pyproj CLI

e.g. python -m pyproj

    N)__proj_version____version___show_versions)BBox)get_data_dirget_user_data_dir)_download_resource_fileget_proj_endpointget_transform_grid_listzpyproj version: z [PROJ version: ])descriptionz-vz	--verbosez+Show verbose debugging version information.
store_true)helpactioncommands)titlesynczBTool for synchronizing PROJ datum and transformation support data.)namer   z--bboxa  Specify an area of interest to restrict the resources to download. The area of interest is specified as a bounding box with geographic coordinates, expressed in degrees in an unspecified geographic CRS. `west_long` and `east_long` should be in the [-180,180] range, and `south_lat` and `north_lat` in the [-90,90]. `west_long` is generally lower than `east_long`, except in the case where the area of interest crosses the antimeridian.)r   z--spatial-testa`  Specify how the extent of the resource files are compared to the area of use specified explicitly with `--bbox`. By default, any resource files whose extent intersects the value specified by `--bbox` will be selected. If using the ``contains`` strategy, only resource files whose extent is contained in the value specified by `--bbox` will be selected.
intersectscontains)r   choicesdefaultz--source-idzRestrict resource files to be downloaded to those whose source_id property contains the ID value. Default is all possible values.z--area-of-usezRestrict resource files to be downloaded to those whose area_of_use property contains the AREA_OF_USE value. Default is all possible values.z--filezRestrict resource files to be downloaded to those whose name property  (file name) contains the FILE value. Default is all possible values.z--exclude-world-coveragez(Exclude files which have world coverage.z--include-already-downloadedz*Include grids that are already downloaded.z--list-filesz#List the files without downloading.z--allz%Download all missing transform grids.z--system-directoryzfIf enabled, it will sync grids to the main PROJ data directory instead of the user writable directory.z--target-directoryzFThe directory to sync grids to instead of the user writable directory.zPrint download information.c              
   C   s  t | j| j| j| j| j| jfst  dS | jr+t | j| j| j| j| jfr+t	dd}| jdurL| j
d\}}}}tt|t|t|t|d}| jrV| jrVt	d| j}| jrgt 
tjjd }n|smtd}t| j| j| j|| j| j | j|d}| jrtd	 td
 nt }|D ]4}	| jrt|	d d |	d d |	d ddd q|	d d }
t| d|
 |
|| j|	d d d qdS )z'
    Handle sync command arguments
    Nz]Cannot use '--all' with '--list-files', '--source-id','--area-of-use', '--bbox', or '--file'.,)westsoutheastnorthz:Cannot set both --target-directory and --system-directory.r   T)	source_idarea_of_usefilenamebboxspatial_testinclude_world_coverageinclude_already_downloadedtarget_directoryz"filename | source_id | area_of_usez"----------------------------------
propertiesr   r   r   z | )sep/	sha256sum)file_url
short_name	directoryverbosesha256)anyr    
list_filesallr   r   filesync_parser
print_helpRuntimeErrorsplitr   floatr$   system_directoryr   ospathr&   r   r
   r!   exclude_world_coverager#   printr	   getr   r,   )argsr    r   r   r   r   r$   gridsendpointgridr    rA   H/home/ubuntu/webapp/venv/lib/python3.10/site-packages/pyproj/__main__.py_parse_sync_commandr   s   
	





rC   c                  C   s<   t  } t| drt|  dS | jrt  dS t   dS )z:
    Main entrypoint into the command line interface.
    r    N)parser
parse_argshasattrrC   r,   r   show_versionsr3   )r=   rA   rA   rB   main   s   
rH   __main__)__doc__argparser8   pyprojr   r   r   
pyproj.aoir   pyproj.datadirr   r   pyproj.syncr   r	   r
   ArgumentParserrD   add_argumentadd_subparsers
subparsers
add_parserr2   rC   rH   __name__rA   rA   rA   rB   <module>   s    Q
