






import gc
import unittest

from transformers import MODEL_FOR_MASKED_LM_MAPPING, TF_MODEL_FOR_MASKED_LM_MAPPING, FillMaskPipeline, pipeline
from transformers.pipelines import PipelineException
from transformers.testing_utils import (
    is_pipeline_test,
    is_torch_available,
    nested_simplify,
    require_tf,
    require_torch,
    require_torch_gpu,
    slow,
)

from .test_pipelines_common import ANY




@is_pipeline_test
class  UpperCamelCase_      (			unittest.TestCase				):



	'''simple docstring'''




	lowerCAmelCase													= MODEL_FOR_MASKED_LM_MAPPING
	lowerCAmelCase													= TF_MODEL_FOR_MASKED_LM_MAPPING




	def 							_UpperCamelCase			(       self					)       ->    Union[str, Any]:
								super().tearDown()
								# clean-up as much as possible GPU memory occupied by PyTorch
								gc.collect()
								if is_torch_available():
															import torch

															torch.cuda.empty_cache()




	@require_tf
	def 							_UpperCamelCase			(       self					)       ->    Optional[int]:
								snake_case_				=							pipeline(task='fill-mask'       ,			model='sshleifer/tiny-distilroberta-base'       ,			top_k=2       ,			framework='tf'					)
								snake_case_				=							unmasker('My name is <mask>'					)
								self.assertEqual(
								    nested_simplify(a       ,			decimals=6					)       ,			[
								        {'sequence': 'My name is grouped', 'score': 2.1E-05, 'token': 3_80_15, 'token_str': ' grouped'},
								        {'sequence': 'My name is accuser', 'score': 2.1E-05, 'token': 2_55_06, 'token_str': ' accuser'},
								    ]       ,			)

								snake_case_				=							unmasker('The largest city in France is <mask>'					)
								self.assertEqual(
								    nested_simplify(a       ,			decimals=6					)       ,			[
								        {
								            'sequence': 'The largest city in France is grouped',
								            'score': 2.1E-05,
								            'token': 3_80_15,
								            'token_str': ' grouped',
								        },
								        {
								            'sequence': 'The largest city in France is accuser',
								            'score': 2.1E-05,
								            'token': 2_55_06,
								            'token_str': ' accuser',
								        },
								    ]       ,			)

								snake_case_				=							unmasker('My name is <mask>'       ,			targets=[' Patrick', ' Clara', ' Teven']       ,			top_k=3					)
								self.assertEqual(
								    nested_simplify(a       ,			decimals=6					)       ,			[
								        {'sequence': 'My name is Clara', 'score': 2E-05, 'token': 1_36_06, 'token_str': ' Clara'},
								        {'sequence': 'My name is Patrick', 'score': 2E-05, 'token': 34_99, 'token_str': ' Patrick'},
								        {'sequence': 'My name is Te', 'score': 1.9E-05, 'token': 29_41, 'token_str': ' Te'},
								    ]       ,			)




	@require_torch
	def 							_UpperCamelCase			(       self					)       ->    Optional[Any]:
								snake_case_				=							pipeline(task='fill-mask'       ,			model='sshleifer/tiny-distilroberta-base'       ,			top_k=2       ,			framework='pt'					)

								snake_case_				=							unmasker('My name is <mask>'					)
								self.assertEqual(
								    nested_simplify(a       ,			decimals=6					)       ,			[
								        {'sequence': 'My name is Maul', 'score': 2.2E-05, 'token': 3_56_76, 'token_str': ' Maul'},
								        {'sequence': 'My name isELS', 'score': 2.2E-05, 'token': 1_64_16, 'token_str': 'ELS'},
								    ]       ,			)

								snake_case_				=							unmasker('The largest city in France is <mask>'					)
								self.assertEqual(
								    nested_simplify(a       ,			decimals=6					)       ,			[
								        {
								            'sequence': 'The largest city in France is Maul',
								            'score': 2.2E-05,
								            'token': 3_56_76,
								            'token_str': ' Maul',
								        },
								        {'sequence': 'The largest city in France isELS', 'score': 2.2E-05, 'token': 1_64_16, 'token_str': 'ELS'},
								    ]       ,			)

								snake_case_				=							unmasker('My name is <mask>'       ,			targets=[' Patrick', ' Clara', ' Teven']       ,			top_k=3					)
								self.assertEqual(
								    nested_simplify(a       ,			decimals=6					)       ,			[
								        {'sequence': 'My name is Patrick', 'score': 2.1E-05, 'token': 34_99, 'token_str': ' Patrick'},
								        {'sequence': 'My name is Te', 'score': 2E-05, 'token': 29_41, 'token_str': ' Te'},
								        {'sequence': 'My name is Clara', 'score': 2E-05, 'token': 1_36_06, 'token_str': ' Clara'},
								    ]       ,			)

								snake_case_				=							unmasker('My name is <mask> <mask>'       ,			top_k=2					)

								self.assertEqual(
								    nested_simplify(a       ,			decimals=6					)       ,			[
								        [
								            {
								                'score': 2.2E-05,
								                'token': 3_56_76,
								                'token_str': ' Maul',
								                'sequence': '<s>My name is Maul<mask></s>',
								            },
								            {'score': 2.2E-05, 'token': 1_64_16, 'token_str': 'ELS', 'sequence': '<s>My name isELS<mask></s>'},
								        ],
								        [
								            {
								                'score': 2.2E-05,
								                'token': 3_56_76,
								                'token_str': ' Maul',
								                'sequence': '<s>My name is<mask> Maul</s>',
								            },
								            {'score': 2.2E-05, 'token': 1_64_16, 'token_str': 'ELS', 'sequence': '<s>My name is<mask>ELS</s>'},
								        ],
								    ]       ,			)




	@require_torch_gpu
	def 							_UpperCamelCase			(       self					)       ->    str:
								snake_case_				=							pipeline('fill-mask'       ,			model='hf-internal-testing/tiny-random-distilbert'       ,			device=0       ,			framework='pt'					)

								# convert model to fp16
								pipe.model.half()

								snake_case_				=							pipe('Paris is the [MASK] of France.'					)
								# We actually don't care about the result, we just want to make sure
								# it works, meaning the float16 tensor got casted back to float32
								# for postprocessing.
								self.assertIsInstance(a       ,			a					)




	@slow
	@require_torch
	def 							_UpperCamelCase			(       self					)       ->    Dict:
								snake_case_				=							pipeline(task='fill-mask'       ,			model='distilroberta-base'       ,			top_k=2       ,			framework='pt'					)
								self.run_large_test(a					)




	@slow
	@require_tf
	def 							_UpperCamelCase			(       self					)       ->    Optional[Any]:
								snake_case_				=							pipeline(task='fill-mask'       ,			model='distilroberta-base'       ,			top_k=2       ,			framework='tf'					)
								self.run_large_test(a					)




	def 							_UpperCamelCase			(       self       ,			a					)       ->    Dict:
								snake_case_				=							unmasker('My name is <mask>'					)
								self.assertEqual(
								    nested_simplify(a					)       ,			[
								        {'sequence': 'My name is John', 'score': 0.008, 'token': 6_10, 'token_str': ' John'},
								        {'sequence': 'My name is Chris', 'score': 0.007, 'token': 15_73, 'token_str': ' Chris'},
								    ]       ,			)
								snake_case_				=							unmasker('The largest city in France is <mask>'					)
								self.assertEqual(
								    nested_simplify(a					)       ,			[
								        {
								            'sequence': 'The largest city in France is Paris',
								            'score': 0.251,
								            'token': 22_01,
								            'token_str': ' Paris',
								        },
								        {
								            'sequence': 'The largest city in France is Lyon',
								            'score': 0.214,
								            'token': 1_27_90,
								            'token_str': ' Lyon',
								        },
								    ]       ,			)

								snake_case_				=							unmasker('My name is <mask>'       ,			targets=[' Patrick', ' Clara', ' Teven']       ,			top_k=3					)
								self.assertEqual(
								    nested_simplify(a					)       ,			[
								        {'sequence': 'My name is Patrick', 'score': 0.005, 'token': 34_99, 'token_str': ' Patrick'},
								        {'sequence': 'My name is Clara', 'score': 0.000, 'token': 1_36_06, 'token_str': ' Clara'},
								        {'sequence': 'My name is Te', 'score': 0.000, 'token': 29_41, 'token_str': ' Te'},
								    ]       ,			)




	@require_torch
	def 							_UpperCamelCase			(       self					)       ->    str:
								snake_case_				=							pipeline(task='fill-mask'       ,			model='sshleifer/tiny-distilroberta-base'       ,			framework='pt'					)
								snake_case_				=							None
								snake_case_				=							None
								self.run_pipeline_test(a       ,			[]					)




	@require_tf
	def 							_UpperCamelCase			(       self					)       ->    Dict:
								snake_case_				=							pipeline(task='fill-mask'       ,			model='sshleifer/tiny-distilroberta-base'       ,			framework='tf'					)
								snake_case_				=							None
								snake_case_				=							None
								self.run_pipeline_test(a       ,			[]					)




	def 							_UpperCamelCase			(       self       ,			a       ,			a       ,			a					)       ->    str:
								if tokenizer is None or tokenizer.mask_token_id is None:
															self.skipTest('The provided tokenizer has no mask token, (probably reformer or wav2vec2)'					)

								snake_case_				=							FillMaskPipeline(model=a       ,			tokenizer=a					)
								snake_case_				=							[
								    F'''This is another {tokenizer.mask_token} test''',
								]
								return fill_masker, examples




	def 							_UpperCamelCase			(       self       ,			a       ,			a					)       ->    Optional[int]:
								snake_case_				=							fill_masker.tokenizer
								snake_case_				=							fill_masker.model

								snake_case_				=							fill_masker(
								    F'''This is a {tokenizer.mask_token}'''       ,			)
								self.assertEqual(
								    a       ,			[
								        {'sequence': ANY(a					), 'score': ANY(a					), 'token': ANY(a					), 'token_str': ANY(a					)},
								        {'sequence': ANY(a					), 'score': ANY(a					), 'token': ANY(a					), 'token_str': ANY(a					)},
								        {'sequence': ANY(a					), 'score': ANY(a					), 'token': ANY(a					), 'token_str': ANY(a					)},
								        {'sequence': ANY(a					), 'score': ANY(a					), 'token': ANY(a					), 'token_str': ANY(a					)},
								        {'sequence': ANY(a					), 'score': ANY(a					), 'token': ANY(a					), 'token_str': ANY(a					)},
								    ]       ,			)

								snake_case_				=							fill_masker([F'''This is a {tokenizer.mask_token}''']					)
								self.assertEqual(
								    a       ,			[
								        {'sequence': ANY(a					), 'score': ANY(a					), 'token': ANY(a					), 'token_str': ANY(a					)},
								        {'sequence': ANY(a					), 'score': ANY(a					), 'token': ANY(a					), 'token_str': ANY(a					)},
								        {'sequence': ANY(a					), 'score': ANY(a					), 'token': ANY(a					), 'token_str': ANY(a					)},
								        {'sequence': ANY(a					), 'score': ANY(a					), 'token': ANY(a					), 'token_str': ANY(a					)},
								        {'sequence': ANY(a					), 'score': ANY(a					), 'token': ANY(a					), 'token_str': ANY(a					)},
								    ]       ,			)

								snake_case_				=							fill_masker([F'''This is a {tokenizer.mask_token}''', F'''Another {tokenizer.mask_token} great test.''']					)
								self.assertEqual(
								    a       ,			[
								        [
								            {'sequence': ANY(a					), 'score': ANY(a					), 'token': ANY(a					), 'token_str': ANY(a					)},
								            {'sequence': ANY(a					), 'score': ANY(a					), 'token': ANY(a					), 'token_str': ANY(a					)},
								            {'sequence': ANY(a					), 'score': ANY(a					), 'token': ANY(a					), 'token_str': ANY(a					)},
								            {'sequence': ANY(a					), 'score': ANY(a					), 'token': ANY(a					), 'token_str': ANY(a					)},
								            {'sequence': ANY(a					), 'score': ANY(a					), 'token': ANY(a					), 'token_str': ANY(a					)},
								        ],
								        [
								            {'sequence': ANY(a					), 'score': ANY(a					), 'token': ANY(a					), 'token_str': ANY(a					)},
								            {'sequence': ANY(a					), 'score': ANY(a					), 'token': ANY(a					), 'token_str': ANY(a					)},
								            {'sequence': ANY(a					), 'score': ANY(a					), 'token': ANY(a					), 'token_str': ANY(a					)},
								            {'sequence': ANY(a					), 'score': ANY(a					), 'token': ANY(a					), 'token_str': ANY(a					)},
								            {'sequence': ANY(a					), 'score': ANY(a					), 'token': ANY(a					), 'token_str': ANY(a					)},
								        ],
								    ]       ,			)

								with self.assertRaises(a					):
															fill_masker([None]					)
								# No mask_token is not supported
								with self.assertRaises(a					):
															fill_masker('This is'					)

								self.run_test_top_k(a       ,			a					)
								self.run_test_targets(a       ,			a					)
								self.run_test_top_k_targets(a       ,			a					)
								self.fill_mask_with_duplicate_targets_and_top_k(a       ,			a					)
								self.fill_mask_with_multiple_masks(a       ,			a					)




	def 							_UpperCamelCase			(       self       ,			a       ,			a					)       ->    Union[str, Any]:
								snake_case_				=							tokenizer.get_vocab()
								snake_case_				=							sorted(vocab.keys()					)[:2]
								# Pipeline argument
								snake_case_				=							FillMaskPipeline(model=a       ,			tokenizer=a       ,			targets=a					)
								snake_case_				=							fill_masker(F'''This is a {tokenizer.mask_token}'''					)
								self.assertEqual(
								    a       ,			[
								        {'sequence': ANY(a					), 'score': ANY(a					), 'token': ANY(a					), 'token_str': ANY(a					)},
								        {'sequence': ANY(a					), 'score': ANY(a					), 'token': ANY(a					), 'token_str': ANY(a					)},
								    ]       ,			)
								snake_case_				=							{vocab[el] for el in targets}
								self.assertEqual({el['token'] for el in outputs}       ,			a					)
								snake_case_				=							[tokenizer.decode([x]					) for x in target_ids]
								self.assertEqual({el['token_str'] for el in outputs}       ,			set(a					)					)

								# Call argument
								snake_case_				=							FillMaskPipeline(model=a       ,			tokenizer=a					)
								snake_case_				=							fill_masker(F'''This is a {tokenizer.mask_token}'''       ,			targets=a					)
								self.assertEqual(
								    a       ,			[
								        {'sequence': ANY(a					), 'score': ANY(a					), 'token': ANY(a					), 'token_str': ANY(a					)},
								        {'sequence': ANY(a					), 'score': ANY(a					), 'token': ANY(a					), 'token_str': ANY(a					)},
								    ]       ,			)
								snake_case_				=							{vocab[el] for el in targets}
								self.assertEqual({el['token'] for el in outputs}       ,			a					)
								snake_case_				=							[tokenizer.decode([x]					) for x in target_ids]
								self.assertEqual({el['token_str'] for el in outputs}       ,			set(a					)					)

								# Score equivalence
								snake_case_				=							fill_masker(F'''This is a {tokenizer.mask_token}'''       ,			targets=a					)
								snake_case_				=							[top_mask['token_str'] for top_mask in outputs]
								snake_case_				=							[top_mask['score'] for top_mask in outputs]

								# For some BPE tokenizers, `</w>` is removed during decoding, so `token_str` won't be the same as in `targets`.
								if set(a					) == set(a					):
															snake_case_				=							fill_masker(F'''This is a {tokenizer.mask_token}'''       ,			targets=a					)
															snake_case_				=							[top_mask['score'] for top_mask in unmasked_targets]
															self.assertEqual(nested_simplify(a					)       ,			nested_simplify(a					)					)

								# Raises with invalid
								with self.assertRaises(a					):
															snake_case_				=							fill_masker(F'''This is a {tokenizer.mask_token}'''       ,			targets=[]					)
								# For some tokenizers, `""` is actually in the vocabulary and the expected error won't raised
								if "" not in tokenizer.get_vocab():
															with self.assertRaises(a					):
																						snake_case_				=							fill_masker(F'''This is a {tokenizer.mask_token}'''       ,			targets=['']					)
															with self.assertRaises(a					):
																						snake_case_				=							fill_masker(F'''This is a {tokenizer.mask_token}'''       ,			targets=''					)




	def 							_UpperCamelCase			(       self       ,			a       ,			a					)       ->    Optional[Any]:
								snake_case_				=							FillMaskPipeline(model=a       ,			tokenizer=a       ,			top_k=2					)
								snake_case_				=							fill_masker(F'''This is a {tokenizer.mask_token}'''					)
								self.assertEqual(
								    a       ,			[
								        {'sequence': ANY(a					), 'score': ANY(a					), 'token': ANY(a					), 'token_str': ANY(a					)},
								        {'sequence': ANY(a					), 'score': ANY(a					), 'token': ANY(a					), 'token_str': ANY(a					)},
								    ]       ,			)

								snake_case_				=							FillMaskPipeline(model=a       ,			tokenizer=a					)
								snake_case_				=							fill_masker(F'''This is a {tokenizer.mask_token}'''       ,			top_k=2					)
								self.assertEqual(
								    a       ,			[
								        {'sequence': ANY(a					), 'score': ANY(a					), 'token': ANY(a					), 'token_str': ANY(a					)},
								        {'sequence': ANY(a					), 'score': ANY(a					), 'token': ANY(a					), 'token_str': ANY(a					)},
								    ]       ,			)
								self.assertEqual(nested_simplify(a					)       ,			nested_simplify(a					)					)




	def 							_UpperCamelCase			(       self       ,			a       ,			a					)       ->    List[str]:
								snake_case_				=							tokenizer.get_vocab()
								snake_case_				=							FillMaskPipeline(model=a       ,			tokenizer=a					)

								# top_k=2, ntargets=3
								snake_case_				=							sorted(vocab.keys()					)[:3]
								snake_case_				=							fill_masker(F'''This is a {tokenizer.mask_token}'''       ,			top_k=2       ,			targets=a					)

								# If we use the most probably targets, and filter differently, we should still
								# have the same results
								snake_case_				=							[el['token_str'] for el in sorted(a       ,			key=lambda a					: x["score"]       ,			reverse=a					)]
								# For some BPE tokenizers, `</w>` is removed during decoding, so `token_str` won't be the same as in `targets`.
								if set(a					).issubset(a					):
															snake_case_				=							fill_masker(F'''This is a {tokenizer.mask_token}'''       ,			top_k=3       ,			targets=a					)
															# They should yield exactly the same result
															self.assertEqual(nested_simplify(a					)       ,			nested_simplify(a					)					)




	def 							_UpperCamelCase			(       self       ,			a       ,			a					)       ->    Any:
								snake_case_				=							FillMaskPipeline(model=a       ,			tokenizer=a					)
								snake_case_				=							tokenizer.get_vocab()
								# String duplicates + id duplicates
								snake_case_				=							sorted(vocab.keys()					)[:3]
								snake_case_				=							[targets[0], targets[1], targets[0], targets[2], targets[1]]
								snake_case_				=							fill_masker(F'''My name is {tokenizer.mask_token}'''       ,			targets=a       ,			top_k=10					)

								# The target list contains duplicates, so we can't output more
								# than them
								self.assertEqual(len(a					)       ,			3					)






	def 							_UpperCamelCase			(       self       ,			a       ,			a					)       ->    str:
								snake_case_				=							FillMaskPipeline(model=a       ,			tokenizer=a					)

								snake_case_				=							fill_masker(
								    F'''This is a {tokenizer.mask_token} {tokenizer.mask_token} {tokenizer.mask_token}'''       ,			top_k=2					)
								self.assertEqual(
								    a       ,			[
								        [
								            {'sequence': ANY(a					), 'score': ANY(a					), 'token': ANY(a					), 'token_str': ANY(a					)},
								            {'sequence': ANY(a					), 'score': ANY(a					), 'token': ANY(a					), 'token_str': ANY(a					)},
								        ],
								        [
								            {'sequence': ANY(a					), 'score': ANY(a					), 'token': ANY(a					), 'token_str': ANY(a					)},
								            {'sequence': ANY(a					), 'score': ANY(a					), 'token': ANY(a					), 'token_str': ANY(a					)},
								        ],
								        [
								            {'sequence': ANY(a					), 'score': ANY(a					), 'token': ANY(a					), 'token_str': ANY(a					)},
								            {'sequence': ANY(a					), 'score': ANY(a					), 'token': ANY(a					), 'token_str': ANY(a					)},
								        ],
								    ]       ,			)













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,
)


