

"""simple docstring"""




from __future__ import annotations

from collections import deque
from queue import Queue
from timeit import timeit

__A     :    Optional[Any]    =		{
    'A': ['B', 'C'],
    'B': ['A', 'D', 'E'],
    'C': ['A', 'F'],
    'D': ['B'],
    'E': ['B', 'F'],
    'F': ['C', 'E'],
}
def    __SCREAMING_SNAKE_CASE						(						lowercase__			,							lowercase__      ):
					"""simple docstring"""
					A			=					{start}
					A			=					[start]
					A			=					Queue()
					queue.put(lowercase__      )
					while not queue.empty():
										A			=					queue.get()
										for w in graph[v]:
															if w not in explored:
																				explored.add(lowercase__      )
																				result.append(lowercase__      )
																				queue.put(lowercase__      )
					return result
def    __SCREAMING_SNAKE_CASE						(						lowercase__			,							lowercase__      ):
					"""simple docstring"""
					A			=					{start}
					A			=					[start]
					A			=					deque([start]      )
					while queue:
										A			=					queue.popleft()
										for child in graph[v]:
															if child not in visited:
																				visited.add(lowercase__      )
																				result.append(lowercase__      )
																				queue.append(lowercase__      )
					return result
def    __SCREAMING_SNAKE_CASE						(						lowercase__      ):
					"""simple docstring"""
					A			=					F"""from __main__ import G, {name}"""
					A			=					10_000
					A			=					timeit(F"""{name}(G, 'A')"""			,							setup=lowercase__			,							number=lowercase__      )
					print(F"""{name:<35} finished {number} runs in {res:.5f} seconds"""      )


if __name__ == "__main__":
	import doctest

	doctest.testmod()

	benchmark_function('breadth_first_search')
	benchmark_function('breadth_first_search_with_deque')
	# breadth_first_search                finished 10000 runs in 0.20999 seconds
	# breadth_first_search_with_deque     finished 10000 runs in 0.01421 seconds













"""simple docstring"""







from urllib.error import HTTPError

from bsa import BeautifulSoup
from requests import exceptions, get

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

def _a (		_snake_case      ,       _snake_case							):







      """simple docstring"""






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

            UpperCAmelCase							=       BASE_URL.format(_snake_case      ,       _snake_case							)
            UpperCAmelCase							=       get(_snake_case							)

            # Is the response ok?
            response.raise_for_status()

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

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

            # Fetch all the grids that contains the items.
            UpperCAmelCase							=       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.
                        UpperCAmelCase							=       grid.find("""p"""      ,       {"""class""": """list-title"""}							).text

                        # Get price of the drug.
                        UpperCAmelCase							=       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
  _UpperCamelCase     			=  input("""Enter drug name: """).strip()
  _UpperCamelCase     			=  input("""Enter zip code: """).strip()

  _UpperCamelCase     			=  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:
      _UpperCamelCase     			=  pharmacy_price["""pharmacy_name"""]
      _UpperCamelCase     			=  pharmacy_price["""price"""]

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



