
    'h"/              
          S SK Jr  S SKJr  S SKJrJr  S SKrS SK	J
r
JrJr  S SKJrJrJrJrJrJr  S SKJr  S SKJrJr  S SKr\" \5      R6                  R9                  5       S	-  rS
SSSSSSSSS.	r\R?                  5        V Vs0 s H  u  pX_M	     snn r / SQr!S S S S SS S.r"S r#\RH                  RK                  \(       + SS9r&\RH                  RK                  \(       + =(       d    \(       + SS9r'\RH                  RK                  \(       + SS9r(\RH                  RK                  \(       + =(       d    \(       + SS9r)\RH                  RK                  \(       + SS9r*\RH                  RK                  \(       + SS9r+S r,\RZ                  " SS9S 5       r.\RZ                  " SS9S  5       r/\RZ                  " S\!S!9S" 5       r0\RZ                  " SS#/S!9S$ 5       r1\RZ                  " SS9S% 5       r2\RZ                  " SS9S& 5       r3\RZ                  " SS9S' 5       r4\RZ                  " SS9S( 5       r5\RZ                  " SS9S) 5       r6\RZ                  " SS9S* 5       r7\RZ                  " SS9S+ 5       r8\RZ                  " SS9S, 5       r9\RZ                  " SS9S- 5       r:\RZ                  " SS9S. 5       r;\RZ                  " SS9S/ 5       r<\RZ                  " SS9S0 5       r=\RZ                  " SS9S1 5       r>\RZ                  " SS9S2 5       r?\RZ                  " SS9S3 5       r@\RZ                  " S/ S4QS!9S5 5       rAgs  snn f )6    )BytesIO)Path)ZIP_DEFLATEDZipFileN)__gdal_version_string____version__list_drivers)HAS_ARROW_APIHAS_ARROW_WRITE_APIHAS_GDAL_GEOSHAS_PYARROW
HAS_PYPROJHAS_SHAPELY)
vsi_rmtree)readwritefixtures
FlatGeobufGeoJSON
GeoJSONSeqGPKGzESRI Shapefile)	.fgb.geojson	.geojsonl	.geojsons.gpkgz	.gpkg.zip.shpz.shp.zipz.shz)r   r   r   r   r      )r   r   r   r   r   r   c                     SR                  S [        [        5       R                  5       5       5       5      nS[         S[
         SU 3$ )Nz, c              3   6   #    U  H  u  pU S U S3v   M     g7f)()N ).0driver
capabilitys      iC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\pyogrio/tests/conftest.py	<genexpr>'pytest_report_header.<locals>.<genexpr>8   s'      "@F (!J<q!"@s   zpyogrio z
GDAL z
Supported drivers: )joinsortedr	   itemsr   r   )configdriverss     r'   pytest_report_headerr/   7   sU    ii "()=)=)?"@ G
 ;-  '( )%Y	(    zGDAL>=3.6 required)reasonzGDAL>=3.6 and pyarrow requiredzpyproj requiredz&GDAL>=3.8 required for Arrow write APIz GDAL compiled with GEOS requiredzShapely >= 2.0 requiredc                     X R                   :X  a  U $ XR                   U 3-  nUR                  5       (       a  U$ [        U 5      u  pEpgUS:X  a  SUS'   SUS'   OUS:X  a
  SUS'   SUS'   [	        X6U40 UD6  U$ )Nr   Fspatial_indexUnknowngeometry_typer   MultiPolygon)suffixstemexistsr   r   )testfile_pathdst_dirextdst_pathmeta_geometry
