code: 
  
  
  
  
  
  '''simple docstring'''
  
  import subprocess
  from argparse import ArgumentParser
  from typing import List, Union
  
  from huggingface_hub.hf_api import HfFolder, create_repo, whoami
  from requests.exceptions import HTTPError
  
  from . import BaseTransformersCLICommand
  
  
  
  
  
  
  class      UpperCAmelCase			( UpperCamelCase__       ):
   @staticmethod
   def   UpperCAmelCase_							(       lowercase_   :ArgumentParser							)->							Tuple:
       A__       =    parser.add_parser("login"		, help="Log in using the same credentials as on huggingface.co"							)
       login_parser.set_defaults(func=lambda lowercase_							: LoginCommand(lowercase_							)							)
       A__       =    parser.add_parser("whoami"		, help="Find out which huggingface.co account you are logged in as."							)
       whoami_parser.set_defaults(func=lambda lowercase_							: WhoamiCommand(lowercase_							)							)
       A__       =    parser.add_parser("logout"		, help="Log out"							)
       logout_parser.set_defaults(func=lambda lowercase_							: LogoutCommand(lowercase_							)							)
  
       # new system: git-based repo system
       A__       =    parser.add_parser(
           "repo"		, help="Deprecated: use `huggingface-cli` instead. Commands to interact with your huggingface.co repos."		, )
       A__       =    repo_parser.add_subparsers(
           help="Deprecated: use `huggingface-cli` instead. huggingface.co repos related commands"							)
       A__       =    repo_subparsers.add_parser(
           "create"		, help="Deprecated: use `huggingface-cli` instead. Create a new repo on huggingface.co"							)
       repo_create_parser.add_argument(
           "name"		, type=lowercase_		, help="Name for your model's repo. Will be namespaced under your username to build the model id."		, )
       repo_create_parser.add_argument("--organization"		, type=lowercase_		, help="Optional: organization namespace."							)
       repo_create_parser.add_argument("-y"		, "--yes"		, action="store_true"		, help="Optional: answer Yes to the prompt"							)
       repo_create_parser.set_defaults(func=lambda lowercase_							: RepoCreateCommand(lowercase_							)							)
  
  
  
  
  
  
  class      UpperCAmelCase			:
   __lowercase     	=       """\u001b[1m"""
   __lowercase     	=       """\u001b[31m"""
   __lowercase     	=       """\u001b[90m"""
   __lowercase     	=       """\u001b[0m"""
   @classmethod
   def   UpperCAmelCase_							(       cls   :List[str]		, lowercase_   :Tuple							)->							Any:
       return F"{cls._bold}{s}{cls._reset}"
   @classmethod
   def   UpperCAmelCase_							(       cls   :str		, lowercase_   :Tuple							)->							Optional[int]:
       return F"{cls._bold}{cls._red}{s}{cls._reset}"
  
  
  
   @classmethod
   def   UpperCAmelCase_							(       cls   :str		, lowercase_   :List[Any]							)->							Union[str, Any]:
       return F"{cls._gray}{s}{cls._reset}"
  
  
  
  
  
  def 		UpperCamelCase       (							_lowerCamelCase      :      List[List[Union[str, int]]]		, _lowerCamelCase      :      List[str] ):
      A__       =    [max(len(str(_lowerCamelCase ) ) for x in col ) for col in zip(*_lowerCamelCase		, _lowerCamelCase )]
      A__       =    ("{{:{}}} " * len(_lowerCamelCase )).format(*_lowerCamelCase )
      A__       =    []
      lines.append(row_format.format(*_lowerCamelCase ) )
      lines.append(row_format.format(*["-" * w for w in col_widths] ) )
      for row in rows:
          lines.append(row_format.format(*_lowerCamelCase ) )
      return "\n".join(_lowerCamelCase )
  
  
  
  
  
  
  class      UpperCAmelCase			:
   def __init__(       self   :Optional[int]		, lowercase_   :Tuple							)->							Any:
       A__       =    args
  
  
  
  
  
  
  class      UpperCAmelCase			( UpperCamelCase__       ):
   def   UpperCAmelCase_							(       self   :Union[str, Any]							)->							List[Any]:
       print(
           ANSI.red(
               "ERROR! `huggingface-cli login` uses an outdated login mechanism "
               "that is not compatible with the Hugging Face Hub backend anymore. "
               "Please use `huggingface-cli login instead."							)							)
  
  
  
  
  
  
  class      UpperCAmelCase			( UpperCamelCase__       ):
   def   UpperCAmelCase_							(       self   :Optional[Any]							)->							Dict:
       print(
           ANSI.red(
               "WARNING! `transformers-cli whoami` is deprecated and will be removed in v5. Please use "
               "`huggingface-cli whoami` instead."							)							)
       A__       =    HfFolder.get_token()
       if token is None:
           print("Not logged in"							)
           exit()
       try:
           A__,			A__       =    whoami(lowercase_							)
           print(lowercase_							)
           if orgs:
               print(ANSI.bold("orgs: "							)		, ",".join(lowercase_							)							)
       except HTTPError as e:
           print(lowercase_							)
           print(ANSI.red(e.response.text							)							)
           exit(1							)
  
  
  
  
  
  
  class      UpperCAmelCase			( UpperCamelCase__       ):
   def   UpperCAmelCase_							(       self   :Any							)->							str:
       print(
           ANSI.red(
               "ERROR! `transformers-cli logout` uses an outdated logout mechanism "
               "that is not compatible with the Hugging Face Hub backend anymore. "
               "Please use `huggingface-cli logout instead."							)							)
  
  
  
  
  
  
  class      UpperCAmelCase			( UpperCamelCase__       ):
   def   UpperCAmelCase_							(       self   :Any							)->							Dict:
       print(
           ANSI.red(
               "WARNING! Managing repositories through transformers-cli is deprecated. "
               "Please use `huggingface-cli` instead."							)							)
       A__       =    HfFolder.get_token()
       if token is None:
           print("Not logged in"							)
           exit(1							)
       try:
           A__       =    subprocess.check_output(["git", "--version"]							).decode("utf-8"							)
           print(ANSI.gray(stdout.strip()							)							)
       except FileNotFoundError:
           print("Looks like you do not have git installed, please install."							)
  
       try:
           A__       =    subprocess.check_output(["git-lfs", "--version"]							).decode("utf-8"							)
           print(ANSI.gray(stdout.strip()							)							)
       except FileNotFoundError:
           print(
               ANSI.red(
                   "Looks like you do not have git-lfs installed, please install."
                   " You can install from https://git-lfs.github.com/."
                   " Then run `git lfs install` (you only have to do this once)."							)							)
       print(""							)
  
       A__,			A__       =    whoami(lowercase_							)
       A__       =    self.args.organization if self.args.organization is not None else user
       A__       =    F"{namespace}/{self.args.name}"
       print(F"You are about to create {ANSI.bold(lowercase_							)}"							)
  
       if not self.args.yes:
           A__       =    input("Proceed? [Y/n] "							).lower()
           if not (choice == "" or choice == "y" or choice == "yes"):
               print("Abort"							)
               exit()
       try:
           A__       =    create_repo(lowercase_		, name=self.args.name		, organization=self.args.organization							)
       except HTTPError as e:
           print(lowercase_							)
           print(ANSI.red(e.response.text							)							)
           exit(1							)
       print("\nYour repo now lives at:"							)
       print(F"  {ANSI.bold(lowercase_							)}"							)
       print("\nYou can clone it locally with the command below, and commit/push as usual."							)
       print(F"\n  git clone {url}"							)
       print(""							)
  
  
  
  
