






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__":
   A_		:		List[str]		     =			'%20'.join(argv[1:]) if len(argv) > 1 else quote(str(input('Search: ')))

   print('Googling.....')

   A_		:		Optional[Any]		     =			F'''https://www.google.com/search?q={query}&num=100'''

   A_		:		Any		     =			requests.get(
       url,
       headers={'User-Agent': str(UserAgent().random)},
   )

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

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

   webbrowser.open(link)







import unittest

from transformers import is_torch_available
from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device


if is_torch_available():
   from transformers import AutoModelForSeqaSeqLM, AutoTokenizer




@require_torch
@require_sentencepiece
@require_tokenizers
class     _lowerCAmelCase(	unittest.TestCase ):





       """simple docstring"""







       @slow
       def       _a   ( self							):
         UpperCamelCase_: Optional[int]   				=    AutoModelForSeqaSeqLM.from_pretrained('google/mt5-small'  ,      return_dict=_lowerCamelCase							).to(_lowerCamelCase							)
         UpperCamelCase_: Dict   				=    AutoTokenizer.from_pretrained('google/mt5-small'							)

         UpperCamelCase_: Dict   				=    tokenizer('Hello there'  ,      return_tensors='pt'							).input_ids
         UpperCamelCase_: Optional[Any]   				=    tokenizer('Hi I am'  ,      return_tensors='pt'							).input_ids

         UpperCamelCase_: int   				=    model(input_ids.to(_lowerCamelCase							)  ,      labels=labels.to(_lowerCamelCase							)							).loss
         UpperCamelCase_: Tuple   				=    -(labels.shape[-1] * loss.item())

         UpperCamelCase_: Any   				=    -8_4.9_1_2_7
         self.assertTrue(abs(mtf_score - EXPECTED_SCORE							) < 1e-4							)