


'''simple docstring'''




import os
from shutil import copyfile
from typing import List, Optional, Tuple

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import is_sentencepiece_available, logging


if is_sentencepiece_available():
				from .tokenization_xglm import XGLMTokenizer
else:
				__lowercase	:   Tuple   		=					None


__lowercase	:   List[Any]   		=					logging.get_logger(__name__)

__lowercase	:   List[Any]   		=					{"""vocab_file""": """sentencepiece.bpe.model""", """tokenizer_file""": """tokenizer.json"""}

__lowercase	:   Optional[Any]   		=					{
    """vocab_file""": {
        """facebook/xglm-564M""": """https://huggingface.co/facebook/xglm-564M/resolve/main/sentencepiece.bpe.model""",
    },
    """tokenizer_file""": {
        """facebook/xglm-564M""": """https://huggingface.co/facebook/xglm-564M/resolve/main/tokenizer.json""",
    },
}

__lowercase	:   Tuple   		=					{
    """facebook/xglm-564M""": 20_48,
}





class _snake_case (			a__ ):
							"""simple docstring"""





							__a				       =  VOCAB_FILES_NAMES
							__a				       =  PRETRAINED_VOCAB_FILES_MAP
							__a				       =  PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
							__a				       =  ['''input_ids''', '''attention_mask''']
							__a				       =  XGLMTokenizer







							def __init__( self      ,					__A=None      ,					__A=None      ,					__A="<s>"      ,					__A="</s>"      ,					__A="</s>"      ,					__A="<s>"      ,					__A="<unk>"      ,					__A="<pad>"      ,					**__A      ,					)  ->Optional[Any]:



											"""simple docstring"""







											__lowerCamelCase		:   Union[str, Any]           =       7
											__lowerCamelCase		:   int           =       [f'<madeupword{i}>' for i in range(self.num_madeup_words						)]

											__lowerCamelCase		:   Tuple           =       kwargs.get("additional_special_tokens"      ,					[]						)
											kwargs["additional_special_tokens"] += [
											    word for word in madeup_words if word not in kwargs["additional_special_tokens"]
											]

											super().__init__(
											    __A      ,					tokenizer_file=__A      ,					bos_token=__A      ,					eos_token=__A      ,					sep_token=__A      ,					cls_token=__A      ,					unk_token=__A      ,					pad_token=__A      ,					**__A      ,					)

											__lowerCamelCase		:   Tuple           =       vocab_file
											__lowerCamelCase		:   Optional[int]           =       False if not self.vocab_file else True







							def 		__SCREAMING_SNAKE_CASE( self      ,					__A      ,					__A = None						)  ->List[int]:



											"""simple docstring"""







											if token_ids_a is None:
															return [self.sep_token_id] + token_ids_a
											__lowerCamelCase		:   Optional[Any]           =       [self.sep_token_id]
											return sep + token_ids_a + sep + sep + token_ids_a







							def 		__SCREAMING_SNAKE_CASE( self      ,					__A      ,					__A = None						)  ->List[int]:



											"""simple docstring"""







											__lowerCamelCase		:   Optional[Any]           =       [self.sep_token_id]

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







							def 		__SCREAMING_SNAKE_CASE( self      ,					__A      ,					__A = None						)  ->Tuple[str]:



											"""simple docstring"""







											if not self.can_save_slow_tokenizer:
															raise ValueError(
															    "Your fast tokenizer does not have the necessary information to save the vocabulary for a slow "
															    "tokenizer."						)

											if not os.path.isdir(__A						):
															logger.error(f'Vocabulary path ({save_directory}) should be a directory.'						)
															return
											__lowerCamelCase		:   Optional[Any]           =       os.path.join(
											    __A      ,					(filename_prefix + "-" if filename_prefix else "") + VOCAB_FILES_NAMES["vocab_file"]						)

											if os.path.abspath(self.vocab_file						) != os.path.abspath(__A						):
															copyfile(self.vocab_file      ,					__A						)

											return (out_vocab_file,)









'''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"     )





