

"""simple docstring"""



import warnings
from contextlib import contextmanager

from ...processing_utils import ProcessorMixin



class        a    (							_lowerCamelCase					):



    """simple docstring"""



    UpperCAmelCase    			=       "AutoFeatureExtractor"
    UpperCAmelCase    			=       "Speech2Text2Tokenizer"

    def __init__(  self:			List[Any]     ,    UpperCamelCase:			Any     ,    UpperCamelCase:			Tuple							):






         """simple docstring"""


         super().__init__(__lowercase     ,    __lowercase							)
         A__				      =	self.feature_extractor
         A__				      =	False

    def __call__(  self:			Union[str, Any]     ,    *UpperCamelCase:			Optional[Any]     ,    **UpperCamelCase:			Optional[Any]							):






         """simple docstring"""


         if self._in_target_context_manager:
              return self.current_processor(*__lowercase     ,    **__lowercase							)

         if "raw_speech" in kwargs:
              warnings.warn("""Using `raw_speech` as a keyword argument is deprecated. Use `audio` instead."""							)
              A__				      =	kwargs.pop("""raw_speech"""							)
         else:
              A__				      =	kwargs.pop("""audio"""     ,    __lowercase							)
         A__				      =	kwargs.pop("""sampling_rate"""     ,    __lowercase							)
         A__				      =	kwargs.pop("""text"""     ,    __lowercase							)
         if len(__lowercase							) > 0:
              A__				      =	args[0]
              A__				      =	args[1:]

         if audio is None and text is None:
              raise ValueError("""You need to specify either an `audio` or `text` input to process."""							)

         if audio is not None:
              A__				      =	self.feature_extractor(__lowercase     ,    *__lowercase     ,    sampling_rate=__lowercase     ,    **__lowercase							)
         if text is not None:
              A__				      =	self.tokenizer(__lowercase     ,    **__lowercase							)

         if text is None:
              return inputs
         elif audio is None:
              return encodings
         else:
              A__				      =	encodings['input_ids']
              return inputs

    def 					UpperCamelCase						(  self:			Optional[Any]     ,    *UpperCamelCase:			Union[str, Any]     ,    **UpperCamelCase:			Tuple							):






         """simple docstring"""


         return self.tokenizer.batch_decode(*__lowercase     ,    **__lowercase							)

    def 					UpperCamelCase						(  self:			Any     ,    *UpperCamelCase:			int     ,    **UpperCamelCase:			Any							):






         """simple docstring"""


         return self.tokenizer.decode(*__lowercase     ,    **__lowercase							)





    @contextmanager
    def 					UpperCamelCase						(  self:			Dict							):






         """simple docstring"""


         warnings.warn(
             """`as_target_processor` is deprecated and will be removed in v5 of Transformers. You can process your """
             """labels by using the argument `text` of the regular `__call__` method (either in the same call as """
             """your audio inputs, or in a separate call."""							)
         A__				      =	True
         A__				      =	self.tokenizer
         yield
         A__				      =	self.feature_extractor
         A__				      =	False












import requests

try:
							from django.contrib.auth import authenticate, login
							from django.shortcuts import redirect, render
except ImportError:
							UpperCamelCase__						=		UpperCamelCase__						=		UpperCamelCase__						=		UpperCamelCase__						=		print






def    snake_case   (				A     )				->				List[str]:




	'''simple docstring'''


	lowerCamelCase_				:						Optional[int]				  =				'secretKey'
	lowerCamelCase_				:						str				  =				'https://www.google.com/recaptcha/api/siteverify'

	# when method is not POST, direct user to login page
	if request.method != "POST":
		return render(A		,  'login.html'     )

	# from the frontend, get username, password, and client_key
	lowerCamelCase_				:						int				  =				request.POST.get('username'     )
	lowerCamelCase_				:						str				  =				request.POST.get('password'     )
	lowerCamelCase_				:						List[Any]				  =				request.POST.get('g-recaptcha-response'     )

	# post recaptcha response to Google's recaptcha api
	lowerCamelCase_				:						Union[str, Any]				  =				requests.post(A		,  data={'secret': secret_key, 'response': client_key}     )
	# if the recaptcha api verified our keys
	if response.json().get('success'		,  A     ):
		# authenticate the user
		lowerCamelCase_				:						int				  =				authenticate(A		,  username=A		,  password=A     )
		if user_in_database:
			login(A		,  A     )
			return redirect('/your-webpage'     )
	return render(A		,  'login.html'     )
