
    ]e                         d Z ddlZddlZddlmZmZ ddlmZ ddlZddl	Z	dZ
 ej        e          j        Zej        ZdZg dZg dZd	 Zd
  e            D             ZdefdZdefdZd Zd Zd ZdS )zUrls in docstrings etc. should be valid and secure, i.e.

- exist, i.e. provide a 200 response
- use https:// instead of http:// unless
    - https:// is not supported by the web site
    - https:// cannot be used. For example in SVGs.
    N)ThreadPoolExecutoras_completedurlopenu   (?i)\b((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'\".,<>?«»“”‘’]))
   )z.pyz.ipynbz.mdz.yaml)z$https://anaconda.org/anaconda/hvplotz'https://anaconda.org/conda-forge/hvplotz!https://anaconda.org/pyviz/hvplotz2https://creativecommons.org/publicdomain/zero/1.0/z$https://github.com/rasterio/rasteriozhttps://www.dask.orgzpyproject.toml/equivalentc               #      K   t           D ]4} t          j        d| z   d          D ]}t          j        |          V  5d S )Nz**/*T)	recursive)
POST_FIXESglobpathlibPath)post_fixfiles     7lib/python3.11/site-packages/hvplot/tests/test_links.py_get_files_to_checkr   "   s`       % %Ifx/4@@@ 	% 	%D,t$$$$$$	%% %    c                 T    g | ]%}t          j        |t          |                     &S ))id)pytestparamstr).0r   s     r   
<listcomp>r   (   s-    OOOFL#d)),,,OOOr   urlc                     | t           v rdS |                     d          rdS |                     d          rdS |                     d          rdS |                     d          rdS dS )NTz'https://github.com/holoviz/hvplot/pull/zhttps://img.shields.iozassets.holoviews.org/data/zMath.PIF)	SKIP_URLS
startswithr   s    r   	_skip_urlr   +   s~    
it
~~?@@ t
~~.// t
~~233 t
~~i   t5r   c                 D    |                      d          r
| dd         S | S )N\r   )endswithr   s    r   
_clean_urlr$   8   s)    
||D 1R4yJr   c                 N    t          j        t          |           }d |D             S )Nc                 b    h | ],}t          |d                    t          |d                    -S )r   )r   r$   )r   xs     r   	<setcomp>z_find_urls.<locals>.<setcomp>?   s3    AAA1Q4AJqtAAAr   )refindall	URL_REGEX)textr   s     r   
_find_urlsr-   =   s'    
*Y
%
%CAAcAAAAr   c                      t          |           S )Nr   r   s    r   _request_a_responser/   B   s    3<<r   c           	         i }t          t                    5 }i }| D ] }|||                    t          |          <   !t	          |          D ]l}||         }	 |                                }n&# t          $ r}t          d| d          |d}~ww xY w|j        dk    st          d| d|j         d          m	 ddd           dS # 1 swxY w Y   dS )	z"Returns True if all urls are valid)max_workerszThe url z raised an exceptionN   z responded with status z
, not 200.T)	r   MAX_WORKERSsubmitr/   r   result	Exception
ValueErrorstatus)urlsfuturesexecutorr   futurer5   exs          r   _verify_urlsr>   F   s`   G		4	4	4  	E 	ECADGHOO$7==>>"7++ 		 		F&/CO O O O !EC!E!E!EFFBNO=C'' TsTT6=TTT   (
 !                 s5   ?CA-,C-
B7BB+CCC)__doc__r   r)   concurrent.futuresr   r   urllib.requestr   r   r   r+   r   __file__parentROOTPACKAGE_ROOTr3   r
   r   r   FIXTURESr   r   r$   r-   r/   r>    r   r   <module>rH      sB     				 ? ? ? ? ? ? ? ? " " " " " "   P	w|H${...
  	% % % PO9L9L9N9NOOO3    C    
B B B
      r   