"""simple docstring"""





import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_bert import BertTokenizer


_UpperCamelCase  :		List[str]           =       logging.get_logger(__name__)

_UpperCamelCase  :		int           =       {"vocab_file": "vocab.txt", "tokenizer_file": "tokenizer.json"}

_UpperCamelCase  :		Optional[Any]           =       {
    "vocab_file": {
        "bert-base-uncased": "https://huggingface.co/bert-base-uncased/resolve/main/vocab.txt",
        "bert-large-uncased": "https://huggingface.co/bert-large-uncased/resolve/main/vocab.txt",
        "bert-base-cased": "https://huggingface.co/bert-base-cased/resolve/main/vocab.txt",
        "bert-large-cased": "https://huggingface.co/bert-large-cased/resolve/main/vocab.txt",
        "bert-base-multilingual-uncased": (
            "https://huggingface.co/bert-base-multilingual-uncased/resolve/main/vocab.txt"
        ),
        "bert-base-multilingual-cased": "https://huggingface.co/bert-base-multilingual-cased/resolve/main/vocab.txt",
        "bert-base-chinese": "https://huggingface.co/bert-base-chinese/resolve/main/vocab.txt",
        "bert-base-german-cased": "https://huggingface.co/bert-base-german-cased/resolve/main/vocab.txt",
        "bert-large-uncased-whole-word-masking": (
            "https://huggingface.co/bert-large-uncased-whole-word-masking/resolve/main/vocab.txt"
        ),
        "bert-large-cased-whole-word-masking": (
            "https://huggingface.co/bert-large-cased-whole-word-masking/resolve/main/vocab.txt"
        ),
        "bert-large-uncased-whole-word-masking-finetuned-squad": (
            "https://huggingface.co/bert-large-uncased-whole-word-masking-finetuned-squad/resolve/main/vocab.txt"
        ),
        "bert-large-cased-whole-word-masking-finetuned-squad": (
            "https://huggingface.co/bert-large-cased-whole-word-masking-finetuned-squad/resolve/main/vocab.txt"
        ),
        "bert-base-cased-finetuned-mrpc": (
            "https://huggingface.co/bert-base-cased-finetuned-mrpc/resolve/main/vocab.txt"
        ),
        "bert-base-german-dbmdz-cased": "https://huggingface.co/bert-base-german-dbmdz-cased/resolve/main/vocab.txt",
        "bert-base-german-dbmdz-uncased": (
            "https://huggingface.co/bert-base-german-dbmdz-uncased/resolve/main/vocab.txt"
        ),
        "TurkuNLP/bert-base-finnish-cased-v1": (
            "https://huggingface.co/TurkuNLP/bert-base-finnish-cased-v1/resolve/main/vocab.txt"
        ),
        "TurkuNLP/bert-base-finnish-uncased-v1": (
            "https://huggingface.co/TurkuNLP/bert-base-finnish-uncased-v1/resolve/main/vocab.txt"
        ),
        "wietsedv/bert-base-dutch-cased": (
            "https://huggingface.co/wietsedv/bert-base-dutch-cased/resolve/main/vocab.txt"
        ),
    },
    "tokenizer_file": {
        "bert-base-uncased": "https://huggingface.co/bert-base-uncased/resolve/main/tokenizer.json",
        "bert-large-uncased": "https://huggingface.co/bert-large-uncased/resolve/main/tokenizer.json",
        "bert-base-cased": "https://huggingface.co/bert-base-cased/resolve/main/tokenizer.json",
        "bert-large-cased": "https://huggingface.co/bert-large-cased/resolve/main/tokenizer.json",
        "bert-base-multilingual-uncased": (
            "https://huggingface.co/bert-base-multilingual-uncased/resolve/main/tokenizer.json"
        ),
        "bert-base-multilingual-cased": (
            "https://huggingface.co/bert-base-multilingual-cased/resolve/main/tokenizer.json"
        ),
        "bert-base-chinese": "https://huggingface.co/bert-base-chinese/resolve/main/tokenizer.json",
        "bert-base-german-cased": "https://huggingface.co/bert-base-german-cased/resolve/main/tokenizer.json",
        "bert-large-uncased-whole-word-masking": (
            "https://huggingface.co/bert-large-uncased-whole-word-masking/resolve/main/tokenizer.json"
        ),
        "bert-large-cased-whole-word-masking": (
            "https://huggingface.co/bert-large-cased-whole-word-masking/resolve/main/tokenizer.json"
        ),
        "bert-large-uncased-whole-word-masking-finetuned-squad": (
            "https://huggingface.co/bert-large-uncased-whole-word-masking-finetuned-squad/resolve/main/tokenizer.json"
        ),
        "bert-large-cased-whole-word-masking-finetuned-squad": (
            "https://huggingface.co/bert-large-cased-whole-word-masking-finetuned-squad/resolve/main/tokenizer.json"
        ),
        "bert-base-cased-finetuned-mrpc": (
            "https://huggingface.co/bert-base-cased-finetuned-mrpc/resolve/main/tokenizer.json"
        ),
        "bert-base-german-dbmdz-cased": (
            "https://huggingface.co/bert-base-german-dbmdz-cased/resolve/main/tokenizer.json"
        ),
        "bert-base-german-dbmdz-uncased": (
            "https://huggingface.co/bert-base-german-dbmdz-uncased/resolve/main/tokenizer.json"
        ),
        "TurkuNLP/bert-base-finnish-cased-v1": (
            "https://huggingface.co/TurkuNLP/bert-base-finnish-cased-v1/resolve/main/tokenizer.json"
        ),
        "TurkuNLP/bert-base-finnish-uncased-v1": (
            "https://huggingface.co/TurkuNLP/bert-base-finnish-uncased-v1/resolve/main/tokenizer.json"
        ),
        "wietsedv/bert-base-dutch-cased": (
            "https://huggingface.co/wietsedv/bert-base-dutch-cased/resolve/main/tokenizer.json"
        ),
    },
}

