




'''simple docstring'''



from collections import OrderedDict
from typing import Mapping

from packaging import version

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


UpperCAmelCase_       :  Optional[int]      =		logging.get_logger(__name__)

UpperCAmelCase_       :  Tuple      =		{
    'facebook/convnext-tiny-224': 'https://huggingface.co/facebook/convnext-tiny-224/resolve/main/config.json',
    # See all ConvNeXT models at https://huggingface.co/models?filter=convnext
}





class     lowerCAmelCase   ( UpperCAmelCase_				,   UpperCAmelCase_):
       __lowercase  :      List[str]        =			'''convnext'''


       def __init__(   self    ,  __SCREAMING_SNAKE_CASE=3    ,  __SCREAMING_SNAKE_CASE=4    ,  __SCREAMING_SNAKE_CASE=4    ,  __SCREAMING_SNAKE_CASE=None    ,  __SCREAMING_SNAKE_CASE=None    ,  __SCREAMING_SNAKE_CASE="gelu"    ,  __SCREAMING_SNAKE_CASE=0.02    ,  __SCREAMING_SNAKE_CASE=1E-12    ,  __SCREAMING_SNAKE_CASE=1E-6    ,  __SCREAMING_SNAKE_CASE=0.0    ,  __SCREAMING_SNAKE_CASE=224    ,  __SCREAMING_SNAKE_CASE=None    ,  __SCREAMING_SNAKE_CASE=None    ,  **__SCREAMING_SNAKE_CASE    ,  )      ->  Union[str, Any]:



            '''simple docstring'''




            super().__init__(**__UpperCamelCase  )

            __snake_case    					=  num_channels
            __snake_case    					=  patch_size
            __snake_case    					=  num_stages
            __snake_case    					=  [96, 192, 384, 768] if hidden_sizes is None else hidden_sizes
            __snake_case    					=  [3, 3, 9, 3] if depths is None else depths
            __snake_case    					=  hidden_act
            __snake_case    					=  initializer_range
            __snake_case    					=  layer_norm_eps
            __snake_case    					=  layer_scale_init_value
            __snake_case    					=  drop_path_rate
            __snake_case    					=  image_size
            __snake_case    					=  ['''stem'''] + [F'''stage{idx}''' for idx in range(1    ,  len(self.depths  ) + 1  )]
            __snake_case					,    __snake_case    					=  get_aligned_output_features_output_indices(
                out_features=__UpperCamelCase    ,  out_indices=__UpperCamelCase    ,  stage_names=self.stage_names  )





class     lowerCAmelCase   ( UpperCAmelCase_):
       __lowercase  :      str        =			version.parse('''1.11''')


       @property
       def       lowerCAmelCase      (   self  )      ->  List[Any]:



            '''simple docstring'''




            return OrderedDict(
                [
                    ('''pixel_values''', {0: '''batch''', 1: '''num_channels''', 2: '''height''', 3: '''width'''}),
                ]  )




       @property
       def       lowerCAmelCase      (   self  )      ->  Optional[int]:



            '''simple docstring'''




            return 1E-5





'''simple docstring'''



from datetime import date

import requests

UpperCAmelCase_       :  str      =		'''https://api.carbonintensity.org.uk/intensity'''







def 			_UpperCamelCase ()->   str:




     '''simple docstring'''





     __snake_case    					=  requests.get(_lowerCamelCase	).json()['''data'''][0]
     return last_half_hour["intensity"]["actual"]







def 			_UpperCamelCase (_lowerCamelCase							:     Dict   ,	_lowerCamelCase							:     List[Any]	)->   list:




     '''simple docstring'''





     return requests.get(f'''{BASE_URL}/{start}/{end}'''	).json()["data"]


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






