



import inspect
import tempfile
from collections import OrderedDict, UserDict
from collections.abc import MutableMapping
from contextlib import ExitStack, contextmanager
from dataclasses import fields
from enum import Enum
from typing import Any, ContextManager, List, Tuple

import numpy as np

from .import_utils import is_flax_available, is_tf_available, is_torch_available, is_torch_fx_proxy


if is_flax_available():
 import jax.numpy as jnp

class     _A       (	__UpperCAmelCase    ):



       def __get__(		self							:     Optional[Any]     ,		__SCREAMING_SNAKE_CASE							:     Union[str, Any]     ,		__SCREAMING_SNAKE_CASE							:     Dict=None):


           '''simple docstring'''

           if obj is None:
               return self
           if self.fget is None:
               raise AttributeError('''unreadable attribute''')
           __a						       =				'''__cached_''' + self.fget.__name__
           __a						       =				getattr(__SCREAMING_SNAKE_CASE     ,		__SCREAMING_SNAKE_CASE     ,		__SCREAMING_SNAKE_CASE)
           if cached is None:
               __a						       =				self.fget(__SCREAMING_SNAKE_CASE)
               setattr(__SCREAMING_SNAKE_CASE     ,		__SCREAMING_SNAKE_CASE     ,		__SCREAMING_SNAKE_CASE)
           return cached





def      __snake_case	(			_UpperCAmelCase				):
    __a						       =				val.lower()
    if val in {"y", "yes", "t", "true", "on", "1"}:
        return 1
    if val in {"n", "no", "f", "false", "off", "0"}:
        return 0
    raise ValueError(f'invalid truth value {val!r}'				)





def      __snake_case	(			_UpperCAmelCase				):
    if is_torch_fx_proxy(_UpperCAmelCase				):
        return True
    if is_torch_available():
        import torch

        if isinstance(_UpperCAmelCase   , torch.Tensor				):
            return True
    if is_tf_available():
        import tensorflow as tf

        if isinstance(_UpperCAmelCase   , tf.Tensor				):
            return True

    if is_flax_available():
        import jax.numpy as jnp
        from jax.core import Tracer

        if isinstance(_UpperCAmelCase   , (jnp.ndarray, Tracer)				):
            return True

    return isinstance(_UpperCAmelCase   , np.ndarray				)





def      __snake_case	(			_UpperCAmelCase				):
    return isinstance(_UpperCAmelCase   , np.ndarray				)





def      __snake_case	(			_UpperCAmelCase				):
    return _is_numpy(_UpperCAmelCase				)





def      __snake_case	(			_UpperCAmelCase				):
    import torch

    return isinstance(_UpperCAmelCase   , torch.Tensor				)





def      __snake_case	(			_UpperCAmelCase				):
    return False if not is_torch_available() else _is_torch(_UpperCAmelCase				)





def      __snake_case	(			_UpperCAmelCase				):
    import torch

    return isinstance(_UpperCAmelCase   , torch.device				)





def      __snake_case	(			_UpperCAmelCase				):
    return False if not is_torch_available() else _is_torch_device(_UpperCAmelCase				)





def      __snake_case	(			_UpperCAmelCase				):
    import torch

    if isinstance(_UpperCAmelCase   , _UpperCAmelCase				):
        if hasattr(_UpperCAmelCase   , _UpperCAmelCase				):
            __a						       =				getattr(_UpperCAmelCase   , _UpperCAmelCase				)
        else:
            return False
    return isinstance(_UpperCAmelCase   , torch.dtype				)





def      __snake_case	(			_UpperCAmelCase				):
    return False if not is_torch_available() else _is_torch_dtype(_UpperCAmelCase				)





def      __snake_case	(			_UpperCAmelCase				):
    import tensorflow as tf

    return isinstance(_UpperCAmelCase   , tf.Tensor				)





