from __future__ import annotations

import json

import requests
from bsa import BeautifulSoup
from fake_useragent import UserAgent

lowerCAmelCase__     :   Any		=   {'UserAgent': UserAgent().random}
def  UpperCamelCase__						(				A__    )   ->					dict:
				snake_case__					:	Tuple												=      script.contents[0]
				snake_case__					:	int												=      json.loads(data[data.find('{"config"'    ) : -1]    )
				return info["entry_data"]["ProfilePage"][0]["graphql"]["user"]





class  __snake_case  :




					def __init__(   self    ,       __UpperCamelCase		)     ->  Optional[Any]:



									'''simple docstring'''







									snake_case__					:	Tuple												=      F"""https://www.instagram.com/{username}/"""
									snake_case__					:	Optional[Any]												=      self.get_json()




					def 			__a			(   self		)     ->  dict:



									'''simple docstring'''







									snake_case__					:	Any												=      requests.get(self.url    ,       headers=SCREAMING_SNAKE_CASE__		).text
									snake_case__					:	Dict												=      BeautifulSoup(SCREAMING_SNAKE_CASE__    ,       '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		)     ->  str:



									'''simple docstring'''







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




					def __str__(   self		)     ->  str:



									'''simple docstring'''







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




					@property
					def 			__a			(   self		)     ->  str:



									'''simple docstring'''







									return self.user_data["username"]




					@property
					def 			__a			(   self		)     ->  str:



									'''simple docstring'''







									return self.user_data["full_name"]




					@property
					def 			__a			(   self		)     ->  str:



									'''simple docstring'''







									return self.user_data["biography"]




					@property
					def 			__a			(   self		)     ->  str:



									'''simple docstring'''







									return self.user_data["business_email"]




					@property
					def 			__a			(   self		)     ->  str:



									'''simple docstring'''







									return self.user_data["external_url"]




					@property
					def 			__a			(   self		)     ->  int:



									'''simple docstring'''







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




					@property
					def 			__a			(   self		)     ->  int:



									'''simple docstring'''







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




					@property
					def 			__a			(   self		)     ->  int:



									'''simple docstring'''







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




					@property
					def 			__a			(   self		)     ->  str:



									'''simple docstring'''







									return self.user_data["profile_pic_url_hd"]




					@property
					def 			__a			(   self		)     ->  bool:



									'''simple docstring'''







									return self.user_data["is_verified"]




					@property
					def 			__a			(   self		)     ->  bool:



									'''simple docstring'''







									return self.user_data["is_private"]




def  UpperCamelCase__						(				A__ = "github"    )   ->					None:
				import os

				if os.environ.get('CI'    ):
								return  # test failing on GitHub Actions
				snake_case__					:	int												=      InstagramUser(__A    )
				assert instagram_user.user_data
				assert isinstance(instagram_user.user_data			, __A    )
				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 > 12_0000
				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__     :   Union[str, Any]		=   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 = }''')






import flax.linen as nn
import jax
import jax.numpy as jnp
class  SCREAMING_SNAKE_CASE__  (				nn.Module			):
      snake_case__				:     int
      snake_case__				:     jnp.dtype        =						jnp.floataa
      def        SCREAMING_SNAKE_CASE							(       self				:       str     )		->			int:
             a_					:		Dict							=  nn.Conv(
                 self.out_channels     ,							kernel_size=(3, 3)     ,							strides=(1, 1)     ,							padding=((1, 1), (1, 1))     ,							dtype=self.dtype     ,							)

      def __call__(       self				:       Tuple     ,							SCREAMING_SNAKE_CASE__				:       Optional[Any]     )		->			Optional[int]:
             a_							,		a_							,		a_							,		a_					:		Union[str, Any]							=  hidden_states.shape
             a_					:		List[str]							=  jax.image.resize(
                 SCREAMING_SNAKE_CASE__     ,							shape=(batch, height * 2, width * 2, channels)     ,							method='nearest'     ,							)
             a_					:		Any							=  self.conv(SCREAMING_SNAKE_CASE__     )
             return hidden_states
class  SCREAMING_SNAKE_CASE__  (				nn.Module			):
      snake_case__				:     int
      snake_case__				:     jnp.dtype        =						jnp.floataa
      def        SCREAMING_SNAKE_CASE							(       self				:       List[str]     )		->			Optional[int]:
             a_					:		Optional[int]							=  nn.Conv(
                 self.out_channels     ,							kernel_size=(3, 3)     ,							strides=(2, 2)     ,							padding=((1, 1), (1, 1))     ,							dtype=self.dtype     ,							)

      def __call__(       self				:       Any     ,							SCREAMING_SNAKE_CASE__				:       int     )		->			Optional[int]:
             # pad = ((0, 0), (0, 1), (0, 1), (0, 0))  # pad height and width dim
             # hidden_states = jnp.pad(hidden_states, pad_width=pad)
             a_					:		str							=  self.conv(SCREAMING_SNAKE_CASE__     )
             return hidden_states
class  SCREAMING_SNAKE_CASE__  (				nn.Module			):
      snake_case__				:     int
      snake_case__				:     int        =						None
      snake_case__				:     float        =						0.0
      snake_case__				:     bool        =						None
      snake_case__				:     jnp.dtype        =						jnp.floataa
      def        SCREAMING_SNAKE_CASE							(       self				:       Tuple     )		->			Dict:
             a_					:		List[str]							=  self.in_channels if self.out_channels is None else self.out_channels

             a_					:		Optional[int]							=  nn.GroupNorm(num_groups=3_2     ,							epsilon=1E-5     )
             a_					:		Any							=  nn.Conv(
                 SCREAMING_SNAKE_CASE__     ,							kernel_size=(3, 3)     ,							strides=(1, 1)     ,							padding=((1, 1), (1, 1))     ,							dtype=self.dtype     ,							)

             a_					:		Optional[int]							=  nn.Dense(SCREAMING_SNAKE_CASE__     ,							dtype=self.dtype     )

             a_					:		Union[str, Any]							=  nn.GroupNorm(num_groups=3_2     ,							epsilon=1E-5     )
             a_					:		int							=  nn.Dropout(self.dropout_prob     )
             a_					:		Optional[Any]							=  nn.Conv(
                 SCREAMING_SNAKE_CASE__     ,							kernel_size=(3, 3)     ,							strides=(1, 1)     ,							padding=((1, 1), (1, 1))     ,							dtype=self.dtype     ,							)

             a_					:		List[str]							=  self.in_channels != out_channels if self.use_nin_shortcut is None else self.use_nin_shortcut

             a_					:		List[Any]							=  None
             if use_nin_shortcut:
                    a_					:		Union[str, Any]							=  nn.Conv(
                        SCREAMING_SNAKE_CASE__     ,							kernel_size=(1, 1)     ,							strides=(1, 1)     ,							padding='VALID'     ,							dtype=self.dtype     ,							)

      def __call__(       self				:       Optional[Any]     ,							SCREAMING_SNAKE_CASE__				:       List[Any]     ,							SCREAMING_SNAKE_CASE__				:       int     ,							SCREAMING_SNAKE_CASE__				:       List[Any]=True     )		->			int:
             a_					:		List[Any]							=  hidden_states
             a_					:		Any							=  self.norma(SCREAMING_SNAKE_CASE__     )
             a_					:		Any							=  nn.swish(SCREAMING_SNAKE_CASE__     )
             a_					:		Union[str, Any]							=  self.conva(SCREAMING_SNAKE_CASE__     )

             a_					:		int							=  self.time_emb_proj(nn.swish(SCREAMING_SNAKE_CASE__     )     )
             a_					:		List[str]							=  jnp.expand_dims(jnp.expand_dims(SCREAMING_SNAKE_CASE__     ,							1     )     ,							1     )
             a_					:		Optional[int]							=  hidden_states + temb

             a_					:		List[str]							=  self.norma(SCREAMING_SNAKE_CASE__     )
             a_					:		Tuple							=  nn.swish(SCREAMING_SNAKE_CASE__     )
             a_					:		Optional[int]							=  self.dropout(SCREAMING_SNAKE_CASE__     ,							SCREAMING_SNAKE_CASE__     )
             a_					:		List[Any]							=  self.conva(SCREAMING_SNAKE_CASE__     )

             if self.conv_shortcut is not None:
                    a_					:		List[str]							=  self.conv_shortcut(SCREAMING_SNAKE_CASE__     )

             return hidden_states + residual


