

from __future__ import annotations

import json

import requests
from bsa import BeautifulSoup
from fake_useragent import UserAgent

lowercase_             =     {'UserAgent': UserAgent().random}
def   a   (    A__			:     Any  )					->   Optional[Any]:





      """simple docstring"""



      _lowercase			 =script.contents[0]
      _lowercase			 =json.loads(data[data.find('{\"config\"'  ) : -1]  )
      return info["entry_data"]["ProfilePage"][0]["graphql"]["user"]





class 				__lowerCAmelCase  :




  def __init__(       self							,     lowerCAmelCase      )						->				Any:
        '''simple docstring'''






        _lowercase			 =F'''https://www.instagram.com/{username}/'''
        _lowercase			 =self.get_json()




  def 						A__  (       self      )						->				dict:
        '''simple docstring'''






        _lowercase			 =requests.get(self.url							,     headers=lowerCAmelCase__      ).text
        _lowercase			 =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      )						->				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   a   (    A__			:     Optional[int] = "github"  )					->   Optional[int]:





      """simple docstring"""



      import os

      if os.environ.get('CI'  ):
            return  # test failing on GitHub Actions
      _lowercase			 =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 > 120000
      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()
  lowercase_             =     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 = }")





from __future__ import annotations

from typing import Any





class 				__lowerCAmelCase  :




  def __init__(       self							,     lowerCAmelCase      )						->				None:
        '''simple docstring'''






        _lowercase			 =num_of_nodes
        _lowercase			 =[]
        _lowercase			 ={}




  def 						A__  (       self							,     lowerCAmelCase							,     lowerCAmelCase							,     lowerCAmelCase      )						->				None:
        '''simple docstring'''






        self.m_edges.append([u_node, v_node, weight]      )




  def 						A__  (       self							,     lowerCAmelCase      )						->				int:
        '''simple docstring'''






        if self.m_component[u_node] == u_node:
              return u_node
        return self.find_component(self.m_component[u_node]      )




  def 						A__  (       self							,     lowerCAmelCase      )						->				None:
        '''simple docstring'''






        if self.m_component[u_node] != u_node:
              for k in self.m_component:
                    _lowercase			 =self.find_component(lowerCAmelCase      )




  def 						A__  (       self							,     lowerCAmelCase							,     lowerCAmelCase							,     lowerCAmelCase      )						->				None:
        '''simple docstring'''






        if component_size[u_node] <= component_size[v_node]:
              _lowercase			 =v_node
              component_size[v_node] += component_size[u_node]
              self.set_component(lowerCAmelCase      )

        elif component_size[u_node] >= component_size[v_node]:
              _lowercase			 =self.find_component(lowerCAmelCase      )
              component_size[u_node] += component_size[v_node]
              self.set_component(lowerCAmelCase      )




  def 						A__  (       self      )						->				None:
        '''simple docstring'''






        _lowercase			 =[]
        _lowercase			 =0

        _lowercase			 =[-1] * self.m_num_of_nodes

        # A list of components (initialized to all of the nodes)
        for node in range(self.m_num_of_nodes      ):
              self.m_component.update({node: node}      )
              component_size.append(1      )

        _lowercase			 =self.m_num_of_nodes

        while num_of_components > 1:
              for edge in self.m_edges:
                    _lowercase , _lowercase , _lowercase			 =edge

                    _lowercase			 =self.m_component[u]
                    _lowercase			 =self.m_component[v]

                    if u_component != v_component:

                          for component in (u_component, v_component):
                                if (
                                    minimum_weight_edge[component] == -1
                                    or minimum_weight_edge[component][2] > w
                                ):
                                      _lowercase			 =[u, v, w]

              for edge in minimum_weight_edge:
                    if isinstance(lowerCAmelCase							,     lowerCAmelCase      ):
                          _lowercase , _lowercase , _lowercase			 =edge

                          _lowercase			 =self.m_component[u]
                          _lowercase			 =self.m_component[v]

                          if u_component != v_component:
                                mst_weight += w
                                self.union(lowerCAmelCase							,     lowerCAmelCase							,     lowerCAmelCase      )
                                print(F'''Added edge [{u} - {v}]\nAdded weight: {w}\n'''      )
                                num_of_components -= 1

              _lowercase			 =[-1] * self.m_num_of_nodes
        print(F'''The total weight of the minimal spanning tree is: {mst_weight}'''      )
def   a   (    )					->   None:





      """simple docstring"""





if __name__ == "__main__":
  import doctest

  doctest.testmod()


