'''simple docstring'''





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

    print('Googling.....')

    SCREAMING_SNAKE_CASE_:					Optional[int]  =f"https://www.google.com/search?q={query}&num=100"

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

    try:
        SCREAMING_SNAKE_CASE_:					Union[str, Any]  =(
            BeautifulSoup(res.text, 'html.parser')
            .find('div', attrs={'class': 'yuRUbf'})
            .find('a')
            .get('href')
        )

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

    webbrowser.open(link)





'''simple docstring'''





import unittest

from transformers import load_tool
from transformers.utils import is_torch_available


if is_torch_available():
    import torch

from transformers.testing_utils import require_torch

from .test_tools_common import ToolTesterMixin




@require_torch
class 	__A				(			unittest.TestCase		,     UpperCamelCase__     ):



    def  _lowercase						(self   :   Tuple			):
         UpperCAmelCase_	   =       load_tool("text-to-speech"			)
         self.tool.setup()



    def  _lowercase						(self   :   Union[str, Any]			):
         # SpeechT5 isn't deterministic
         torch.manual_seed(0			)
         UpperCAmelCase_	   =       self.tool("hey"			)
         UpperCAmelCase_	   =       result.to_raw()
         self.assertTrue(
             torch.allclose(
                 resulting_tensor[:3]       ,      torch.tensor([-0.0_00_59_66_66_88_32_11_58_29, -0.0_00_36_57_64_01_90_79_50_64, -0.00_01_34_39_50_27_99_88_34_85]			)       ,      )			)






    def  _lowercase						(self   :   List[str]			):
         # SpeechT5 isn't deterministic
         torch.manual_seed(0			)
         UpperCAmelCase_	   =       self.tool("hey"			)
         UpperCAmelCase_	   =       result.to_raw()
         self.assertTrue(
             torch.allclose(
                 resulting_tensor[:3]       ,      torch.tensor([-0.0_00_59_66_66_88_32_11_58_29, -0.0_00_36_57_64_01_90_79_50_64, -0.00_01_34_39_50_27_99_88_34_85]			)       ,      )			)




