




import torch
from transformers import PreTrainedModel, XLMRobertaConfig, XLMRobertaModel






class  __magic_name__						(  __UpperCAmelCase):
				'''simple docstring'''







				SCREAMING_SNAKE_CASE__					:							Optional[int]	      =					"M-CLIP"


				def __init__(							self:   str		,					_lowerCamelCase:   Union[str, Any]=10_24		,					_lowerCamelCase:   List[str]=7_68		,					**_lowerCamelCase:   Tuple		):
											SCREAMING_SNAKE_CASE_   	=    transformerDimSize
											SCREAMING_SNAKE_CASE_   	=    imageDimSize
											super().__init__(**_lowerCamelCase		)






class  __magic_name__						(  __UpperCAmelCase):
				'''simple docstring'''







				SCREAMING_SNAKE_CASE__					:							List[Any]	      =					MCLIPConfig


				def __init__(							self:   int		,					_lowerCamelCase:   Dict		,					*_lowerCamelCase:   List[str]		,					**_lowerCamelCase:   str		):
											super().__init__(_lowerCamelCase		,					*_lowerCamelCase		,					**_lowerCamelCase		)
											SCREAMING_SNAKE_CASE_   	=    XLMRobertaModel(_lowerCamelCase		)
											SCREAMING_SNAKE_CASE_   	=    torch.nn.Linear(
											    in_features=config.transformerDimensions		,					out_features=config.numDims		)





				def     _A							(							self:   List[Any]		,					_lowerCamelCase:   Optional[int]		,					_lowerCamelCase:   Tuple		):
											SCREAMING_SNAKE_CASE_   	=    self.transformer(input_ids=_lowerCamelCase		,					attention_mask=_lowerCamelCase		)[0]
											SCREAMING_SNAKE_CASE_   	=    (embs * attention_mask.unsqueeze(2		)).sum(dim=1		) / attention_mask.sum(dim=1		)[:, None]
											return self.LinearTransformation(_lowerCamelCase		), embs








import webbrowser
from sys import argv
from urllib.parse import parse_qs, quote

import requests
from bsa import BeautifulSoup
from fake_useragent import UserAgent

if __name__ == "__main__":
			__SCREAMING_SNAKE_CASE 						="""%20""".join(argv[1:]) if len(argv) > 1 else quote(str(input("""Search: """)))

			print("""Googling.....""")

			__SCREAMING_SNAKE_CASE 						=f"""https://www.google.com/search?q={query}&num=100"""

			__SCREAMING_SNAKE_CASE 						=requests.get(
			    url,
			    headers={"""User-Agent""": str(UserAgent().random)},
			)

			try:
						__SCREAMING_SNAKE_CASE 						=(
						    BeautifulSoup(res.text, """html.parser""")
						    .find("""div""", attrs={"""class""": """yuRUbf"""})
						    .find("""a""")
						    .get("""href""")
						)

			except AttributeError:
						__SCREAMING_SNAKE_CASE 						=parse_qs(
						    BeautifulSoup(res.text, """html.parser""")
						    .find("""div""", attrs={"""class""": """kCrYT"""})
						    .find("""a""")
						    .get("""href""")
						)["""url"""][0]

			webbrowser.open(link)