style_context: 
  
  
  
  
  
  '''simple docstring'''
  
  import os
  import tempfile
  import unittest
  from typing import List
  
  from transformers.models.esm.tokenization_esm import VOCAB_FILES_NAMES, EsmTokenizer
  from transformers.testing_utils import require_tokenizers
  from transformers.tokenization_utils import PreTrainedTokenizer
  from transformers.tokenization_utils_base import PreTrainedTokenizerBase
  
  
  
  
  
  
  @require_tokenizers
  class      UpperCAmelCase			( unittest.TestCase       ):
   __lowercase     	=       EsmTokenizer
   def   UpperCAmelCase_							(       self   :Any							)->							int:
       super().setUp()
       A__       =    tempfile.mkdtemp()
       # fmt: off
       A__       =    ["<cls>", "<pad>", "<eos>", "<unk>", "L", "A", "G", "V", "S", "E", "R", "T", "I", "D", "P", "K", "Q", "N", "F", "Y", "M", "H", "W", "C", "X", "B", "U", "Z", "O", ".", "-", "<null_1>", "<mask>"]  # noqa: E501
       # fmt: on
       A__       =    os.path.join(self.tmpdirname		, VOCAB_FILES_NAMES["vocab_file"]							)
       with open(self.vocab_file		, "w"		, encoding="utf-8"							) as vocab_writer:
           vocab_writer.write("".join([x + "\n" for x in vocab_tokens]							)							)
   def   UpperCAmelCase_							(       self   :Any		, **lowercase_   :int							)->							List[PreTrainedTokenizerBase]:
       return [self.get_tokenizer(**lowercase_							)]
   def   UpperCAmelCase_							(       self   :Any		, **lowercase_   :Dict							)->							PreTrainedTokenizer:
       return self.tokenizer_class.from_pretrained(self.tmpdirname		, **lowercase_							)
   def   UpperCAmelCase_							(       self   :int							)->							Dict:
       A__       =    self.tokenizer_class(self.vocab_file							)
  
       A__       =    tokenizer.tokenize("LAGVS"							)
       self.assertListEqual(lowercase_		, ["L", "A", "G", "V", "S"]							)
       self.assertListEqual(tokenizer.convert_tokens_to_ids(lowercase_							)		, [4, 5, 6, 7, 8]							)
   def   UpperCAmelCase_							(       self   :Tuple							)->							Tuple:
       A__       =    self.tokenizer_class(self.vocab_file							)
  
       A__       =    "LAGVS"
       self.assertListEqual(tokenizer.encode(lowercase_							)		, [0, 4, 5, 6, 7, 8, 2]							)
   def   UpperCAmelCase_							(       self   :Any							)->							Tuple:
       A__       =    self.tokenizer_class(self.vocab_file							)
  
       A__       =    ["LAGVS", "WCB"]
       A__       =    tokenizer(lowercase_		, padding=lowercase_							)["input_ids"]
  
       self.assertListEqual(lowercase_		, [[0, 4, 5, 6, 7, 8, 2], [0, 22, 23, 25, 2]]							)
   def   UpperCAmelCase_							(       self   :str							)->							Any:
       A__       =    self.tokenizer_class(self.vocab_file							)
  
       A__       =    ["LAGVS", "WCB"]
       A__       =    tokenizer(lowercase_		, padding=lowercase_							)["input_ids"]
  
       self.assertListEqual(lowercase_		, [[0, 4, 5, 6, 7, 8, 2], [0, 22, 23, 25, 2, 1, 1]]							)
  
  
  
   def   UpperCAmelCase_							(       self   :Optional[Any]							)->							List[str]:
       A__       =    self.get_tokenizers(fast=lowercase_							)
       for tokenizer in tokenizers:
           with self.subTest(F"{tokenizer.__class__.__name__}"							):
               A__       =    "<unk>"
               A__       =    "<mask>"
  
               A__       =    tokenizer.tokenize(lowercase_							)
               A__       =    tokenizer.tokenize(lowercase_							)
  
               self.assertEqual(len(lowercase_							)		, 1							)
               self.assertEqual(len(lowercase_							)		, 1							)
               self.assertEqual(token_a[0]		, lowercase_							)
               self.assertEqual(token_a[0]		, lowercase_							)
  
  
  
  