lowercase  							=					"\\n    Text data.\n    Second line of data."

lowercase  							=					"file"





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





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





@pytest.mark.parametrize('compression_format'							,     ['gzip', 'xz', 'zstd'])
def 						__UpperCAmelCase			(     a_							,     a_							,     a_							,     a_							,     a_							,     a_):
							snake_case_				=							{'gzip': gz_file, 'xz': xz_file, 'zstd': zstd_path}
							snake_case_				=							input_paths[compression_format]
							snake_case_				=							tmp_path / 'cache'
							snake_case_				=							DownloadConfig(cache_dir=a_							,     extract_compressed_file=a_)
							snake_case_				=							cached_path(a_							,     download_config=a_)
							with open(a_) as f:
														snake_case_				=							f.read()
							with open(a_) as f:
														snake_case_				=							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 						__UpperCAmelCase			(     a_							,     a_							,     a_							,     a_							,     a_):
							snake_case_				=							'custom_cache'
							snake_case_				=							'custom_extracted_dir'
							snake_case_				=							tmp_path / 'custom_extracted_path'
							if default_extracted:
														snake_case_				=							('downloads' if default_cache_dir else custom_cache_dir, 'extracted')
							else:
														monkeypatch.setattr('datasets.config.EXTRACTED_DATASETS_DIR'							,     a_)
														monkeypatch.setattr('datasets.config.EXTRACTED_DATASETS_PATH'							,     str(a_))
														snake_case_				=							custom_extracted_path.parts[-2:] if default_cache_dir else (custom_cache_dir, custom_extracted_dir)

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





def 						__UpperCAmelCase			(     a_):
							# absolute path
							snake_case_				=							str(Path(a_).resolve())
							assert cached_path(a_) == text_file
							# relative path
							snake_case_				=							str(Path(a_).resolve().relative_to(Path(os.getcwd())))
							assert cached_path(a_) == text_file





def 						__UpperCAmelCase			(     a_):
							# absolute path
							snake_case_				=							str(tmp_path.resolve() / '__missing_file__.txt')
							with pytest.raises(a_):
														cached_path(a_)
							# relative path
							snake_case_				=							'./__missing_file__.txt'
							with pytest.raises(a_):
														cached_path(a_)





def 						__UpperCAmelCase			(     a_):
							snake_case_				=							get_from_cache(f'''tmp://{tmpfs_file}''')
							with open(a_) as f:
														snake_case_				=							f.read()
							assert output_file_content == FILE_CONTENT





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





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





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





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