def      __snake_case	(			_UpperCAmelCase				):
    return False if not is_tf_available() else _is_tensorflow(_UpperCAmelCase				)





def      __snake_case	(			_UpperCAmelCase				):
    import tensorflow as tf

    # the `is_symbolic_tensor` predicate is only available starting with TF 2.14
    if hasattr(_UpperCAmelCase   , '''is_symbolic_tensor'''				):
        return tf.is_symbolic_tensor(_UpperCAmelCase				)
    return type(_UpperCAmelCase				) == tf.Tensor





def      __snake_case	(			_UpperCAmelCase				):
    return False if not is_tf_available() else _is_tf_symbolic_tensor(_UpperCAmelCase				)





def      __snake_case	(			_UpperCAmelCase				):
    import jax.numpy as jnp  # noqa: F811

    return isinstance(_UpperCAmelCase   , jnp.ndarray				)





def      __snake_case	(			_UpperCAmelCase				):
    return False if not is_flax_available() else _is_jax(_UpperCAmelCase				)





def      __snake_case	(			_UpperCAmelCase				):
    if isinstance(_UpperCAmelCase   , (dict, UserDict)				):
        return {k: to_py_obj(_UpperCAmelCase				) for k, v in obj.items()}
    elif isinstance(_UpperCAmelCase   , (list, tuple)				):
        return [to_py_obj(_UpperCAmelCase				) for o in obj]
    elif is_tf_tensor(_UpperCAmelCase				):
        return obj.numpy().tolist()
    elif is_torch_tensor(_UpperCAmelCase				):
        return obj.detach().cpu().tolist()
    elif is_jax_tensor(_UpperCAmelCase				):
        return np.asarray(_UpperCAmelCase				).tolist()
    elif isinstance(_UpperCAmelCase   , (np.ndarray, np.number)				):  # tolist also works on 0d np arrays
        return obj.tolist()
    else:
        return obj





def      __snake_case	(			_UpperCAmelCase				):
    if isinstance(_UpperCAmelCase   , (dict, UserDict)				):
        return {k: to_numpy(_UpperCAmelCase				) for k, v in obj.items()}
    elif isinstance(_UpperCAmelCase   , (list, tuple)				):
        return np.array(_UpperCAmelCase				)
    elif is_tf_tensor(_UpperCAmelCase				):
        return obj.numpy()
    elif is_torch_tensor(_UpperCAmelCase				):
        return obj.detach().cpu().numpy()
    elif is_jax_tensor(_UpperCAmelCase				):
        return np.asarray(_UpperCAmelCase				)
    else:
        return obj

