'''simple docstring'''

from typing import Optional, Tuple

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_openai import OpenAIGPTTokenizer


lowerCAmelCase_			:			List[str]    	=   logging.get_logger(__name__)

lowerCAmelCase_			:			Optional[int]    	=   {"""vocab_file""": """vocab.json""", """merges_file""": """merges.txt""", """tokenizer_file""": """tokenizer.json"""}

lowerCAmelCase_			:			Any    	=   {
    """vocab_file""": {"""openai-gpt""": """https://huggingface.co/openai-gpt/resolve/main/vocab.json"""},
    """merges_file""": {"""openai-gpt""": """https://huggingface.co/openai-gpt/resolve/main/merges.txt"""},
    """tokenizer_file""": {"""openai-gpt""": """https://huggingface.co/openai-gpt/resolve/main/tokenizer.json"""},
}

lowerCAmelCase_			:			Dict    	=   {
    """openai-gpt""": 512,
}





class 				lowercase    (    a__			):
   lowerCamelCase_            =VOCAB_FILES_NAMES
   lowerCamelCase_            =PRETRAINED_VOCAB_FILES_MAP
   lowerCamelCase_            =PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
   lowerCamelCase_            =['input_ids', 'attention_mask']
   lowerCamelCase_            =OpenAIGPTTokenizer


   def __init__( self					:						List[Any] ,		__lowerCAmelCase					:						int=None ,		__lowerCAmelCase					:						Optional[int]=None ,		__lowerCAmelCase					:						Optional[Any]=None ,		__lowerCAmelCase					:						Optional[Any]="<unk>" ,		**__lowerCAmelCase					:						int)   ->       Optional[int]:
         super().__init__(__A ,		__A ,		tokenizer_file=__A ,		unk_token=__A ,		**__A)


   @property
   def __UpperCAmelCase							( self					:						Union[str, Any])   ->       Dict:
         return True


   def __UpperCAmelCase							( self					:						str ,		__lowerCAmelCase					:						Tuple ,		__lowerCAmelCase					:						Optional[int] = None)   ->       Tuple[str]:
         lowercase_     			=   self._tokenizer.model.save(__A ,		name=__A)
         return tuple(__A)










'''simple docstring'''




import requests

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





def 				a_							(    lowercase     )      ->Any:






				'''simple docstring'''

				__lowerCamelCase		:   str           =       "secretKey"
				__lowerCamelCase		:   Optional[Any]           =       "https://www.google.com/recaptcha/api/siteverify"

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

				# from the frontend, get username, password, and client_key
				__lowerCamelCase		:   str           =       request.POST.get("username"     )
				__lowerCamelCase		:   Dict           =       request.POST.get("password"     )
				__lowerCamelCase		:   List[str]           =       request.POST.get("g-recaptcha-response"     )

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