_UpperCamelCase  :		Optional[int]           =       {
    "bert-base-uncased": 5_12,
    "bert-large-uncased": 5_12,
    "bert-base-cased": 5_12,
    "bert-large-cased": 5_12,
    "bert-base-multilingual-uncased": 5_12,
    "bert-base-multilingual-cased": 5_12,
    "bert-base-chinese": 5_12,
    "bert-base-german-cased": 5_12,
    "bert-large-uncased-whole-word-masking": 5_12,
    "bert-large-cased-whole-word-masking": 5_12,
    "bert-large-uncased-whole-word-masking-finetuned-squad": 5_12,
    "bert-large-cased-whole-word-masking-finetuned-squad": 5_12,
    "bert-base-cased-finetuned-mrpc": 5_12,
    "bert-base-german-dbmdz-cased": 5_12,
    "bert-base-german-dbmdz-uncased": 5_12,
    "TurkuNLP/bert-base-finnish-cased-v1": 5_12,
    "TurkuNLP/bert-base-finnish-uncased-v1": 5_12,
    "wietsedv/bert-base-dutch-cased": 5_12,
}

_UpperCamelCase  :		Union[str, Any]           =       {
    "bert-base-uncased": {"do_lower_case": True},
    "bert-large-uncased": {"do_lower_case": True},
    "bert-base-cased": {"do_lower_case": False},
    "bert-large-cased": {"do_lower_case": False},
    "bert-base-multilingual-uncased": {"do_lower_case": True},
    "bert-base-multilingual-cased": {"do_lower_case": False},
    "bert-base-chinese": {"do_lower_case": False},
    "bert-base-german-cased": {"do_lower_case": False},
    "bert-large-uncased-whole-word-masking": {"do_lower_case": True},
    "bert-large-cased-whole-word-masking": {"do_lower_case": False},
    "bert-large-uncased-whole-word-masking-finetuned-squad": {"do_lower_case": True},
    "bert-large-cased-whole-word-masking-finetuned-squad": {"do_lower_case": False},
    "bert-base-cased-finetuned-mrpc": {"do_lower_case": False},
    "bert-base-german-dbmdz-cased": {"do_lower_case": False},
    "bert-base-german-dbmdz-uncased": {"do_lower_case": True},
    "TurkuNLP/bert-base-finnish-cased-v1": {"do_lower_case": False},
    "TurkuNLP/bert-base-finnish-uncased-v1": {"do_lower_case": True},
    "wietsedv/bert-base-dutch-cased": {"do_lower_case": False},
}