class     _A       (	__UpperCAmelCase    ):



       def 		_lowerCamelCase			(		self							:     List[Any]):


           '''simple docstring'''

           __a						       =				fields(self)

           # Safety and consistency checks
           if not len(__SCREAMING_SNAKE_CASE):
               raise ValueError(F'{self.__class__.__name__} has no fields.')
           if not all(field.default is None for field in class_fields[1:]):
               raise ValueError(F'{self.__class__.__name__} should not have more than one required field.')

           __a						       =				getattr(self     ,		class_fields[0].name)
           __a						       =				all(getattr(self     ,		field.name) is None for field in class_fields[1:])

           if other_fields_are_none and not is_tensor(__SCREAMING_SNAKE_CASE):
               if isinstance(__SCREAMING_SNAKE_CASE     ,		__SCREAMING_SNAKE_CASE):
                   __a						       =				first_field.items()
                   __a						       =				True
               else:
                   try:
                       __a						       =				iter(__SCREAMING_SNAKE_CASE)
                       __a						       =				True
                   except TypeError:
                       __a						       =				False

            # if we provided an iterator as first field and the iterator is a (key, value) iterator
            # set the associated fields
               if first_field_iterator:
                   for idx, element in enumerate(__SCREAMING_SNAKE_CASE):
                       if (
                           not isinstance(__SCREAMING_SNAKE_CASE     ,		(list, tuple))
                           or not len(__SCREAMING_SNAKE_CASE) == 2
                           or not isinstance(element[0]     ,		__SCREAMING_SNAKE_CASE)
                       ):
                           if idx == 0:
                               # If we do not have an iterator of key/values, set it as attribute
                               __a						       =				first_field
                           else:
                               # If we have a mixed iterator, raise an error
                               raise ValueError(
                                   F'Cannot set key/value for {element}. It needs to be a tuple (key, value).')
                           break
                       setattr(self     ,		element[0]     ,		element[1])
                       if element[1] is not None:
                           __a						       =				element[1]
               elif first_field is not None:
                   __a						       =				first_field
           else:
               for field in class_fields:
                   __a						       =				getattr(self     ,		field.name)
                   if v is not None:
                       __a						       =				v



       def __delitem__(		self							:     str     ,		*__SCREAMING_SNAKE_CASE							:     Any     ,		**__SCREAMING_SNAKE_CASE							:     str):


           '''simple docstring'''

           raise Exception(F'You cannot use ``__delitem__`` on a {self.__class__.__name__} instance.')



       def 		_lowerCamelCase			(		self							:     Tuple     ,		*__SCREAMING_SNAKE_CASE							:     Optional[Any]     ,		**__SCREAMING_SNAKE_CASE							:     Tuple):


           '''simple docstring'''

           raise Exception(F'You cannot use ``setdefault`` on a {self.__class__.__name__} instance.')



       def 		_lowerCamelCase			(		self							:     Dict     ,		*__SCREAMING_SNAKE_CASE							:     int     ,		**__SCREAMING_SNAKE_CASE							:     int):


           '''simple docstring'''

           raise Exception(F'You cannot use ``pop`` on a {self.__class__.__name__} instance.')



       def 		_lowerCamelCase			(		self							:     str     ,		*__SCREAMING_SNAKE_CASE							:     Optional[int]     ,		**__SCREAMING_SNAKE_CASE							:     Union[str, Any]):


           '''simple docstring'''

           raise Exception(F'You cannot use ``update`` on a {self.__class__.__name__} instance.')



       def __getitem__(		self							:     Tuple     ,		__SCREAMING_SNAKE_CASE							:     Dict):


           '''simple docstring'''

           if isinstance(__SCREAMING_SNAKE_CASE     ,		__SCREAMING_SNAKE_CASE):
               __a						       =				dict(self.items())
               return inner_dict[k]
           else:
               return self.to_tuple()[k]



       def __setattr__(		self							:     Any     ,		__SCREAMING_SNAKE_CASE							:     str     ,		__SCREAMING_SNAKE_CASE							:     int):


           '''simple docstring'''

           if name in self.keys() and value is not None:
               # Don't call self.__setitem__ to avoid recursion errors
               super().__setitem__(__SCREAMING_SNAKE_CASE     ,		__SCREAMING_SNAKE_CASE)
           super().__setattr__(__SCREAMING_SNAKE_CASE     ,		__SCREAMING_SNAKE_CASE)



       def __setitem__(		self							:     Tuple     ,		__SCREAMING_SNAKE_CASE							:     Optional[Any]     ,		__SCREAMING_SNAKE_CASE							:     Optional[Any]):


           '''simple docstring'''

           super().__setitem__(__SCREAMING_SNAKE_CASE     ,		__SCREAMING_SNAKE_CASE)
           # Don't call self.__setattr__ to avoid recursion errors
           super().__setattr__(__SCREAMING_SNAKE_CASE     ,		__SCREAMING_SNAKE_CASE)





       def 		_lowerCamelCase			(		self							:     Tuple):


           '''simple docstring'''

           return tuple(self[k] for k in self.keys())


