



from manim import *

class     _A       (	UpperCAmelCase__    ):



       def 		_lowerCamelCase			(		self							:     Tuple):


           '''simple docstring'''

           __a						       =				Rectangle(height=0.5     ,		width=0.5)
           __a						       =				Rectangle(height=0.25     ,		width=0.25)
           __a						       =				Rectangle(height=0.46     ,		width=0.46).set_stroke(width=0)

           __a						       =				[mem.copy() for i in range(6)]
           __a						       =				[mem.copy() for i in range(6)]
           __a						       =				VGroup(*lowerCamelCase__).arrange(lowerCamelCase__     ,		buff=0)
           __a						       =				VGroup(*lowerCamelCase__).arrange(lowerCamelCase__     ,		buff=0)
           __a						       =				VGroup(lowerCamelCase__     ,		lowerCamelCase__).arrange(lowerCamelCase__     ,		buff=0)
           __a						       =				Text('''CPU'''     ,		font_size=24)
           __a						       =				Group(lowerCamelCase__     ,		lowerCamelCase__).arrange(lowerCamelCase__     ,		buff=0.5     ,		aligned_edge=lowerCamelCase__)
           cpu.move_to([-2.5, -0.5, 0])
           self.add(lowerCamelCase__)

           __a						       =				[mem.copy() for i in range(4)]
           __a						       =				VGroup(*lowerCamelCase__).arrange(lowerCamelCase__     ,		buff=0)
           __a						       =				Text('''GPU'''     ,		font_size=24)
           __a						       =				Group(lowerCamelCase__     ,		lowerCamelCase__).arrange(lowerCamelCase__     ,		buff=0.5     ,		aligned_edge=lowerCamelCase__)
           gpu.move_to([-1, -1, 0])
           self.add(lowerCamelCase__)

           __a						       =				[mem.copy() for i in range(6)]
           __a						       =				VGroup(*lowerCamelCase__).arrange(lowerCamelCase__     ,		buff=0)

           __a						       =				Text('''Model'''     ,		font_size=24)
           __a						       =				Group(lowerCamelCase__     ,		lowerCamelCase__).arrange(lowerCamelCase__     ,		buff=0.5     ,		aligned_edge=lowerCamelCase__)
           model.move_to([3, -1.0, 0])
           self.add(lowerCamelCase__)

           __a						       =				[]
           __a						       =				[]
           __a						       =				[]

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

               __a						       =				Rectangle(height=0.46 / 4     ,		width=0.46 / 3).set_stroke(width=0.0).set_fill(lowerCamelCase__     ,		opacity=0.7)

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

           self.add(*lowerCamelCase__     ,		*lowerCamelCase__     ,		*lowerCamelCase__)

           __a						       =				[mem.copy() for i in range(6)]
           __a						       =				VGroup(*lowerCamelCase__).arrange(lowerCamelCase__     ,		buff=0)

           __a						       =				Text('''Loaded Checkpoint'''     ,		font_size=24)
           __a						       =				Group(lowerCamelCase__     ,		lowerCamelCase__).arrange(lowerCamelCase__     ,		buff=0.5     ,		aligned_edge=lowerCamelCase__)
           checkpoint.move_to([3, 0.5, 0])

           self.add(lowerCamelCase__)

           __a						       =				[]
           __a						       =				[]

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

               __a						       =				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(lowerCamelCase__)
           self.add(*lowerCamelCase__     ,		*lowerCamelCase__)

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

           __a						       =				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(lowerCamelCase__     ,		lowerCamelCase__)

           __a						       =				MarkupText(
               F'<span fgcolor=\'{BLUE}\'>●</span> Checkpoint'     ,		font_size=18     ,		)

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

           __a						       =				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])

           __a						       =				[meta_mem.copy() for i in range(6)]
           __a						       =				[meta_mem.copy() for i in range(6)]
           __a						       =				VGroup(*lowerCamelCase__).arrange(lowerCamelCase__     ,		buff=0)
           __a						       =				VGroup(*lowerCamelCase__).arrange(lowerCamelCase__     ,		buff=0)
           __a						       =				VGroup(lowerCamelCase__     ,		lowerCamelCase__).arrange(lowerCamelCase__     ,		buff=0)
           __a						       =				Text('''Disk'''     ,		font_size=24)
           __a						       =				Group(lowerCamelCase__     ,		lowerCamelCase__).arrange(lowerCamelCase__     ,		buff=0.5     ,		aligned_edge=lowerCamelCase__)
           disk.move_to([-4.0, -1.25, 0])
           self.play(Write(lowerCamelCase__     ,		run_time=3)     ,		Write(lowerCamelCase__     ,		run_time=1)     ,		Create(lowerCamelCase__     ,		run_time=1))

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

           self.play(FadeOut(lowerCamelCase__))

           __a						       =				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(lowerCamelCase__     ,		run_time=3))

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

           self.wait()









