






from __future__ import annotations

from queue import Queue




class        _lowerCAmelCase:





       """simple docstring"""







       def __init__(      self							):
         UpperCamelCase_:      dict[int, list[int]]					   =       {}





       def     _a					(      self							):
         for i in self.vertices:
           print(_lowerCamelCase						,    ' : '						,    ' -> '.join([str(_lowerCamelCase							) for j in self.vertices[i]]							)							)





       def     _a					(      self						,    _lowerCamelCase						,    _lowerCamelCase							):
         if from_vertex in self.vertices:
           self.vertices[from_vertex].append(_lowerCamelCase							)
         else:
           UpperCamelCase_:      List[str]					   =       [to_vertex]





       def     _a					(      self						,    _lowerCamelCase							):
         UpperCamelCase_:      Any					   =       set()

         # create a first in first out queue to store all the vertices for BFS
         UpperCamelCase_:      Queue					   =       Queue()

         # mark the source node as visited and enqueue it
         visited.add(_lowerCamelCase							)
         queue.put(_lowerCamelCase							)

         while not queue.empty():
           UpperCamelCase_:      Any					   =       queue.get()

           # loop through all adjacent vertex and enqueue it if not yet visited
           for adjacent_vertex in self.vertices[vertex]:
             if adjacent_vertex not in visited:
               queue.put(_lowerCamelCase							)
               visited.add(_lowerCamelCase							)
         return visited


if __name__ == "__main__":
   from doctest import testmod

   testmod(verbose=True)

   A_	:	Union[str, Any]				=				Graph()
   g.add_edge(0, 1)
   g.add_edge(0, 2)
   g.add_edge(1, 2)
   g.add_edge(2, 0)
   g.add_edge(2, 3)
   g.add_edge(3, 3)

   g.print_graph()
   # 0  :  1 -> 2
   # 1  :  2
   # 2  :  0 -> 3
   # 3  :  3

   assert sorted(g.bfs(2)) == [0, 1, 2, 3]







from datetime import date

import requests

A_	:	Any				=				'https://api.carbonintensity.org.uk/intensity'

def 						snake_case      () ->       str:
  UpperCamelCase_:      Any					   =       requests.get(UpperCAmelCase__						).json()['data'][0]
  return last_half_hour["intensity"]["actual"]

def 						snake_case      (UpperCAmelCase__			,					UpperCAmelCase__						) ->       list:
  return requests.get(F'''{BASE_URL}/{start}/{end}'''						).json()["data"]


if __name__ == "__main__":
   for entry in fetch_from_to(start=date(2020, 10, 1), end=date(2020, 10, 3)):
      print('from {from} to {to}: {intensity[actual]}'.format(**entry))
   print(F'''{fetch_last_half_hour() = }''')