class     _A       (	__UpperCAmelCase      ,__UpperCAmelCase    ):



       @classmethod
       def 		_lowerCamelCase			(		cls							:     int     ,		__SCREAMING_SNAKE_CASE							:     int):


           '''simple docstring'''

           raise ValueError(
               F'{value} is not a valid {cls.__name__}, please select one of {list(cls._valueamember_map_.keys())}')


class     _A       (	__UpperCAmelCase    ):
       UpperCamelCase__  :    List[Any]											=						'''longest'''
       UpperCamelCase__  :    Dict											=						'''max_length'''
       UpperCamelCase__  :    int											=						'''do_not_pad'''


class     _A       (	__UpperCAmelCase    ):
       UpperCamelCase__  :    Optional[int]											=						'''pt'''
       UpperCamelCase__  :    Tuple											=						'''tf'''
       UpperCamelCase__  :    int											=						'''np'''
       UpperCamelCase__  :    Union[str, Any]											=						'''jax'''


class     _A       :



       def __init__(		self							:     Optional[Any]     ,		__SCREAMING_SNAKE_CASE							:     List[ContextManager]):


           '''simple docstring'''

           __a						       =				context_managers
           __a						       =				ExitStack()



       def __enter__(		self							:     Union[str, Any]):


           '''simple docstring'''

           for context_manager in self.context_managers:
               self.stack.enter_context(__SCREAMING_SNAKE_CASE)





       def __exit__(		self							:     Dict     ,		*__SCREAMING_SNAKE_CASE							:     str     ,		**__SCREAMING_SNAKE_CASE							:     List[str]):


           '''simple docstring'''

           self.stack.__exit__(*__SCREAMING_SNAKE_CASE     ,		**__SCREAMING_SNAKE_CASE)





def      __snake_case	(			_UpperCAmelCase				):
    __a						       =				infer_framework(_UpperCAmelCase				)
    if framework == "tf":
        __a						       =				inspect.signature(model_class.call				)  # TensorFlow models
    elif framework == "pt":
        __a						       =				inspect.signature(model_class.forward				)  # PyTorch models
    else:
        __a						       =				inspect.signature(model_class.__call__				)  # Flax models

    for p in signature.parameters:
        if p == "return_loss" and signature.parameters[p].default is True:
            return True

    return False





def      __snake_case	(			_UpperCAmelCase				):
    __a						       =				model_class.__name__
    __a						       =				infer_framework(_UpperCAmelCase				)
    if framework == "tf":
        __a						       =				inspect.signature(model_class.call				)  # TensorFlow models
    elif framework == "pt":
        __a						       =				inspect.signature(model_class.forward				)  # PyTorch models
    else:
        __a						       =				inspect.signature(model_class.__call__				)  # Flax models

    if "QuestionAnswering" in model_name:
        return [p for p in signature.parameters if "label" in p or p in ("start_positions", "end_positions")]
    else:
        return [p for p in signature.parameters if "label" in p]





def      __snake_case	(			_UpperCAmelCase   , _UpperCAmelCase = ""   , _UpperCAmelCase = "."				):

    def _flatten_dict(_UpperCAmelCase   , _UpperCAmelCase=""   , _UpperCAmelCase="."				):
        for k, v in d.items():
            __a						       =				str(_UpperCAmelCase				) + delimiter + str(_UpperCAmelCase				) if parent_key else k
            if v and isinstance(_UpperCAmelCase   , _UpperCAmelCase				):
                yield from flatten_dict(_UpperCAmelCase   , _UpperCAmelCase   , delimiter=_UpperCAmelCase				).items()
            else:
                yield key, v

    return dict(_flatten_dict(_UpperCAmelCase   , _UpperCAmelCase   , _UpperCAmelCase				)				)





@contextmanager
def      __snake_case	(			_UpperCAmelCase   , _UpperCAmelCase = False				):
    if use_temp_dir:
        with tempfile.TemporaryDirectory() as tmp_dir:
            yield tmp_dir
    else:
        yield working_dir





