'''simple docstring'''




from unittest.mock import Mock, patch

from file_transfer.send_file import send_file




@patch("""socket.socket"""				)
@patch("""builtins.open"""				)
def 							lowerCamelCase			(   UpperCAmelCase__ :      List[Any]   ,   UpperCAmelCase__ :      List[str]				)    ->   List[str]:
							# ===== initialization =====
							lowercase_      :    List[Any]       		= Mock()
							lowercase_      :    str       		= conn, Mock()
							lowercase_      :    str       		= iter([1, None]				)
							lowercase_      :    Optional[Any]       		= lambda UpperCAmelCase__				: next(UpperCAmelCase__				)

							# ===== invoke =====
							send_file(filename="""mytext.txt"""   ,   testing=UpperCAmelCase__				)

							# ===== ensurance =====
							sock.assert_called_once()
							sock.return_value.bind.assert_called_once()
							sock.return_value.listen.assert_called_once()
							sock.return_value.accept.assert_called_once()
							conn.recv.assert_called_once()

							file.return_value.__enter__.assert_called_once()
							file.return_value.__enter__.return_value.read.assert_called()

							conn.send.assert_called_once()
							conn.close.assert_called_once()
							sock.return_value.shutdown.assert_called_once()
							sock.return_value.close.assert_called_once()






'''simple docstring'''




from ...configuration_utils import PretrainedConfig
from ...utils import logging


_lowercase		:				Optional[Any]	       =		logging.get_logger(__name__)

_lowercase		:				Union[str, Any]	       =		{
    "facebook/s2t-small-librispeech-asr": (
        "https://huggingface.co/facebook/s2t-small-librispeech-asr/resolve/main/config.json"
    ),
    # See all Speech2Text models at https://huggingface.co/models?filter=speech_to_text
}





class 					__magic_name__		(					_UpperCAmelCase):
			UpperCamelCase__       = '''speech_to_text'''
			UpperCamelCase__       = ['''past_key_values''']
			UpperCamelCase__       = {'''num_attention_heads''': '''encoder_attention_heads''', '''hidden_size''': '''d_model'''}







			def __init__(			self       :						str       ,    lowercase_       :						Optional[int]=10000       ,    lowercase_       :						int=12       ,    lowercase_       :						Any=2048       ,    lowercase_       :						Any=4       ,    lowercase_       :						Dict=6       ,    lowercase_       :						Any=2048       ,    lowercase_       :						List[str]=4       ,    lowercase_       :						str=0.0       ,    lowercase_       :						str=0.0       ,    lowercase_       :						Union[str, Any]=True       ,    lowercase_       :						List[Any]=True       ,    lowercase_       :						int="relu"       ,    lowercase_       :						str=256       ,    lowercase_       :						int=0.1       ,    lowercase_       :						int=0.0       ,    lowercase_       :						str=0.0       ,    lowercase_       :						Optional[int]=0.02       ,    lowercase_       :						str=2       ,    lowercase_       :						Union[str, Any]=True       ,    lowercase_       :						Any=1       ,    lowercase_       :						Dict=0       ,    lowercase_       :						List[str]=2       ,    lowercase_       :						List[Any]=6000       ,    lowercase_       :						Tuple=1024       ,    lowercase_       :						str=2       ,    lowercase_       :						Any=(5, 5)       ,    lowercase_       :						Union[str, Any]=1024       ,    lowercase_       :						Dict=80       ,    lowercase_       :						List[Any]=1       ,    **lowercase_       :						int       ,    ):
										lowercase_      :    List[Any]       		= vocab_size
										lowercase_      :    str       		= d_model
										lowercase_      :    List[Any]       		= encoder_ffn_dim
										lowercase_      :    str       		= encoder_layers
										lowercase_      :    Dict       		= encoder_attention_heads
										lowercase_      :    str       		= decoder_ffn_dim
										lowercase_      :    int       		= decoder_layers
										lowercase_      :    Any       		= decoder_attention_heads
										lowercase_      :    Any       		= dropout
										lowercase_      :    Dict       		= attention_dropout
										lowercase_      :    Optional[int]       		= activation_dropout
										lowercase_      :    Any       		= activation_function
										lowercase_      :    Union[str, Any]       		= init_std
										lowercase_      :    str       		= encoder_layerdrop
										lowercase_      :    Optional[int]       		= decoder_layerdrop
										lowercase_      :    Dict       		= use_cache
										lowercase_      :    Union[str, Any]       		= encoder_layers
										lowercase_      :    Tuple       		= scale_embedding  # scale factor will be sqrt(d_model) if True
										lowercase_      :    Dict       		= max_source_positions
										lowercase_      :    Optional[int]       		= max_target_positions
										lowercase_      :    Tuple       		= num_conv_layers
										lowercase_      :    Tuple       		= list(lowercase_					)
										lowercase_      :    Union[str, Any]       		= conv_channels
										lowercase_      :    str       		= input_feat_per_channel
										lowercase_      :    str       		= input_channels

										if len(self.conv_kernel_sizes					) != self.num_conv_layers:
																	raise ValueError(
																	    """Configuration for convolutional module is incorrect. """
																	    """It is required that `len(config.conv_kernel_sizes)` == `config.num_conv_layers` """
																	    f'''but is `len(config.conv_kernel_sizes) = {len(self.conv_kernel_sizes					)}`, '''
																	    f'''`config.num_conv_layers = {self.num_conv_layers}`.'''					)

										super().__init__(
										    pad_token_id=lowercase_       ,    bos_token_id=lowercase_       ,    eos_token_id=lowercase_       ,    is_encoder_decoder=lowercase_       ,    decoder_start_token_id=lowercase_       ,    **lowercase_       ,    )





