



import unittest

from transformers import load_tool

from .test_tools_common import ToolTesterMixin


A__     				=	"""
Hugging Face was founded in 2016 by French entrepreneurs Clément Delangue, Julien Chaumond, and Thomas Wolf originally as a company that developed a chatbot app targeted at teenagers.[2] After open-sourcing the model behind the chatbot, the company pivoted to focus on being a platform for machine learning.

In March 2021, Hugging Face raised $40 million in a Series B funding round.[3]

On April 28, 2021, the company launched the BigScience Research Workshop in collaboration with several other research groups to release an open large language model.[4] In 2022, the workshop concluded with the announcement of BLOOM, a multilingual large language model with 176 billion parameters.[5]
"""





class  __lowerCAmelCase			(					unittest.TestCase	,						lowerCamelCase__	):




				def 							snake_case       (							self		):



									"""simple docstring"""





									_lowerCAmelCase      =   load_tool("""summarization"""		)
									self.tool.setup()
									_lowerCAmelCase      =   load_tool("""summarization"""						,    remote=_snake_case		)




				def 							snake_case       (							self		):



									"""simple docstring"""





									_lowerCAmelCase      =   self.tool(_snake_case		)
									self.assertEqual(
									    _snake_case						,    """Hugging Face was founded in 2016 by French entrepreneurs Clément Delangue, Julien Chaumond, and Thomas Wolf. In March 2021, Hugging Face raised $40 million in a Series B funding round. On April 28, 2021, the company launched the BigScience Research Workshop in collaboration with several other research groups to release an open large language model. In 2022, the workshop concluded with the announcement of BLOOM."""						,    )




				def 							snake_case       (							self		):



									"""simple docstring"""





									_lowerCAmelCase      =   self.remote_tool(_snake_case		)
									self.assertEqual(
									    _snake_case						,    """Hugging Face was founded in 2016 by French entrepreneurs Clément Delangue, Julien Chaumond, and Thomas Wolf. In March 2021, Hugging Face raised $40 million in a Series B funding round. On April 28, 2021, the company launched the BigScience Research Workshop in collaboration with several other research groups to release an open large language model. In 2022, the workshop concluded with the announcement of BLOOM."""						,    )




				def 							snake_case       (							self		):



									"""simple docstring"""





									_lowerCAmelCase      =   self.tool(text=_snake_case		)
									self.assertEqual(
									    _snake_case						,    """Hugging Face was founded in 2016 by French entrepreneurs Clément Delangue, Julien Chaumond, and Thomas Wolf. In March 2021, Hugging Face raised $40 million in a Series B funding round. On April 28, 2021, the company launched the BigScience Research Workshop in collaboration with several other research groups to release an open large language model. In 2022, the workshop concluded with the announcement of BLOOM."""						,    )




				def 							snake_case       (							self		):



									"""simple docstring"""





									_lowerCAmelCase      =   self.remote_tool(text=_snake_case		)
									self.assertEqual(
									    _snake_case						,    """Hugging Face was founded in 2016 by French entrepreneurs Clément Delangue, Julien Chaumond, and Thomas Wolf. In March 2021, Hugging Face raised $40 million in a Series B funding round. On April 28, 2021, the company launched the BigScience Research Workshop in collaboration with several other research groups to release an open large language model. In 2022, the workshop concluded with the announcement of BLOOM."""						,    )








from urllib.error import HTTPError

from bsa import BeautifulSoup
from requests import exceptions, get

A__     				=	"""https://www.wellrx.com/prescriptions/{0}/{1}/?freshSearch=true"""


def 		_UpperCAmelCase    (				snake_case     ,						snake_case      ):





					"""simple docstring"""

					try:
										# Has user provided both inputs?
										if not drug_name or not zip_code:
															return None

										_lowerCAmelCase      =   BASE_URL.format(snake_case     ,						snake_case      )
										_lowerCAmelCase      =   get(snake_case      )

										# Is the response ok?
										response.raise_for_status()

										# Scrape the data using bs4
										_lowerCAmelCase      =   BeautifulSoup(response.text     ,						"""html.parser"""      )

										# This list will store the name and price.
										_lowerCAmelCase      =   []

										# Fetch all the grids that contains the items.
										_lowerCAmelCase      =   soup.find_all("""div"""     ,						{"""class""": """grid-x pharmCard"""}      )
										if grid_list and len(snake_case      ) > 0:
															for grid in grid_list:
																				# Get the pharmacy price.
																				_lowerCAmelCase      =   grid.find("""p"""     ,						{"""class""": """list-title"""}      ).text

																				# Get price of the drug.
																				_lowerCAmelCase      =   grid.find("""span"""     ,						{"""p""", """price price-large"""}      ).text

																				pharmacy_price_list.append(
																				    {
																				        """pharmacy_name""": pharmacy_name,
																				        """price""": price,
																				    }      )

										return pharmacy_price_list

					except (HTTPError, exceptions.RequestException, ValueError):
										return None


if __name__ == "__main__":
	# Enter a drug name and a zip code
	A__     				=	input("""Enter drug name: """).strip()
	A__     				=	input("""Enter zip code: """).strip()

	A__     				=	fetch_pharmacy_and_price_list(
	    drug_name, zip_code
	)

	if pharmacy_price_list:
		print(f"\nSearch results for {drug_name} at location {zip_code}:")
		for pharmacy_price in pharmacy_price_list:
			A__     				=	pharmacy_price["""pharmacy_name"""]
			A__     				=	pharmacy_price["""price"""]

			print(f"Pharmacy: {name} Price: {price}")
	else:
		print(f"No results found for {drug_name}")