def      __snake_case	(			_UpperCAmelCase   , _UpperCAmelCase=None				):
    if is_numpy_array(_UpperCAmelCase				):
        return np.transpose(_UpperCAmelCase   , axes=_UpperCAmelCase				)
    elif is_torch_tensor(_UpperCAmelCase				):
        return array.T if axes is None else array.permute(*_UpperCAmelCase				)
    elif is_tf_tensor(_UpperCAmelCase				):
        import tensorflow as tf

        return tf.transpose(_UpperCAmelCase   , perm=_UpperCAmelCase				)
    elif is_jax_tensor(_UpperCAmelCase				):
        return jnp.transpose(_UpperCAmelCase   , axes=_UpperCAmelCase				)
    else:
        raise ValueError(f'Type not supported for transpose: {type(_UpperCAmelCase				)}.'				)





def      __snake_case	(			_UpperCAmelCase   , _UpperCAmelCase				):
    if is_numpy_array(_UpperCAmelCase				):
        return np.reshape(_UpperCAmelCase   , _UpperCAmelCase				)
    elif is_torch_tensor(_UpperCAmelCase				):
        return array.reshape(*_UpperCAmelCase				)
    elif is_tf_tensor(_UpperCAmelCase				):
        import tensorflow as tf

        return tf.reshape(_UpperCAmelCase   , _UpperCAmelCase				)
    elif is_jax_tensor(_UpperCAmelCase				):
        return jnp.reshape(_UpperCAmelCase   , _UpperCAmelCase				)
    else:
        raise ValueError(f'Type not supported for reshape: {type(_UpperCAmelCase				)}.'				)





def      __snake_case	(			_UpperCAmelCase   , _UpperCAmelCase=None				):
    if is_numpy_array(_UpperCAmelCase				):
        return np.squeeze(_UpperCAmelCase   , axis=_UpperCAmelCase				)
    elif is_torch_tensor(_UpperCAmelCase				):
        return array.squeeze() if axis is None else array.squeeze(dim=_UpperCAmelCase				)
    elif is_tf_tensor(_UpperCAmelCase				):
        import tensorflow as tf

        return tf.squeeze(_UpperCAmelCase   , axis=_UpperCAmelCase				)
    elif is_jax_tensor(_UpperCAmelCase				):
        return jnp.squeeze(_UpperCAmelCase   , axis=_UpperCAmelCase				)
    else:
        raise ValueError(f'Type not supported for squeeze: {type(_UpperCAmelCase				)}.'				)





def      __snake_case	(			_UpperCAmelCase   , _UpperCAmelCase				):
    if is_numpy_array(_UpperCAmelCase				):
        return np.expand_dims(_UpperCAmelCase   , _UpperCAmelCase				)
    elif is_torch_tensor(_UpperCAmelCase				):
        return array.unsqueeze(dim=_UpperCAmelCase				)
    elif is_tf_tensor(_UpperCAmelCase				):
        import tensorflow as tf

        return tf.expand_dims(_UpperCAmelCase   , axis=_UpperCAmelCase				)
    elif is_jax_tensor(_UpperCAmelCase				):
        return jnp.expand_dims(_UpperCAmelCase   , axis=_UpperCAmelCase				)
    else:
        raise ValueError(f'Type not supported for expand_dims: {type(_UpperCAmelCase				)}.'				)





def      __snake_case	(			_UpperCAmelCase				):
    if is_numpy_array(_UpperCAmelCase				):
        return np.size(_UpperCAmelCase				)
    elif is_torch_tensor(_UpperCAmelCase				):
        return array.numel()
    elif is_tf_tensor(_UpperCAmelCase				):
        import tensorflow as tf

        return tf.size(_UpperCAmelCase				)
    elif is_jax_tensor(_UpperCAmelCase				):
        return array.size
    else:
        raise ValueError(f'Type not supported for expand_dims: {type(_UpperCAmelCase				)}.'				)





