





from manim import *





class 							lowercase__    (							__UpperCAmelCase  ):







  def 	UpperCAmelCase__		(	self						):
       lowerCAmelCase_					:       Dict    =		Rectangle(height=0.5    ,						width=0.5						)
       lowerCAmelCase_					:       Dict    =		Rectangle(height=0.46    ,						width=0.46						).set_stroke(width=0						)

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

       lowerCAmelCase_					:       str    =		[mem.copy() for i in range(1						)]
       lowerCAmelCase_					:       Optional[int]    =		VGroup(*_lowercase						).arrange(_lowercase    ,						buff=0						)
       lowerCAmelCase_					:       Union[str, Any]    =		Text("""GPU"""    ,						font_size=24						)
       lowerCAmelCase_					:       Union[str, Any]    =		Group(_lowercase    ,						_lowercase						).arrange(_lowercase    ,						buff=0.5    ,						aligned_edge=_lowercase						)
       gpu.align_to(_lowercase    ,						_lowercase						)
       gpu.set_x(gpu.get_x() - 1						)

       self.add(_lowercase						)

       lowerCAmelCase_					:       Optional[int]    =		[mem.copy() for i in range(6						)]
       lowerCAmelCase_					:       Dict    =		VGroup(*_lowercase						).arrange(_lowercase    ,						buff=0						)

       lowerCAmelCase_					:       Optional[int]    =		Text("""Model"""    ,						font_size=24						)
       lowerCAmelCase_					:       str    =		Group(_lowercase    ,						_lowercase						).arrange(_lowercase    ,						buff=0.5    ,						aligned_edge=_lowercase						)
       model.move_to([3, -1.0, 0]						)

       self.play(
           Create(_lowercase    ,						run_time=1						)    ,						Create(_lowercase    ,						run_time=1						)    ,						Create(_lowercase    ,						run_time=1						)    ,						)

       lowerCAmelCase_					:       Tuple    =		MarkupText(
           F'First, an empty model skeleton is loaded\ninto <span fgcolor=\'{YELLOW}\'>memory</span> without using much RAM.'    ,						font_size=24    ,						)

       lowerCAmelCase_					:       List[Any]    =		Square(side_length=2.2						)
       key.move_to([-5, 2, 0]						)

       lowerCAmelCase_					:       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]						)

       step_a.move_to([2, 2, 0]						)
       self.play(Write(_lowercase    ,						run_time=2.5						)    ,						Write(_lowercase						)    ,						Write(_lowercase						)						)

       self.add(_lowercase						)

       lowerCAmelCase_					:       Optional[Any]    =		[]
       lowerCAmelCase_					:       int    =		[]
       lowerCAmelCase_					:       Optional[Any]    =		[]
       for i, rect in enumerate(_lowercase						):
            lowerCAmelCase_					:       Tuple    =		Rectangle(height=0.46    ,						width=0.46						).set_stroke(width=0.0						).set_fill(_lowercase    ,						opacity=0.7						)
            cpu_target.move_to(_lowercase						)
            cpu_target.generate_target()
            lowerCAmelCase_					:       Optional[int]    =		0.46 / 4
            lowerCAmelCase_					:       List[Any]    =		0.46 / 3

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

            first_animations.append(rect.animate(run_time=0.5						).set_stroke(_lowercase						)						)
            second_animations.append(MoveToTarget(_lowercase    ,						run_time=1.5						)						)

       self.play(*_lowercase						)
       self.play(*_lowercase						)

       self.wait()







from collections import namedtuple

UpperCAmelCase_					:   Union[str, Any] 							=						namedtuple("""from_to""", """from_ to""")

UpperCAmelCase_					:   int 							=						{
    """cubicmeter""": from_to(1, 1),
    """litre""": from_to(0.0_01, 10_00),
    """kilolitre""": from_to(1, 1),
    """gallon""": from_to(0.0_04_54, 2_64.1_72),
    """cubicyard""": from_to(0.7_64_55, 1.3_07_95),
    """cubicfoot""": from_to(0.0_28, 35.31_47),
    """cup""": from_to(0.0_00_23_65_88, 42_26.75),
}






def 							_lowerCAmelCase (  _a   :					float					,   _a   :					str					,   _a   :					str			)	->			float:
     if from_type not in METRIC_CONVERSION:
          raise ValueError(
              F'Invalid \'from_type\' value: {from_type!r}  Supported values are:\n'
              + """, """.join(_a			)			)
     if to_type not in METRIC_CONVERSION:
          raise ValueError(
              F'Invalid \'to_type\' value: {to_type!r}.  Supported values are:\n'
              + """, """.join(_a			)			)
     return value * METRIC_CONVERSION[from_type].from_ * METRIC_CONVERSION[to_type].to


if __name__ == "__main__":
      import doctest

      doctest.testmod()
