




import inspect
import unittest

from transformers import EfficientNetConfig
from transformers.testing_utils import is_pipeline_test, require_torch, require_vision, slow, torch_device
from transformers.utils import cached_property, is_torch_available, is_vision_available

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, floats_tensor, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
					import torch

					from transformers import EfficientNetForImageClassification, EfficientNetModel
					from transformers.models.efficientnet.modeling_efficientnet import EFFICIENTNET_PRETRAINED_MODEL_ARCHIVE_LIST


if is_vision_available():
					from PIL import Image

					from transformers import AutoImageProcessor
class      a__       :






						def __init__(  self						,     _A						,     _A=1_3						,     _A=3_2						,     _A=3						,     _A=[3, 3, 5]						,     _A=[3_2, 1_6, 2_4]						,     _A=[1_6, 2_4, 4_0]						,     _A=[1, 1, 2]						,     _A=[1, 1, 2]						,     _A=[1, 6, 6]						,     _A=True						,     _A=True						,     _A=3_7						,     _A="gelu"						,     _A=1_0						,     ):




											"""simple docstring"""



											__lowerCAmelCase							  =			parent
											__lowerCAmelCase							  =			batch_size
											__lowerCAmelCase							  =			image_size
											__lowerCAmelCase							  =			num_channels
											__lowerCAmelCase							  =			kernel_sizes
											__lowerCAmelCase							  =			in_channels
											__lowerCAmelCase							  =			out_channels
											__lowerCAmelCase							  =			strides
											__lowerCAmelCase							  =			num_block_repeats
											__lowerCAmelCase							  =			expand_ratios
											__lowerCAmelCase							  =			is_training
											__lowerCAmelCase							  =			hidden_act
											__lowerCAmelCase							  =			num_labels
											__lowerCAmelCase							  =			use_labels






						def 							__SCREAMING_SNAKE_CASE(  self     ):




											"""simple docstring"""



											__lowerCAmelCase							  =			floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]     )

											__lowerCAmelCase							  =			None
											if self.use_labels:
																__lowerCAmelCase							  =			ids_tensor([self.batch_size]						,     self.num_labels     )

											__lowerCAmelCase							  =			self.get_config()
											return config, pixel_values, labels






						def 							__SCREAMING_SNAKE_CASE(  self     ):




											"""simple docstring"""



											return EfficientNetConfig(
											    num_channels=self.num_channels						,     kernel_sizes=self.kernel_sizes						,     in_channels=self.in_channels						,     out_channels=self.out_channels						,     strides=self.strides						,     num_block_repeats=self.num_block_repeats						,     expand_ratios=self.expand_ratios						,     hidden_act=self.hidden_act						,     num_labels=self.num_labels						,     )






						def 							__SCREAMING_SNAKE_CASE(  self						,     _A						,     _A						,     _A     ):




											"""simple docstring"""



											__lowerCAmelCase							  =			EfficientNetModel(config=_UpperCAmelCase     )
											model.to(_UpperCAmelCase     )
											model.eval()
											__lowerCAmelCase							  =			model(_UpperCAmelCase     )
											# expected last hidden states: B, C, H // 4, W // 4
											self.parent.assertEqual(
											    result.last_hidden_state.shape						,     (self.batch_size, config.hidden_dim, self.image_size // 4, self.image_size // 4)						,     )






						def 							__SCREAMING_SNAKE_CASE(  self						,     _A						,     _A						,     _A     ):




											"""simple docstring"""



											__lowerCAmelCase							  =			EfficientNetForImageClassification(_UpperCAmelCase     )
											model.to(_UpperCAmelCase     )
											model.eval()
											__lowerCAmelCase							  =			model(_UpperCAmelCase						,     labels=_UpperCAmelCase     )
											self.parent.assertEqual(result.logits.shape						,     (self.batch_size, self.num_labels)     )






						def 							__SCREAMING_SNAKE_CASE(  self     ):




											"""simple docstring"""



											__lowerCAmelCase							  =			self.prepare_config_and_inputs()
											__lowerCAmelCase							  =			config_and_inputs
											__lowerCAmelCase							  =			{'''pixel_values''': pixel_values}
											return config, inputs_dict






@require_torch
class      a__       (   snake_case__					,							snake_case__					,							unittest.TestCase ):
						_a				:       Any   =       (EfficientNetModel, EfficientNetForImageClassification) if is_torch_available() else ()
						_a				:       str   =       (
						    {"""feature-extraction""": EfficientNetModel, """image-classification""": EfficientNetForImageClassification}
						    if is_torch_available()
						    else {}
						)

						_a				:       Tuple   =       False
						_a				:       Union[str, Any]   =       False
						_a				:       List[Any]   =       False
						_a				:       List[str]   =       False
						_a				:       Union[str, Any]   =       False






						def 							__SCREAMING_SNAKE_CASE(  self     ):




											"""simple docstring"""



											__lowerCAmelCase							  =			EfficientNetModelTester(self     )
											__lowerCAmelCase							  =			ConfigTester(
											    self						,     config_class=_UpperCAmelCase						,     has_text_modality=_UpperCAmelCase						,     hidden_size=3_7     )






						def 							__SCREAMING_SNAKE_CASE(  self     ):




											"""simple docstring"""



											self.create_and_test_config_common_properties()
											self.config_tester.create_and_test_config_to_json_string()
											self.config_tester.create_and_test_config_to_json_file()
											self.config_tester.create_and_test_config_from_and_save_pretrained()
											self.config_tester.create_and_test_config_with_num_labels()
											self.config_tester.check_config_can_be_init_without_params()
											self.config_tester.check_config_arguments_init()






						def 							__SCREAMING_SNAKE_CASE(  self     ):




											"""simple docstring"""



											return






						@unittest.skip(reason="EfficientNet does not use inputs_embeds"     )
						def 							__SCREAMING_SNAKE_CASE(  self     ):




											"""simple docstring"""



											pass






						@unittest.skip(reason="EfficientNet does not support input and output embeddings"     )
						def 							__SCREAMING_SNAKE_CASE(  self     ):




											"""simple docstring"""



											pass






						@unittest.skip(reason="EfficientNet does not use feedforward chunking"     )
						def 							__SCREAMING_SNAKE_CASE(  self     ):




											"""simple docstring"""



											pass






						def 							__SCREAMING_SNAKE_CASE(  self     ):




											"""simple docstring"""



											__lowerCAmelCase							  =			self.model_tester.prepare_config_and_inputs_for_common()

											for model_class in self.all_model_classes:
																__lowerCAmelCase							  =			model_class(_UpperCAmelCase     )
																__lowerCAmelCase							  =			inspect.signature(model.forward     )
																# signature.parameters is an OrderedDict => so arg_names order is deterministic
																__lowerCAmelCase							  =			[*signature.parameters.keys()]

																__lowerCAmelCase							  =			['''pixel_values''']
																self.assertListEqual(arg_names[:1]						,     _UpperCAmelCase     )






						def 							__SCREAMING_SNAKE_CASE(  self     ):




											"""simple docstring"""



											__lowerCAmelCase							  =			self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_model(*_UpperCAmelCase     )






						def 							__SCREAMING_SNAKE_CASE(  self     ):




											"""simple docstring"""



											def check_hidden_states_output(_A						,     _A						,     _A     ):
																__lowerCAmelCase							  =			model_class(_UpperCAmelCase     )
																model.to(_UpperCAmelCase     )
																model.eval()

																with torch.no_grad():
																					__lowerCAmelCase							  =			model(**self._prepare_for_class(_UpperCAmelCase						,     _UpperCAmelCase     )     )

																__lowerCAmelCase							  =			outputs.encoder_hidden_states if config.is_encoder_decoder else outputs.hidden_states
																__lowerCAmelCase							  =			sum(config.num_block_repeats     ) * 4
																self.assertEqual(len(_UpperCAmelCase     )						,     _UpperCAmelCase     )

																# EfficientNet's feature maps are of shape (batch_size, num_channels, height, width)
																self.assertListEqual(
																    list(hidden_states[0].shape[-2:]     )						,     [self.model_tester.image_size // 2, self.model_tester.image_size // 2]						,     )

											__lowerCAmelCase							  =			self.model_tester.prepare_config_and_inputs_for_common()

											for model_class in self.all_model_classes:
																__lowerCAmelCase							  =			True
																check_hidden_states_output(_UpperCAmelCase						,     _UpperCAmelCase						,     _UpperCAmelCase     )

																# check that output_hidden_states also work using config
																del inputs_dict["output_hidden_states"]
																__lowerCAmelCase							  =			True

																check_hidden_states_output(_UpperCAmelCase						,     _UpperCAmelCase						,     _UpperCAmelCase     )






						def 							__SCREAMING_SNAKE_CASE(  self     ):




											"""simple docstring"""



											__lowerCAmelCase							  =			self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_image_classification(*_UpperCAmelCase     )






						@unittest.skip("Will be fixed soon by reducing the size of the model used for common tests."     )
						def 							__SCREAMING_SNAKE_CASE(  self     ):




											"""simple docstring"""



											pass






						@slow
						def 							__SCREAMING_SNAKE_CASE(  self     ):




											"""simple docstring"""



											for model_name in EFFICIENTNET_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
																__lowerCAmelCase							  =			EfficientNetModel.from_pretrained(_UpperCAmelCase     )
																self.assertIsNotNone(_UpperCAmelCase     )






						@is_pipeline_test
						@require_vision
						@slow
						def 							__SCREAMING_SNAKE_CASE(  self     ):




											"""simple docstring"""



											super().test_pipeline_image_classification()







def       _a (		):
					__lowerCAmelCase							  =			Image.open("./tests/fixtures/tests_samples/COCO/000000039769.png"	)
					return image


@require_torch
@require_vision
class      a__       (   unittest.TestCase ):






						@cached_property
						def 							__SCREAMING_SNAKE_CASE(  self     ):




											"""simple docstring"""



											return AutoImageProcessor.from_pretrained("google/efficientnet-b7"     ) if is_vision_available() else None






						@slow
						def 							__SCREAMING_SNAKE_CASE(  self     ):




											"""simple docstring"""



											__lowerCAmelCase							  =			EfficientNetForImageClassification.from_pretrained("google/efficientnet-b7"     ).to(_UpperCAmelCase     )

											__lowerCAmelCase							  =			self.default_image_processor
											__lowerCAmelCase							  =			prepare_img()
											__lowerCAmelCase							  =			image_processor(images=_UpperCAmelCase						,     return_tensors="pt"     ).to(_UpperCAmelCase     )

											# forward pass
											with torch.no_grad():
																__lowerCAmelCase							  =			model(**_UpperCAmelCase     )

											# verify the logits
											__lowerCAmelCase							  =			torch.Size((1, 1_0_0_0)     )
											self.assertEqual(outputs.logits.shape						,     _UpperCAmelCase     )

											__lowerCAmelCase							  =			torch.tensor([0.00_01, 0.00_02, 0.00_02]     ).to(_UpperCAmelCase     )
											self.assertTrue(torch.allclose(outputs.logits[0, :3]						,     _UpperCAmelCase						,     atol=1E-4     )     )











'''simple docstring'''






import json
import os
from functools import lru_cache
from typing import List, Optional, Tuple

import regex as re

from ...tokenization_utils import AddedToken, PreTrainedTokenizer
from ...utils import logging


snake_case_     			=						logging.get_logger(__name__)

snake_case_     			=						{
    """vocab_file""": """vocab.json""",
    """merges_file""": """merges.txt""",
}

snake_case_     			=						{
    """vocab_file""": {
        """roberta-base""": """https://huggingface.co/roberta-base/resolve/main/vocab.json""",
        """roberta-large""": """https://huggingface.co/roberta-large/resolve/main/vocab.json""",
        """roberta-large-mnli""": """https://huggingface.co/roberta-large-mnli/resolve/main/vocab.json""",
        """distilroberta-base""": """https://huggingface.co/distilroberta-base/resolve/main/vocab.json""",
        """roberta-base-openai-detector""": """https://huggingface.co/roberta-base-openai-detector/resolve/main/vocab.json""",
        """roberta-large-openai-detector""": (
            """https://huggingface.co/roberta-large-openai-detector/resolve/main/vocab.json"""
        ),
    },
    """merges_file""": {
        """roberta-base""": """https://huggingface.co/roberta-base/resolve/main/merges.txt""",
        """roberta-large""": """https://huggingface.co/roberta-large/resolve/main/merges.txt""",
        """roberta-large-mnli""": """https://huggingface.co/roberta-large-mnli/resolve/main/merges.txt""",
        """distilroberta-base""": """https://huggingface.co/distilroberta-base/resolve/main/merges.txt""",
        """roberta-base-openai-detector""": """https://huggingface.co/roberta-base-openai-detector/resolve/main/merges.txt""",
        """roberta-large-openai-detector""": (
            """https://huggingface.co/roberta-large-openai-detector/resolve/main/merges.txt"""
        ),
    },
}

snake_case_     			=						{
    """roberta-base""": 5_12,
    """roberta-large""": 5_12,
    """roberta-large-mnli""": 5_12,
    """distilroberta-base""": 5_12,
    """roberta-base-openai-detector""": 5_12,
    """roberta-large-openai-detector""": 5_12,
}
@lru_cache()
def 				_lowerCamelCase(	)		->	List[Any]:
    A							:							Tuple				=    (
        list(range(ord('''!'''		)     ,							ord('''~'''		) + 1		)		) + list(range(ord('''¡'''		)     ,							ord('''¬'''		) + 1		)		) + list(range(ord('''®'''		)     ,							ord('''ÿ'''		) + 1		)		)
    )
    A							:							List[Any]				=    bs[:]
    A							:							Tuple				=    0
    for b in range(2**8		):
        if b not in bs:
            bs.append(UpperCamelCase__		)
            cs.append(2**8 + n		)
            n += 1
    A							:							Optional[int]				=    [chr(UpperCamelCase__		) for n in cs]
    return dict(zip(UpperCamelCase__     ,							UpperCamelCase__		)		)
def 				_lowerCamelCase(	UpperCamelCase__     :			int		)		->	str:
    A							:							int				=    set()
    A							:							Any				=    word[0]
    for char in word[1:]:
        pairs.add((prev_char, char)		)
        A							:							Tuple				=    char
    return pairs





class 	_lowercase    (				a					):
   _UpperCamelCase									= VOCAB_FILES_NAMES
   _UpperCamelCase									= PRETRAINED_VOCAB_FILES_MAP
   _UpperCamelCase									= PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
   _UpperCamelCase									= ["""input_ids""", """attention_mask"""]


   def __init__(			self     , _UpperCAmelCase     , _UpperCAmelCase     , _UpperCAmelCase="replace"     , _UpperCAmelCase="<s>"     , _UpperCAmelCase="</s>"     , _UpperCAmelCase="</s>"     , _UpperCAmelCase="<s>"     , _UpperCAmelCase="<unk>"     , _UpperCAmelCase="<pad>"     , _UpperCAmelCase="<mask>"     , _UpperCAmelCase=False     , **_UpperCAmelCase     , ):
       A							:							Any				=    AddedToken(_UpperCAmelCase     , lstrip=_UpperCAmelCase     , rstrip=_UpperCAmelCase       ) if isinstance(_UpperCAmelCase     , _UpperCAmelCase       ) else bos_token
       A							:							Optional[Any]				=    AddedToken(_UpperCAmelCase     , lstrip=_UpperCAmelCase     , rstrip=_UpperCAmelCase       ) if isinstance(_UpperCAmelCase     , _UpperCAmelCase       ) else eos_token
       A							:							Any				=    AddedToken(_UpperCAmelCase     , lstrip=_UpperCAmelCase     , rstrip=_UpperCAmelCase       ) if isinstance(_UpperCAmelCase     , _UpperCAmelCase       ) else sep_token
       A							:							List[Any]				=    AddedToken(_UpperCAmelCase     , lstrip=_UpperCAmelCase     , rstrip=_UpperCAmelCase       ) if isinstance(_UpperCAmelCase     , _UpperCAmelCase       ) else cls_token
       A							:							List[Any]				=    AddedToken(_UpperCAmelCase     , lstrip=_UpperCAmelCase     , rstrip=_UpperCAmelCase       ) if isinstance(_UpperCAmelCase     , _UpperCAmelCase       ) else unk_token
       A							:							List[Any]				=    AddedToken(_UpperCAmelCase     , lstrip=_UpperCAmelCase     , rstrip=_UpperCAmelCase       ) if isinstance(_UpperCAmelCase     , _UpperCAmelCase       ) else pad_token

       # Mask token behave like a normal word, i.e. include the space before it
       A							:							Optional[int]				=    AddedToken(_UpperCAmelCase     , lstrip=_UpperCAmelCase     , rstrip=_UpperCAmelCase       ) if isinstance(_UpperCAmelCase     , _UpperCAmelCase       ) else mask_token

       super().__init__(
           errors=_UpperCAmelCase     , bos_token=_UpperCAmelCase     , eos_token=_UpperCAmelCase     , unk_token=_UpperCAmelCase     , sep_token=_UpperCAmelCase     , cls_token=_UpperCAmelCase     , pad_token=_UpperCAmelCase     , mask_token=_UpperCAmelCase     , add_prefix_space=_UpperCAmelCase     , **_UpperCAmelCase     , )

       with open(_UpperCAmelCase     , encoding='''utf-8'''       ) as vocab_handle:
           A							:							int				=    json.load(_UpperCAmelCase       )
       A							:							Union[str, Any]				=    {v: k for k, v in self.encoder.items()}
       A							:							Tuple				=    errors  # how to handle errors in decoding
       A							:							List[Any]				=    bytes_to_unicode()
       A							:							List[Any]				=    {v: k for k, v in self.byte_encoder.items()}
       with open(_UpperCAmelCase     , encoding='''utf-8'''       ) as merges_handle:
           A							:							Optional[int]				=    merges_handle.read().split('''\n'''       )[1:-1]
       A							:							int				=    [tuple(merge.split()       ) for merge in bpe_merges]
       A							:							Union[str, Any]				=    dict(zip(_UpperCAmelCase     , range(len(_UpperCAmelCase       )       )       )       )
       A							:							List[str]				=    {}
       A							:							List[Any]				=    add_prefix_space

       # Should have added re.IGNORECASE so BPE merges can happen for capitalized versions of contractions
       A							:							Any				=    re.compile(R'''\'s|\'t|\'re|\'ve|\'m|\'ll|\'d| ?\p{L}+| ?\p{N}+| ?[^\s\p{L}\p{N}]+|\s+(?!\S)|\s+'''       )


   @property
   def        snake_case					(			self       ):
       return len(self.encoder       )


   def        snake_case					(			self       ):
       return dict(self.encoder     , **self.added_tokens_encoder       )


   def        snake_case					(			self     , _UpperCAmelCase       ):
       if token in self.cache:
           return self.cache[token]
       A							:							Union[str, Any]				=    tuple(_UpperCAmelCase       )
       A							:							Tuple				=    get_pairs(_UpperCAmelCase       )

       if not pairs:
           return token

       while True:
           A							:							Any				=    min(_UpperCAmelCase     , key=lambda _UpperCAmelCase       : self.bpe_ranks.get(_UpperCAmelCase     , float('''inf'''       )       )       )
           if bigram not in self.bpe_ranks:
               break
           A,						A							:							Optional[int]				=    bigram
           A							:							str				=    []
           A							:							List[Any]				=    0
           while i < len(_UpperCAmelCase       ):
               try:
                   A							:							Any				=    word.index(_UpperCAmelCase     , _UpperCAmelCase       )
               except ValueError:
                   new_word.extend(word[i:]       )
                   break
               else:
                   new_word.extend(word[i:j]       )
                   A							:							Tuple				=    j

               if word[i] == first and i < len(_UpperCAmelCase       ) - 1 and word[i + 1] == second:
                   new_word.append(first + second       )
                   i += 2
               else:
                   new_word.append(word[i]       )
                   i += 1
           A							:							Optional[Any]				=    tuple(_UpperCAmelCase       )
           A							:							Dict				=    new_word
           if len(_UpperCAmelCase       ) == 1:
               break
           else:
               A							:							int				=    get_pairs(_UpperCAmelCase       )
       A							:							Union[str, Any]				=    ''' '''.join(_UpperCAmelCase       )
       A							:							Tuple				=    word
       return word


   def        snake_case					(			self     , _UpperCAmelCase       ):
       A							:							Tuple				=    []
       for token in re.findall(self.pat     , _UpperCAmelCase       ):
           A							:							Tuple				=    ''''''.join(
               self.byte_encoder[b] for b in token.encode('''utf-8'''       )       )  # Maps all our bytes to unicode strings, avoiding control tokens of the BPE (spaces in our case)
           bpe_tokens.extend(bpe_token for bpe_token in self.bpe(_UpperCAmelCase       ).split(''' '''       )       )
       return bpe_tokens


   def        snake_case					(			self     , _UpperCAmelCase       ):
       return self.encoder.get(_UpperCAmelCase     , self.encoder.get(self.unk_token       )       )


   def        snake_case					(			self     , _UpperCAmelCase       ):
       return self.decoder.get(_UpperCAmelCase       )


   def        snake_case					(			self     , _UpperCAmelCase       ):
       A							:							Any				=    ''''''.join(_UpperCAmelCase       )
       A							:							List[Any]				=    bytearray([self.byte_decoder[c] for c in text]       ).decode('''utf-8'''     , errors=self.errors       )
       return text


   def        snake_case					(			self     , _UpperCAmelCase     , _UpperCAmelCase = None       ):
       if not os.path.isdir(_UpperCAmelCase       ):
           logger.error(f'''Vocabulary path ({save_directory}) should be a directory'''       )
           return
       A							:							Any				=    os.path.join(
           _UpperCAmelCase     , (filename_prefix + '''-''' if filename_prefix else '''''') + VOCAB_FILES_NAMES['''vocab_file''']       )
       A							:							Any				=    os.path.join(
           _UpperCAmelCase     , (filename_prefix + '''-''' if filename_prefix else '''''') + VOCAB_FILES_NAMES['''merges_file''']       )

       with open(_UpperCAmelCase     , '''w'''     , encoding='''utf-8'''       ) as f:
           f.write(json.dumps(self.encoder     , indent=2     , sort_keys=_UpperCAmelCase     , ensure_ascii=_UpperCAmelCase       ) + '''\n'''       )

       A							:							Tuple				=    0
       with open(_UpperCAmelCase     , '''w'''     , encoding='''utf-8'''       ) as writer:
           writer.write('''#version: 0.2\n'''       )
           for bpe_tokens, token_index in sorted(self.bpe_ranks.items()     , key=lambda _UpperCAmelCase       : kv[1]       ):
               if index != token_index:
                   logger.warning(
                       f'''Saving vocabulary to {merge_file}: BPE merge indices are not consecutive.'''
                       ''' Please check that the tokenizer is not corrupted!'''       )
                   A							:							List[Any]				=    token_index
               writer.write(''' '''.join(_UpperCAmelCase       ) + '''\n'''       )
               index += 1

       return vocab_file, merge_file


   def        snake_case					(			self     , _UpperCAmelCase     , _UpperCAmelCase = None       ):
       if token_ids_a is None:
           return [self.cls_token_id] + token_ids_a + [self.sep_token_id]
       A							:							Union[str, Any]				=    [self.cls_token_id]
       A							:							Dict				=    [self.sep_token_id]
       return cls + token_ids_a + sep + sep + token_ids_a + sep


   def        snake_case					(			self     , _UpperCAmelCase     , _UpperCAmelCase = None     , _UpperCAmelCase = False       ):
       if already_has_special_tokens:
           return super().get_special_tokens_mask(
               token_ids_a=_UpperCAmelCase     , token_ids_a=_UpperCAmelCase     , already_has_special_tokens=_UpperCAmelCase       )

       if token_ids_a is None:
           return [1] + ([0] * len(_UpperCAmelCase       )) + [1]
       return [1] + ([0] * len(_UpperCAmelCase       )) + [1, 1] + ([0] * len(_UpperCAmelCase       )) + [1]


   def        snake_case					(			self     , _UpperCAmelCase     , _UpperCAmelCase = None       ):
       A							:							Dict				=    [self.sep_token_id]
       A							:							Union[str, Any]				=    [self.cls_token_id]

       if token_ids_a is None:
           return len(cls + token_ids_a + sep       ) * [0]
       return len(cls + token_ids_a + sep + sep + token_ids_a + sep       ) * [0]


   def        snake_case					(			self     , _UpperCAmelCase     , _UpperCAmelCase=False     , **_UpperCAmelCase       ):
       A							:							str				=    kwargs.pop('''add_prefix_space'''     , self.add_prefix_space       )
       if (is_split_into_words or add_prefix_space) and (len(_UpperCAmelCase       ) > 0 and not text[0].isspace()):
           A							:							List[Any]				=    ''' ''' + text
       return (text, kwargs)