def      __snake_case	(			_UpperCAmelCase   , _UpperCAmelCase				):
    for key, value in auto_map.items():
        if isinstance(_UpperCAmelCase   , (tuple, list)				):
            __a						       =				[f'{repo_id}--{v}' if (v is not None and '''--''' not in v) else v for v in value]
        elif value is not None and "--" not in value:
            __a						       =				f'{repo_id}--{value}'

    return auto_map





def      __snake_case	(			_UpperCAmelCase				):
    for base_class in inspect.getmro(_UpperCAmelCase				):
        __a						       =				base_class.__module__
        __a						       =				base_class.__name__
        if module.startswith('''tensorflow'''				) or module.startswith('''keras'''				) or name == "TFPreTrainedModel":
            return "tf"
        elif module.startswith('''torch'''				) or name == "PreTrainedModel":
            return "pt"
        elif module.startswith('''flax'''				) or module.startswith('''jax'''				) or name == "FlaxPreTrainedModel":
            return "flax"
    else:
        raise TypeError(f'Could not infer framework from class {model_class}.'				)










import os
from pathlib import Path
from unittest.mock import patch

import pytest
import zstandard as zstd

from datasets.download.download_config import DownloadConfig
from datasets.utils.file_utils import (
    OfflineModeIsEnabled,
    cached_path,
    fsspec_get,
    fsspec_head,
    ftp_get,
    ftp_head,
    get_from_cache,
    http_get,
    http_head,
)


__snake_case						:List[str]      		=     '''\
    Text data.
    Second line of data.'''

__snake_case						:Optional[Any]      		=     '''file'''





@pytest.fixture(scope='''session'''				)
def      __snake_case	(			_UpperCAmelCase				):
    __a						       =				tmp_path_factory.mktemp('''data'''				) / (FILE_PATH + '''.zstd''')
    __a						       =				bytes(_UpperCAmelCase   , '''utf-8'''				)
    with zstd.open(_UpperCAmelCase   , '''wb'''				) as f:
        f.write(_UpperCAmelCase				)
    return path





@pytest.fixture
def      __snake_case	(			_UpperCAmelCase				):
    with open(os.path.join(tmpfs.local_root_dir   , _UpperCAmelCase				)   , '''w'''				) as f:
        f.write(_UpperCAmelCase				)
    return FILE_PATH





@pytest.mark.parametrize('''compression_format'''   , ['''gzip''', '''xz''', '''zstd''']				)
def      __snake_case	(			_UpperCAmelCase   , _UpperCAmelCase   , _UpperCAmelCase   , _UpperCAmelCase   , _UpperCAmelCase   , _UpperCAmelCase				):
    __a						       =				{'''gzip''': gz_file, '''xz''': xz_file, '''zstd''': zstd_path}
    __a						       =				input_paths[compression_format]
    __a						       =				tmp_path / '''cache'''
    __a						       =				DownloadConfig(cache_dir=_UpperCAmelCase   , extract_compressed_file=_UpperCAmelCase				)
    __a						       =				cached_path(_UpperCAmelCase   , download_config=_UpperCAmelCase				)
    with open(_UpperCAmelCase				) as f:
        __a						       =				f.read()
    with open(_UpperCAmelCase				) as f:
        __a						       =				f.read()
    assert extracted_file_content == expected_file_content





