


"""simple docstring"""


from datetime import date

import requests

a_											=			"https://api.carbonintensity.org.uk/intensity"






def    a__       ( )		->		str:
				_A         =	requests.get(__lowercase      ).json()["data"][0]
				return last_half_hour["intensity"]["actual"]






def    a__       ( __lowercase   ,	__lowercase      )		->		list:
				return requests.get(f"""{BASE_URL}/{start}/{end}"""      ).json()["data"]


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







from dataclasses import dataclass
from typing import Callable, Optional

import datasets




@dataclass
class 							a_ (						datasets.BuilderConfig		):


							'''simple docstring'''






							__a:	Optional[Callable]     =    None
							__a:	Optional[dict]     =    None
							__a:	Optional[datasets.Features]     =    None

							def      _lowercase       (		self   )					->					Optional[int]:
														'''simple docstring'''

														assert self.generator is not None, "generator must be specified"

														if self.gen_kwargs is None:
																					lowerCAmelCase_										=     {}




class 							a_ (						datasets.GeneratorBasedBuilder		):


							'''simple docstring'''






							__a:	Optional[Any]     =    GeneratorConfig

							def      _lowercase       (		self   )					->					Union[str, Any]:
														'''simple docstring'''

														return datasets.DatasetInfo(features=self.config.features   )

							def      _lowercase       (		self			,			lowercase_   )					->					Dict:
														'''simple docstring'''

														return [datasets.SplitGenerator(name=datasets.Split.TRAIN			,			gen_kwargs=self.config.gen_kwargs   )]






							def      _lowercase       (		self			,			**lowercase_   )					->					Union[str, Any]:
														'''simple docstring'''

														for idx, ex in enumerate(self.config.generator(**lowercase_   )   ):
																					yield idx, ex