'''simple docstring'''


from __future__ import annotations

import json

import requests
from bsa import BeautifulSoup
from fake_useragent import UserAgent

lowerCamelCase__					=   {'UserAgent': UserAgent().random}






def        __lowerCAmelCase       (__lowerCAmelCase      ):
		_UpperCAmelCase						:				List[str]	    =					script.contents[0]
		_UpperCAmelCase						:				Any	    =					json.loads(data[data.find("{\"config\""      ) : -1]      )
		return info["entry_data"]["ProfilePage"][0]["graphql"]["user"]






class 		lowerCAmelCase__	:




			def __init__(						self     :   str		,     lowerCamelCase__     :   List[Any]       )      ->List[str]:



					'''simple docstring'''







					_UpperCAmelCase						:				List[Any]	    =					F"""https://www.instagram.com/{username}/"""
					_UpperCAmelCase						:				Dict	    =					self.get_json()




			def 							lowerCAmelCase__			(						self     :   Any       )      ->dict:



					'''simple docstring'''







					_UpperCAmelCase						:				Optional[int]	    =					requests.get(self.url		,     headers=lowerCamelCase__       ).text
					_UpperCAmelCase						:				Any	    =					BeautifulSoup(lowerCamelCase__		,     "html.parser"       ).find_all("script"       )
					try:
							return extract_user_profile(scripts[4]       )
					except (json.decoder.JSONDecodeError, KeyError):
							return extract_user_profile(scripts[3]       )




			def __repr__(						self     :   Optional[Any]       )      ->str:



					'''simple docstring'''







					return F"""{self.__class__.__name__}('{self.username}')"""




			def __str__(						self     :   List[Any]       )      ->str:



					'''simple docstring'''







					return F"""{self.fullname} ({self.username}) is {self.biography}"""




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



					'''simple docstring'''







					return self.user_data["username"]




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



					'''simple docstring'''







					return self.user_data["full_name"]




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



					'''simple docstring'''







					return self.user_data["biography"]




			@property
			def 							lowerCAmelCase__			(						self     :   int       )      ->str:



					'''simple docstring'''







					return self.user_data["business_email"]




			@property
			def 							lowerCAmelCase__			(						self     :   str       )      ->str:



					'''simple docstring'''







					return self.user_data["external_url"]




			@property
			def 							lowerCAmelCase__			(						self     :   Tuple       )      ->int:



					'''simple docstring'''







					return self.user_data["edge_followed_by"]["count"]




			@property
			def 							lowerCAmelCase__			(						self     :   str       )      ->int:



					'''simple docstring'''







					return self.user_data["edge_follow"]["count"]




			@property
			def 							lowerCAmelCase__			(						self     :   Any       )      ->int:



					'''simple docstring'''







					return self.user_data["edge_owner_to_timeline_media"]["count"]




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



					'''simple docstring'''







					return self.user_data["profile_pic_url_hd"]




			@property
			def 							lowerCAmelCase__			(						self     :   Optional[Any]       )      ->bool:



					'''simple docstring'''







					return self.user_data["is_verified"]






			@property
			def 							lowerCAmelCase__			(						self     :   int       )      ->bool:



					'''simple docstring'''







					return self.user_data["is_private"]






def        __lowerCAmelCase       (__lowerCAmelCase = "github"      ):
		import os

		if os.environ.get("CI"      ):
				return  # test failing on GitHub Actions
		_UpperCAmelCase						:				Dict	    =					InstagramUser(__lowerCAmelCase      )
		assert instagram_user.user_data
		assert isinstance(instagram_user.user_data					,       __lowerCAmelCase      )
		assert instagram_user.username == username
		if username != "github":
				return
		assert instagram_user.fullname == "GitHub"
		assert instagram_user.biography == "Built for developers."
		assert instagram_user.number_of_posts > 150
		assert instagram_user.number_of_followers > 120_000
		assert instagram_user.number_of_followings > 15
		assert instagram_user.email == "support@github.com"
		assert instagram_user.website == "https://github.com/readme"
		assert instagram_user.profile_picture_url.startswith("https://instagram."      )
		assert instagram_user.is_verified is True
		assert instagram_user.is_private is False


if __name__ == "__main__":
						import doctest

						doctest.testmod()
						lowerCamelCase__					=   InstagramUser('github')
						print(instagram_user)
						print(F'''{instagram_user.number_of_posts = }''')
						print(F'''{instagram_user.number_of_followers = }''')
						print(F'''{instagram_user.number_of_followings = }''')
						print(F'''{instagram_user.email = }''')
						print(F'''{instagram_user.website = }''')
						print(F'''{instagram_user.profile_picture_url = }''')
						print(F'''{instagram_user.is_verified = }''')
						print(F'''{instagram_user.is_private = }''')