@pytest.mark.parametrize('''default_extracted'''   , [True, False]				)
@pytest.mark.parametrize('''default_cache_dir'''   , [True, False]				)
def      __snake_case	(			_UpperCAmelCase   , _UpperCAmelCase   , _UpperCAmelCase   , _UpperCAmelCase   , _UpperCAmelCase				):
    __a						       =				'''custom_cache'''
    __a						       =				'''custom_extracted_dir'''
    __a						       =				tmp_path / '''custom_extracted_path'''
    if default_extracted:
        __a						       =				('''downloads''' if default_cache_dir else custom_cache_dir, '''extracted''')
    else:
        monkeypatch.setattr('''datasets.config.EXTRACTED_DATASETS_DIR'''   , _UpperCAmelCase				)
        monkeypatch.setattr('''datasets.config.EXTRACTED_DATASETS_PATH'''   , str(_UpperCAmelCase				)				)
        __a						       =				custom_extracted_path.parts[-2:] if default_cache_dir else (custom_cache_dir, custom_extracted_dir)

    __a						       =				xz_file
    __a						       =				(
        DownloadConfig(extract_compressed_file=_UpperCAmelCase				)
        if default_cache_dir
        else DownloadConfig(cache_dir=tmp_path / custom_cache_dir   , extract_compressed_file=_UpperCAmelCase				)
    )
    __a						       =				cached_path(_UpperCAmelCase   , download_config=_UpperCAmelCase				)
    assert Path(_UpperCAmelCase				).parent.parts[-2:] == expected





def      __snake_case	(			_UpperCAmelCase				):
    # absolute path
    __a						       =				str(Path(_UpperCAmelCase				).resolve()				)
    assert cached_path(_UpperCAmelCase				) == text_file
    # relative path
    __a						       =				str(Path(_UpperCAmelCase				).resolve().relative_to(Path(os.getcwd()				)				)				)
    assert cached_path(_UpperCAmelCase				) == text_file





def      __snake_case	(			_UpperCAmelCase				):
    # absolute path
    __a						       =				str(tmp_path.resolve() / '''__missing_file__.txt'''				)
    with pytest.raises(_UpperCAmelCase				):
        cached_path(_UpperCAmelCase				)
    # relative path
    __a						       =				'''./__missing_file__.txt'''
    with pytest.raises(_UpperCAmelCase				):
        cached_path(_UpperCAmelCase				)





def      __snake_case	(			_UpperCAmelCase				):
    __a						       =				get_from_cache(f'tmp://{tmpfs_file}'				)
    with open(_UpperCAmelCase				) as f:
        __a						       =				f.read()
    assert output_file_content == FILE_CONTENT





@patch('''datasets.config.HF_DATASETS_OFFLINE'''   , _UpperCAmelCase				)
def      __snake_case	(			):
    with pytest.raises(_UpperCAmelCase				):
        cached_path('''https://huggingface.co'''				)





@patch('''datasets.config.HF_DATASETS_OFFLINE'''   , _UpperCAmelCase				)
def      __snake_case	(			_UpperCAmelCase				):
    __a						       =				tmp_path_factory.mktemp('''data'''				) / '''file.html'''
    with pytest.raises(_UpperCAmelCase				):
        http_get('''https://huggingface.co'''   , temp_file=_UpperCAmelCase				)
    with pytest.raises(_UpperCAmelCase				):
        http_head('''https://huggingface.co'''				)





@patch('''datasets.config.HF_DATASETS_OFFLINE'''   , _UpperCAmelCase				)
def      __snake_case	(			_UpperCAmelCase				):
    __a						       =				tmp_path_factory.mktemp('''data'''				) / '''file.html'''
    with pytest.raises(_UpperCAmelCase				):
        ftp_get('''ftp://huggingface.co'''   , temp_file=_UpperCAmelCase				)
    with pytest.raises(_UpperCAmelCase				):
        ftp_head('''ftp://huggingface.co'''				)





@patch('''datasets.config.HF_DATASETS_OFFLINE'''   , _UpperCAmelCase				)
def      __snake_case	(			_UpperCAmelCase				):
    __a						       =				tmp_path_factory.mktemp('''data'''				) / '''file.html'''
    with pytest.raises(_UpperCAmelCase				):
        fsspec_get('''s3://huggingface.co'''   , temp_file=_UpperCAmelCase				)
    with pytest.raises(_UpperCAmelCase				):
        fsspec_head('''s3://huggingface.co'''				)





