�
lMg�t � �� � d dl Z d dlZd dlZd dlZd dlZd dlmZ d dlmZ d dlZd dl Z d dl
mZmZm
Z
mZ d dlmZ d dlmZ d dlmZ d dlmZmZmZmZmZ d d
lmZ ej: d� Z ej: d� Z ej@ d
� Z!d� Z" G d� de� Z# G d� de� Z$dd�Z% ej: d� Z&d� Z' G d� de� Z( G d� de� Z)dd�Z*dd�Z+dd�Z, ee,� Z-y)� N)�copy)�urlparse)�AbstractAsyncStreamedFile�AsyncFileSystem�sync�sync_wrapper)�DEFAULT_CALLBACK)�FSTimeoutError)�AbstractBufferedFile)�DEFAULT_BLOCK_SIZE�glob_translate�
isfilelike�nullcontext�tokenize� )�AllBytesz6<(a|A)\s+(?:[^>]*?\s+)?(href|HREF)=["'](?P<url>[^"']+)z-(?P<url>http[s]?://[-a-zA-Z0-9@:%_+.~#?&/=]+)zfsspec.httpc � �4 K � t j di | ��S �w)N� )�aiohttp�
ClientSession)�kwargss �gC:\Users\noahv\Documents\GitHub\clickup-operator\.venv\Lib\site-packages\fsspec/implementations/http.py�
get_clientr s � �� �� � �*�6�*�*�s �c � � � e Zd ZdZdZdddddddddedf� fd� Zed� � Zd � Z e
d
� � Zd� Ze
d� � Ze
� fd
�� Zdd�Zdd�Z ee� Zd� Zdd�Zdefd�Zdedfd�Zd� Zd� Z d d�Zd!d�Zd� Zd� Zd"d�Zd� Z � xZ!S )#�HTTPFileSystema2
Simple File-System for fetching data via HTTP(S)
``ls()`` is implemented by loading the parent page and doing a regex
match on the result. If simple_link=True, anything of the form
"http(s)://server.com/stuff?thing=other"; otherwise only links within
HTML href tags will be used.
�/TN�bytesFc � �� t �| � | f||d�|�� |�|nt | _ || _ || _ || _ || _ | xs i | _ |
| _ || _
|| _ d| _ t |� }
|
j dd� | _ |
j dd� |
j dd� |
j dd� |
| _ y)a�
NB: if this is called async, you must await set_client
Parameters
----------
block_size: int
Blocks to read bytes; if 0, will default to raw requests file-like
objects instead of HTTPFile instances
simple_links: bool
If True, will consider both HTML <a> tags and anything that looks
like a URL; if False, will consider only the former.
same_scheme: True
When doing ls/glob, if this is True, only consider paths that have
http/https matching the input URLs.
size_policy: this argument is deprecated
client_kwargs: dict
Passed to aiohttp.ClientSession, see
https://docs.aiohttp.org/en/stable/client_reference.html
For example, ``{'auth': aiohttp.BasicAuth('user', 'pass')}``
get_client: Callable[..., aiohttp.ClientSession]
A callable which takes keyword arguments and constructs
an aiohttp.ClientSession. It's state will be managed by
the HTTPFileSystem class.
storage_options: key-value
Any other parameters passed on to requests
cache_type, cache_options: defaults used in open
)�asynchronous�loopN�use_listings_cacheF�listings_expiry_time� max_paths�skip_instance_cache)�super�__init__r �
block_size�simple_links�same_schema�
cache_type�
cache_options�
client_kwargsr �encodedr �_sessionr �popr! )�selfr( r'