

'''simple docstring'''



from manim import *

class       SCREAMING_SNAKE_CASE       (				UpperCAmelCase__       ):






      '''simple docstring'''






      def 						__UpperCAmelCase      (       self			:		List[str] ):



          """simple docstring"""





          _snake_case			:			Any				       =		Rectangle(height=0.5  ,       width=0.5 )
          _snake_case			:			int				       =		Rectangle(height=0.25  ,       width=0.25 )
          _snake_case			:			Dict				       =		Rectangle(height=0.46  ,       width=0.46 ).set_stroke(width=0 )

          _snake_case			:			Optional[Any]				       =		[mem.copy() for i in range(6 )]
          _snake_case			:			List[Any]				       =		[mem.copy() for i in range(6 )]
          _snake_case			:			Any				       =		VGroup(*UpperCAmelCase__ ).arrange(UpperCAmelCase__  ,       buff=0 )
          _snake_case			:			str				       =		VGroup(*UpperCAmelCase__ ).arrange(UpperCAmelCase__  ,       buff=0 )
          _snake_case			:			Optional[int]				       =		VGroup(UpperCAmelCase__  ,       UpperCAmelCase__ ).arrange(UpperCAmelCase__  ,       buff=0 )
          _snake_case			:			int				       =		Text('CPU'  ,       font_size=24 )
          _snake_case			:			List[Any]				       =		Group(UpperCAmelCase__  ,       UpperCAmelCase__ ).arrange(UpperCAmelCase__  ,       buff=0.5  ,       aligned_edge=UpperCAmelCase__ )
          cpu.move_to([-2.5, -0.5, 0] )
          self.add(UpperCAmelCase__ )

          _snake_case			:			str				       =		[mem.copy() for i in range(4 )]
          _snake_case			:			Any				       =		VGroup(*UpperCAmelCase__ ).arrange(UpperCAmelCase__  ,       buff=0 )
          _snake_case			:			int				       =		Text('GPU'  ,       font_size=24 )
          _snake_case			:			Dict				       =		Group(UpperCAmelCase__  ,       UpperCAmelCase__ ).arrange(UpperCAmelCase__  ,       buff=0.5  ,       aligned_edge=UpperCAmelCase__ )
          gpu.move_to([-1, -1, 0] )
          self.add(UpperCAmelCase__ )

          _snake_case			:			List[str]				       =		[mem.copy() for i in range(6 )]
          _snake_case			:			str				       =		VGroup(*UpperCAmelCase__ ).arrange(UpperCAmelCase__  ,       buff=0 )

          _snake_case			:			str				       =		Text('Model'  ,       font_size=24 )
          _snake_case			:			Optional[Any]				       =		Group(UpperCAmelCase__  ,       UpperCAmelCase__ ).arrange(UpperCAmelCase__  ,       buff=0.5  ,       aligned_edge=UpperCAmelCase__ )
          model.move_to([3, -1.0, 0] )
          self.add(UpperCAmelCase__ )

          _snake_case			:			Any				       =		[]
          _snake_case			:			List[str]				       =		[]
          _snake_case			:			Optional[Any]				       =		[]

          for i, rect in enumerate(UpperCAmelCase__ ):
              rect.set_stroke(UpperCAmelCase__ )

              _snake_case			:			Union[str, Any]				       =		Rectangle(height=0.46 / 4  ,       width=0.46 / 3 ).set_stroke(width=0.0 ).set_fill(UpperCAmelCase__  ,       opacity=0.7 )

              if i == 0:
                  cpu_target.next_to(cpu_left_col_base[0].get_corner(DOWN + LEFT )  ,       buff=0.02  ,       direction=UpperCAmelCase__ )
                  cpu_target.set_x(cpu_target.get_x() + 0.1 )
              elif i == 3:
                  cpu_target.next_to(model_cpu_arr[0]  ,       direction=UpperCAmelCase__  ,       buff=0.0 )
              else:
                  cpu_target.next_to(model_cpu_arr[i - 1]  ,       direction=UpperCAmelCase__  ,       buff=0.0 )
              self.add(UpperCAmelCase__ )
              model_cpu_arr.append(UpperCAmelCase__ )

          self.add(*UpperCAmelCase__  ,       *UpperCAmelCase__  ,       *UpperCAmelCase__ )

          _snake_case			:			Tuple				       =		[mem.copy() for i in range(6 )]
          _snake_case			:			Union[str, Any]				       =		VGroup(*UpperCAmelCase__ ).arrange(UpperCAmelCase__  ,       buff=0 )

          _snake_case			:			List[str]				       =		Text('Loaded Checkpoint'  ,       font_size=24 )
          _snake_case			:			int				       =		Group(UpperCAmelCase__  ,       UpperCAmelCase__ ).arrange(UpperCAmelCase__  ,       buff=0.5  ,       aligned_edge=UpperCAmelCase__ )
          checkpoint.move_to([3, 0.5, 0] )

          self.add(UpperCAmelCase__ )

          _snake_case			:			Union[str, Any]				       =		[]
          _snake_case			:			Optional[int]				       =		[]

          for i, rect in enumerate(UpperCAmelCase__ ):
              _snake_case			:			Any				       =		fill.copy().set_fill(UpperCAmelCase__  ,       opacity=0.7 )
              target.move_to(UpperCAmelCase__ )
              ckpt_arr.append(UpperCAmelCase__ )

              _snake_case			:			Optional[Any]				       =		target.copy()
              if i < 5:
                  cpu_target.move_to(cpu_left_col_base[i + 1] )
              else:
                  cpu_target.move_to(cpu_right_col_base[i - 5] )
              ckpt_cpu_arr.append(UpperCAmelCase__ )
          self.add(*UpperCAmelCase__  ,       *UpperCAmelCase__ )

          _snake_case			:			Tuple				       =		Square(side_length=2.2 )
          key.move_to([-5, 2, 0] )

          _snake_case			:			Optional[int]				       =		MarkupText(
              F"""<b>Key:</b>\n\n<span fgcolor='{YELLOW}'>●</span> Empty Model"""  ,       font_size=18  ,       )

          key_text.move_to([-5, 2.4, 0] )

          self.add(UpperCAmelCase__  ,       UpperCAmelCase__ )

          _snake_case			:			int				       =		MarkupText(
              F"""<span fgcolor='{BLUE}'>●</span> Checkpoint"""  ,       font_size=18  ,       )

          blue_text.next_to(UpperCAmelCase__  ,       DOWN * 2.4  ,       aligned_edge=key_text.get_left() )
          self.add(UpperCAmelCase__ )

          _snake_case			:			List[str]				       =		MarkupText(
              F"""Based on the passed in configuration, weights are stored in\na variety of np.memmaps on disk or to a particular device."""  ,       font_size=24  ,       )
          step_a.move_to([2, 2, 0] )

          _snake_case			:			str				       =		[meta_mem.copy() for i in range(6 )]
          _snake_case			:			List[str]				       =		[meta_mem.copy() for i in range(6 )]
          _snake_case			:			Tuple				       =		VGroup(*UpperCAmelCase__ ).arrange(UpperCAmelCase__  ,       buff=0 )
          _snake_case			:			Any				       =		VGroup(*UpperCAmelCase__ ).arrange(UpperCAmelCase__  ,       buff=0 )
          _snake_case			:			Any				       =		VGroup(UpperCAmelCase__  ,       UpperCAmelCase__ ).arrange(UpperCAmelCase__  ,       buff=0 )
          _snake_case			:			Union[str, Any]				       =		Text('Disk'  ,       font_size=24 )
          _snake_case			:			List[str]				       =		Group(UpperCAmelCase__  ,       UpperCAmelCase__ ).arrange(UpperCAmelCase__  ,       buff=0.5  ,       aligned_edge=UpperCAmelCase__ )
          disk.move_to([-4.0, -1.25, 0] )
          self.play(Write(UpperCAmelCase__  ,       run_time=3 )  ,       Write(UpperCAmelCase__  ,       run_time=1 )  ,       Create(UpperCAmelCase__  ,       run_time=1 ) )

          _snake_case			:			str				       =		[]
          for i, rect in enumerate(UpperCAmelCase__ ):
              _snake_case			:			str				       =		rect.copy()
              target.generate_target()
              target.target.move_to(disk_left_col_base[i] ).scale(0.5 )
              animations.append(MoveToTarget(UpperCAmelCase__  ,       run_time=1.5 ) )
          self.play(*UpperCAmelCase__ )

          self.play(FadeOut(UpperCAmelCase__ ) )

          _snake_case			:			Any				       =		MarkupText(F"""Then, the checkpoint is removed from memory\nthrough garbage collection."""  ,       font_size=24 )
          step_a.move_to([2, 2, 0] )

          self.play(Write(UpperCAmelCase__  ,       run_time=3 ) )

          self.play(
              FadeOut(UpperCAmelCase__  ,       UpperCAmelCase__  ,       *UpperCAmelCase__  ,       *UpperCAmelCase__ )  ,       )

          self.wait()









from __future__ import annotations

import requests







def SCREAMING_SNAKE_CASE							(			lowercase_		)  ->			dict:



       """simple docstring"""

       A__ 					=       f"""https://hacker-news.firebaseio.com/v0/item/{story_id}.json?print=pretty"""
       return requests.get(lowercase_		).json()







def SCREAMING_SNAKE_CASE							(			lowercase_ = 10		)  ->			list[dict]:



       """simple docstring"""

       A__ 					=       '''https://hacker-news.firebaseio.com/v0/topstories.json?print=pretty'''
       A__ 					=       requests.get(lowercase_		).json()[:max_stories]
       return [get_hackernews_story(lowercase_		) for story_id in story_ids]







def SCREAMING_SNAKE_CASE							(			lowercase_ = 10		)  ->			str:



       """simple docstring"""

       A__ 					=       hackernews_top_stories(lowercase_		)
       return "\n".join('''* [{title}]({url})'''.format(**lowercase_		) for story in stories		)


if __name__ == "__main__":
  print(hackernews_top_stories_as_markdown())