class 	UpperCAmelCase_      (       lowerCAmelCase_):
      lowerCamelCase__						:       Union[str, Any]					    =    VOCAB_FILES_NAMES
      lowerCamelCase__						:       int					    =    PRETRAINED_VOCAB_FILES_MAP
      lowerCamelCase__						:       List[Any]					    =    PRETRAINED_INIT_CONFIGURATION
      lowerCamelCase__						:       Dict					    =    PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
      lowerCamelCase__						:       Union[str, Any]					    =    BertTokenizer


      def __init__(  self						,     a=None						,     a=None						,     a=True						,     a="[UNK]"						,     a="[SEP]"						,     a="[PAD]"						,     a="[CLS]"						,     a="[MASK]"						,     a=True						,     a=None						,     **a						,     )			->   Tuple:
             super().__init__(
                 __lowerCAmelCase						,     tokenizer_file=__lowerCAmelCase						,     do_lower_case=__lowerCAmelCase						,     unk_token=__lowerCAmelCase						,     sep_token=__lowerCAmelCase						,     pad_token=__lowerCAmelCase						,     cls_token=__lowerCAmelCase						,     mask_token=__lowerCAmelCase						,     tokenize_chinese_chars=__lowerCAmelCase						,     strip_accents=__lowerCAmelCase						,     **__lowerCAmelCase						,     )

             lowercase__     :						Optional[Any]         =      json.loads(self.backend_tokenizer.normalizer.__getstate__()				)
             if (
                 normalizer_state.get('lowercase'						,     __lowerCAmelCase				) != do_lower_case
                 or normalizer_state.get('strip_accents'						,     __lowerCAmelCase				) != strip_accents
                 or normalizer_state.get('handle_chinese_chars'						,     __lowerCAmelCase				) != tokenize_chinese_chars
             ):
                    lowercase__     :						List[Any]         =      getattr(__lowerCAmelCase						,     normalizer_state.pop('type'				)				)
                    lowercase__     :						List[str]         =      do_lower_case
                    lowercase__     :						Any         =      strip_accents
                    lowercase__     :						List[Any]         =      tokenize_chinese_chars
                    lowercase__     :						List[str]         =      normalizer_class(**__lowerCAmelCase				)

             lowercase__     :						str         =      do_lower_case


      def 						_UpperCAmelCase			(  self						,     a						,     a=None				)			->   int:
             lowercase__     :						Optional[Any]         =      [self.cls_token_id] + token_ids_a + [self.sep_token_id]

             if token_ids_a:
                    output += token_ids_a + [self.sep_token_id]

             return output


      def 						_UpperCAmelCase			(  self						,     a						,     a = None				)			->   Any:
             lowercase__     :						Dict         =      [self.sep_token_id]
             lowercase__     :						Dict         =      [self.cls_token_id]
             if token_ids_a is None:
                    return len(cls + token_ids_a + sep				) * [0]
             return len(cls + token_ids_a + sep				) * [0] + len(token_ids_a + sep				) * [1]


      def 						_UpperCAmelCase			(  self						,     a						,     a = None				)			->   Tuple:
             lowercase__     :						Tuple         =      self._tokenizer.model.save(__lowerCAmelCase						,     name=__lowerCAmelCase				)
             return tuple(__lowerCAmelCase				)


"""simple docstring"""


from __future__ import annotations

import json

import requests
from bsa import BeautifulSoup
from fake_useragent import UserAgent

UpperCAmelCase__			=    {"""UserAgent""": UserAgent().random}






def      __UpperCAmelCase       (      lowercase		):







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


class 							a					:


    def __init__(       self						:	Any ,					__lowerCAmelCase						:	Union[str, Any]       ):
      _UpperCAmelCase    			=   f'''https://www.instagram.com/{username}/'''
      _UpperCAmelCase    			=   self.get_json()


    def   lowerCAmelCase_	(       self						:	int       ):
      _UpperCAmelCase    			=   requests.get(self.url ,					headers=__lowerCAmelCase       ).text
      _UpperCAmelCase    			=   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						:	Dict       ):
      return f'''{self.__class__.__name__}(\'{self.username}\')'''


    def __str__(       self						:	int       ):
      return f'''{self.fullname} ({self.username}) is {self.biography}'''


    @property
    def   lowerCAmelCase_	(       self						:	Union[str, Any]       ):
      return self.user_data["username"]


    @property
    def   lowerCAmelCase_	(       self						:	List[Any]       ):
      return self.user_data["full_name"]


    @property
    def   lowerCAmelCase_	(       self						:	str       ):
      return self.user_data["biography"]


    @property
    def   lowerCAmelCase_	(       self						:	str       ):
      return self.user_data["business_email"]


    @property
    def   lowerCAmelCase_	(       self						:	List[Any]       ):
      return self.user_data["external_url"]


    @property
    def   lowerCAmelCase_	(       self						:	int       ):
      return self.user_data["edge_followed_by"]["count"]


    @property
    def   lowerCAmelCase_	(       self						:	Tuple       ):
      return self.user_data["edge_follow"]["count"]


    @property
    def   lowerCAmelCase_	(       self						:	List[str]       ):
      return self.user_data["edge_owner_to_timeline_media"]["count"]


    @property
    def   lowerCAmelCase_	(       self						:	int       ):
      return self.user_data["profile_pic_url_hd"]


    @property
    def   lowerCAmelCase_	(       self						:	str       ):
      return self.user_data["is_verified"]


    @property
    def   lowerCAmelCase_	(       self						:	int       ):
      return self.user_data["is_private"]






def      __UpperCAmelCase       (      lowercase = "github"		):







  """simple docstring"""
  import os

  if os.environ.get("""CI"""		):
    return  # test failing on GitHub Actions
  _UpperCAmelCase    			=   InstagramUser(lowercase		)
  assert instagram_user.user_data
  assert isinstance(instagram_user.user_data ,lowercase		)
  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 > 1_50
  assert instagram_user.number_of_followers > 12_00_00
  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()
    UpperCAmelCase__			=    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 = }''')
