


'''simple docstring'''




import unittest
from dataclasses import dataclass
from typing import Optional

from transformers.utils import ModelOutput





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





							__a				       =  42
							__a				       =  None
							__a				       =  None





class _snake_case (			unittest.TestCase ):
							"""simple docstring"""





							def 		__SCREAMING_SNAKE_CASE( self						)  ->Optional[int]:



											"""simple docstring"""







											__lowerCamelCase		:   Union[str, Any]           =       ModelOutputTest(a=30						)
											self.assertEqual(x.a      ,					30						)
											self.assertIsNone(x.b						)
											self.assertIsNone(x.c						)
											with self.assertRaises(__A						):
															__lowerCamelCase		:   Dict           =       x.d







							def 		__SCREAMING_SNAKE_CASE( self						)  ->Optional[int]:



											"""simple docstring"""







											__lowerCamelCase		:   str           =       ModelOutputTest(a=30      ,					b=10						)
											self.assertEqual(x[0]      ,					30						)
											self.assertEqual(x[1]      ,					10						)
											self.assertEqual(x[:2]      ,					(30, 10)						)
											self.assertEqual(x[:]      ,					(30, 10)						)

											__lowerCamelCase		:   List[str]           =       ModelOutputTest(a=30      ,					c=10						)
											self.assertEqual(x[0]      ,					30						)
											self.assertEqual(x[1]      ,					10						)
											self.assertEqual(x[:2]      ,					(30, 10)						)
											self.assertEqual(x[:]      ,					(30, 10)						)







							def 		__SCREAMING_SNAKE_CASE( self						)  ->List[str]:



											"""simple docstring"""







											__lowerCamelCase		:   List[Any]           =       ModelOutputTest(a=30      ,					b=10						)
											self.assertEqual(x["a"]      ,					30						)
											self.assertEqual(x["b"]      ,					10						)
											with self.assertRaises(__A						):
															__lowerCamelCase		:   Any           =       x["c"]

											__lowerCamelCase		:   int           =       ModelOutputTest(a=30      ,					c=10						)
											self.assertEqual(x["a"]      ,					30						)
											self.assertEqual(x["c"]      ,					10						)
											with self.assertRaises(__A						):
															__lowerCamelCase		:   Tuple           =       x["b"]







							def 		__SCREAMING_SNAKE_CASE( self						)  ->Tuple:



											"""simple docstring"""







											__lowerCamelCase		:   Any           =       ModelOutputTest(a=30						)
											self.assertEqual(list(x.keys()						)      ,					["a"]						)
											self.assertEqual(list(x.values()						)      ,					[30]						)
											self.assertEqual(list(x.items()						)      ,					[("a", 30)]						)
											self.assertEqual(list(__A						)      ,					["a"]						)

											__lowerCamelCase		:   List[str]           =       ModelOutputTest(a=30      ,					b=10						)
											self.assertEqual(list(x.keys()						)      ,					["a", "b"]						)
											self.assertEqual(list(x.values()						)      ,					[30, 10]						)
											self.assertEqual(list(x.items()						)      ,					[("a", 30), ("b", 10)]						)
											self.assertEqual(list(__A						)      ,					["a", "b"]						)

											__lowerCamelCase		:   List[Any]           =       ModelOutputTest(a=30      ,					c=10						)
											self.assertEqual(list(x.keys()						)      ,					["a", "c"]						)
											self.assertEqual(list(x.values()						)      ,					[30, 10]						)
											self.assertEqual(list(x.items()						)      ,					[("a", 30), ("c", 10)]						)
											self.assertEqual(list(__A						)      ,					["a", "c"]						)

											with self.assertRaises(__A						):
															__lowerCamelCase		:   Tuple           =       x.update({"d": 20}						)
											with self.assertRaises(__A						):
															del x["a"]
											with self.assertRaises(__A						):
															__lowerCamelCase		:   Tuple           =       x.pop("a"						)
											with self.assertRaises(__A						):
															__lowerCamelCase		:   List[str]           =       x.setdefault("d"      ,					32						)







							def 		__SCREAMING_SNAKE_CASE( self						)  ->Tuple:



											"""simple docstring"""







											__lowerCamelCase		:   List[Any]           =       ModelOutputTest(a=30						)
											__lowerCamelCase		:   int           =       10
											self.assertEqual(x.a      ,					10						)
											self.assertEqual(x["a"]      ,					10						)







							def 		__SCREAMING_SNAKE_CASE( self						)  ->Union[str, Any]:



											"""simple docstring"""







											__lowerCamelCase		:   Optional[Any]           =       ModelOutputTest(a=30						)
											__lowerCamelCase		:   Tuple           =       10
											self.assertEqual(x.a      ,					10						)
											self.assertEqual(x["a"]      ,					10						)







							def 		__SCREAMING_SNAKE_CASE( self						)  ->Dict:



											"""simple docstring"""







											__lowerCamelCase		:   Any           =       ModelOutputTest({"a": 30, "b": 10}						)
											self.assertEqual(list(x.keys()						)      ,					["a", "b"]						)
											self.assertEqual(x.a      ,					30						)
											self.assertEqual(x.b      ,					10						)







							def 		__SCREAMING_SNAKE_CASE( self						)  ->int:



											"""simple docstring"""







											__lowerCamelCase		:   Any           =       ModelOutputTest([("a", 30), ("b", 10)]						)
											self.assertEqual(list(x.keys()						)      ,					["a", "b"]						)
											self.assertEqual(x.a      ,					30						)
											self.assertEqual(x.b      ,					10						)

											with self.assertRaises(__A						):
															__lowerCamelCase		:   List[str]           =       ModelOutputTest([("a", 30), (10, 10)]						)

											__lowerCamelCase		:   List[str]           =       ModelOutputTest(a=(30, 30)						)
											self.assertEqual(list(x.keys()						)      ,					["a"]						)
											self.assertEqual(x.a      ,					(30, 30)						)









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





