






from __future__ import annotations

from enum import Enum, unique
from typing import TypeVar

# Create a generic variable that can be 'Enum', or any subclass.
A_	:	Optional[Any]				=				TypeVar('T', bound='Enum')




@unique
class        _lowerCAmelCase( a__      ):





							"""simple docstring"""







							a       :	Dict								=80
							a       :	Tuple								=70
							a       :	Tuple								=60
							a       :	str								=50
							a       :	List[Any]								=40
							a       :	Optional[int]								=30
							a       :	str								=20
							a       :	List[str]								=10







@unique
class        _lowerCAmelCase( a__      ):





							"""simple docstring"""







							a       :	Union[str, Any]								=24
							a       :	Optional[Any]								=21
							a       :	Any								=18
							a       :	Optional[int]								=15
							a       :	Optional[int]								=12
							a       :	Dict								=9
							a       :	Union[str, Any]								=6
							a       :	int								=3
							a       :	Optional[int]								=2
							a       :	int								=1
							a       :	Optional[int]								=-1
							a       :	Optional[Any]								=-2
							a       :	Tuple								=-3
							a       :	Union[str, Any]								=-6
							a       :	Union[str, Any]								=-9
							a       :	str								=-12
							a       :	Tuple								=-15
							a       :	Dict								=-18
							a       :	Union[str, Any]								=-21
							a       :	Union[str, Any]								=-24





							@classmethod
							def     _a					(      cls							):
									return {unit.name: unit.value for unit in cls if unit.value > 0}





							@classmethod
							def     _a					(      cls							):
									return {unit.name: unit.value for unit in cls if unit.value < 0}







def 						snake_case      (UpperCAmelCase__						) ->       str:
		UpperCamelCase_:      str					   =       SIUnit.get_positive() if value > 0 else SIUnit.get_negative()
		for name_prefix, value_prefix in prefixes.items():
				UpperCamelCase_:      Optional[Any]					   =       value / (1_0**value_prefix)
				if numerical_part > 1:
						return F'''{numerical_part!s} {name_prefix}'''
		return str(UpperCAmelCase__						)

def 						snake_case      (UpperCAmelCase__						) ->       str:

		for prefix in BinaryUnit:
				UpperCamelCase_:      List[str]					   =       value / (2**prefix.value)
				if numerical_part > 1:
						return F'''{numerical_part!s} {prefix.name}'''
		return str(UpperCAmelCase__						)


if __name__ == "__main__":
			import doctest

			doctest.testmod()







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() = }''')