field_datas           r'   prepare_testfilerB   W   s    
"""../u55H$($7!DX
f} %_ )_	 %_ ._	(j1D1Or0   session)scopec                      [         $ N	_data_dirr#   r0   r'   data_dirrI   p   s    r0   functionc                 X    [        USS5      n[        [        S5      -  n[        X0U5      $ )Nparamr   +naturalearth_lowres/naturalearth_lowres.shp)getattrrH   r   rB   )tmp_pathrequestr<   r:   s       r'   naturalearth_lowresrQ   u   s-    
'7F
+C%R SSMMS99r0   )rD   paramsc                 .    [        XUR                  5      $ rF   rB   rL   rO   rQ   rP   s      r'   naturalearth_lowres_all_extrV   }       /7==IIr0   r   c                 .    [        XUR                  5      $ rF   rT   rU   s      r'   naturalearth_lowres_geojsonrY      rW   r0   c                    XR                    S3-  n[        US[        SS9 nS H3  nUR                   SU 3nUR	                  UR
                  U-  U5        M5     SSS5        USU S	UR                    34$ ! , (       d  f       N"= f)
z4Wrap naturalearth_lowres as a zip file for VSI testsz.zipw   )modecompressioncompresslevel)dbfprjshpshxcpg.Nz/vsizip//)namer   r   r8   r   parent)rO   rQ   pathoutr<   filenames         r'   naturalearth_lowres_vsirl      s     112$77D	C\	Ks6C-2231SE:HII)008;XF 7 
L
 8D6#6#;#;"<=== 
L	Ks   :A88
Bc              #      #    [        U 5      u  pp4SU R                   3n[        SU SU S35      nSUS'   SUS'   [        XcU4S	S
0UD6  Uv   [	        UR
                  5        g7f)z8Write naturalearth_lowres to a vsimem file for VSI testspyogrio_fixture_z/vsimem/rf   r   Fr3   r6   r5   layerrQ   N)r   r8   r   r   r   rh   )rQ   r>   r?   r@   rA   rg   r=   s          r'   naturalearth_lowres_vsimemrp      s~      %))<$=!DX16678DhtfAdV512H!D*D	(jN0ENN
Nxs   A#A%c                      [         S-  $ )Nzline_zm.gpkgrG   r#   r0   r'   line_zm_filerr      s    ~%%r0   c                      [         S-  $ )Nz
curve.gpkgrG   r#   r0   r'   
curve_filert      s    |##r0   c                      [         S-  $ )Nzcurvepolygon.gpkgrG   r#   r0   r'   curve_polygon_filerv          ***r0   c                      [         S-  $ )Nzmultisurface.gpkgrG   r#   r0   r'   multisurface_filery      rw   r0   c                      [         S-  $ )Nztest_gpkg_nulls.gpkgrG   r#   r0   r'   test_gpkg_nullsr{      s    ---r0   c           	      Z    U S-  n[        USS [        R                  " / SQ5      /S/S9  U$ )Nztest_no_geometry.gpkgno_geometry)abccol)ro   r@   rA   fields)r   nparray)rO   rk   s     r'   no_geometry_filer      s;     11H	HH_-.w Or0   c                     SnU S-  n[        US5       nUR                  U5      nS S S 5        U$ ! , (       d  f       U$ = f)NaB  {
        "type": "FeatureCollection",
        "features": [
            {
                "type": "Feature",
                "properties": { "int64": 1, "list_int64": [0, 1] },
                "geometry": { "type": "Point", "coordinates": [0, 2] }
            },
            {
                "type": "Feature",
                "properties": { "int64": 2, "list_int64": [2, 3] },
                "geometry": { "type": "Point", "coordinates": [1, 2] }
            },
            {
                "type": "Feature",
                "properties": { "int64": 3, "list_int64": [4, 5] },
                "geometry": { "type": "Point", "coordinates": [2, 2] }
            },
            {
                "type": "Feature",
                "properties": { "int64": 4, "list_int64": [6, 7] },
                "geometry": { "type": "Point", "coordinates": [3, 2] }
            },
            {
                "type": "Feature",
                "properties": { "int64": 5, "list_int64": [8, 9] },
                "geometry": { "type": "Point", "coordinates": [4, 2] }
            }
        ]
    }ztest_ogr_types_list.geojsonr[   openr   )rO   list_geojsonrk   fr?   s        r'   list_field_values_filer      sL    	L> 77H	h	GGL! 
 O 
	 O   0
?c                     SnU S-  n[        US5       nUR                  U5      nS S S 5        U$ ! , (       d  f       U$ = f)Na  {
        "type": "FeatureCollection",
        "features": [
            {
                "type": "Feature",
                "geometry": {
                    "type": "Point",
                    "coordinates": [0, 0]
                },
                "properties": {
                    "top_level": "A",
                    "intermediate_level": {
                        "bottom_level": "B"
                    }
                }
            }
        ]
    }ztest_nested.geojsonr[   r   )rO   nested_geojsonrk   r   r?   s        r'   nested_geojson_filer      sL    	N& //H	h	GGN# 
 O 
	 Or   c                     SnU S-  n[        US5       nUR                  U5      nS S S 5        U$ ! , (       d  f       U$ = f)Na  {
        "type": "FeatureCollection",
        "features": [
            {
                "type": "Feature",
                "properties": { "col": "2020-01-01T09:00:00.123" },
                "geometry": { "type": "Point", "coordinates": [1, 1] }
            },
            {
                "type": "Feature",
                "properties": { "col": "2020-01-01T10:00:00" },
                "geometry": { "type": "Point", "coordinates": [2, 2] }
            }
        ]
    }ztest_datetime.geojsonr[   r   )rO   datetime_geojsonrk   r   r?   s        r'   datetime_filer     sN    	  11H	h	GG$% 
 O 
	 Or   c                     SnU S-  n[        US5       nUR                  U5        S S S 5        U$ ! , (       d  f       U$ = f)Na  {
        "type": "FeatureCollection",
        "features": [
            {
                "type": "Feature",
                "properties": { "datetime_col": "2020-01-01T09:00:00.123-05:00" },
                "geometry": { "type": "Point", "coordinates": [1, 1] }
            },
            {
                "type": "Feature",
                "properties": { "datetime_col": "2020-01-01T10:00:00-05:00" },
                "geometry": { "type": "Point", "coordinates": [2, 2] }
            }
        ]
    }ztest_datetime_tz.geojsonr[   r   )rO   datetime_tz_geojsonrk   r   s       r'   datetime_tz_filer   ,  sL    	  44H	h		#$ 
 O 
	 Or   c                     [        [        [        S5      -  SS9u  pp4U S-  n[        XSU40 UD6  [	        US5       nUR                  5       nSSS5        U$ ! , (       d  f       W$ = f)zXExtracts first 3 records from naturalearth_lowres and writes to GeoJSON,
returning bytesrM      max_featurestest.geojsonrbNr   rH   r   r   r   )rO   r>   r?   r@   rA   rk   r   bytes_buffers           r'   geojson_bytesr   F  st     %)DFGGVW%!DX .(H	(j1D1	h	vvx 
  
	 s   A
A&c              #      #    [        [        [        S5      -  SS9u  pp4U S-  n[        XSU4SS0UD6  [	        US5       nUv   SSS5        g! , (       d  f       g= f7f)	zcExtracts first 3 records from naturalearth_lowres and writes to GeoJSON,
returning open file handlerM   r   r   r   ro   testr   Nr   )rO   r>   r?   r@   rA   rk   r   s          r'   geojson_fileliker   W  sc      %)DFGGVW%!DX .(H	(j??$?	h	 
		s   >A A	A
AAc                 R     " S S[         5      nSnU" UR                  S5      5      $ )Nc                        \ rS rSrS rS rSrg)-nonseekable_bytes.<locals>.NonSeekableBytesIOii  c                     g)NFr#   )selfs    r'   seekable6nonseekable_bytes.<locals>.NonSeekableBytesIO.seekablej  s    r0   c                     [        S5      e)Nzcannot seek)OSError)r   argskwargss      r'   seek2nonseekable_bytes.<locals>.NonSeekableBytesIO.seekm  s    -((r0   r#   N)__name__
__module____qualname____firstlineno__r   r   __static_attributes__r#   r0   r'   NonSeekableBytesIOr   i  s    		)r0   r   z{
        "type": "FeatureCollection",
        "features": [
            {
                "type": "Feature",
                "properties": { },
                "geometry": { "type": "Point", "coordinates": [1, 1] }
            }
        ]
    }zUTF-8)r   encode)rO   r   geojsons      r'   nonseekable_bytesr   f  s+    )W )		G gnnW566r0   ))CP932u   ﾎ)CP936u   中文)CP1250u   Đ)CP1252   ÿ)CP1253u   Φ)CP1256u   شc                     U R                   $ )a  Return tuple with encoding name and very short sample text in that encoding
NOTE: it was determined through testing that code pages for MS-DOS do not
consistently work across all Python installations (in particular, fail with conda),
but ANSI code pages appear to work properly.
)rL   )rP   s    r'   encoded_textr     s    . ==r0   )Bior   pathlibr   zipfiler   r   numpyr   pyogrior   r   r	   pyogrio._compatr
   r   r   r   r   r   pyogrio.corer   pyogrio.rawr   r   pytest__file__rh   resolverH   DRIVERSr,   
DRIVER_EXTALL_EXTS	START_FIDr/   markskipifrequires_arrow_apirequires_pyarrow_apirequires_pyprojrequires_arrow_write_apirequires_gdal_geosrequires_shapelyrB   fixturerI   rQ   rV   rY   rl   rp   rr   rt   rv   ry   r{   r   r   r   r   r   r   r   r   r   )r<   r%   s   00r'   <module>r      s     )  
  $ # N!!))+j8	  
 .5]]_=_kcfk_=
= 		 [[''M(9BV'W {{))([1Q *   ++$$^<M$N!;;--.;3 .  
 [[''@ (   ;;%%+o>W%X 2 i  ! j!: ": j2J 3J j*6J 7J j!	> "	> j!  "  i & !& i $ !$ i + !+ i + !+ i . !. j! " j!% "%P j! "8 j! "2 j! "2 j! "  j! " j!7 "70 
"#"O >s   M