





'''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__     (       a							):
      '''simple docstring'''






      @staticmethod
      def 	snake_case  (     SCREAMING_SNAKE_CASE )				->  str:
        __lowerCAmelCase		:    Tuple			     =  parser.add_parser('login'     , help='Log in using the same credentials as on huggingface.co' )
        login_parser.set_defaults(func=lambda SCREAMING_SNAKE_CASE : LoginCommand(SCREAMING_SNAKE_CASE ) )
        __lowerCAmelCase		:    str			     =  parser.add_parser('whoami'     , help='Find out which huggingface.co account you are logged in as.' )
        whoami_parser.set_defaults(func=lambda SCREAMING_SNAKE_CASE : WhoamiCommand(SCREAMING_SNAKE_CASE ) )
        __lowerCAmelCase		:    Tuple			     =  parser.add_parser('logout'     , help='Log out' )
        logout_parser.set_defaults(func=lambda SCREAMING_SNAKE_CASE : LogoutCommand(SCREAMING_SNAKE_CASE ) )

        # new system: git-based repo system
        __lowerCAmelCase		:    int			     =  parser.add_parser(
            'repo'     , help='Deprecated: use `huggingface-cli` instead. Commands to interact with your huggingface.co repos.'     , )
        __lowerCAmelCase		:    Tuple			     =  repo_parser.add_subparsers(
            help='Deprecated: use `huggingface-cli` instead. huggingface.co repos related commands' )
        __lowerCAmelCase		:    Tuple			     =  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=SCREAMING_SNAKE_CASE     , 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=SCREAMING_SNAKE_CASE     , 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 SCREAMING_SNAKE_CASE : RepoCreateCommand(SCREAMING_SNAKE_CASE ) )



class 		UpperCamelCase__     :
      '''simple docstring'''






      _snake_case           =				'''\u001b[1m'''
      _snake_case           =				'''\u001b[31m'''
      _snake_case           =				'''\u001b[90m'''
      _snake_case           =				'''\u001b[0m'''




      @classmethod
      def 	snake_case  (     cls     , SCREAMING_SNAKE_CASE )				->  Optional[int]:
        return F"""{cls._bold}{s}{cls._reset}"""




      @classmethod
      def 	snake_case  (     cls     , SCREAMING_SNAKE_CASE )				->  str:
        return F"""{cls._bold}{cls._red}{s}{cls._reset}"""







      @classmethod
      def 	snake_case  (     cls     , SCREAMING_SNAKE_CASE )				->  List[Any]:
        return F"""{cls._gray}{s}{cls._reset}"""




def       A							(      _UpperCAmelCase   :				List[List[Union[str, int]]]						,_UpperCAmelCase   :				List[str]					)  ->				str:


  '''simple docstring'''




  __lowerCAmelCase		:    Optional[Any]			     =  [max(len(str(_UpperCAmelCase					)					) for x in col					) for col in zip(*_UpperCAmelCase						,_UpperCAmelCase					)]
  __lowerCAmelCase		:    Optional[int]			     =  ('{{:{}}} ' * len(_UpperCAmelCase					)).format(*_UpperCAmelCase					)
  __lowerCAmelCase		:    Union[str, Any]			     =  []
  lines.append(row_format.format(*_UpperCAmelCase					)					)
  lines.append(row_format.format(*['-' * w for w in col_widths]					)					)
  for row in rows:
    lines.append(row_format.format(*_UpperCAmelCase					)					)
  return "\n".join(_UpperCAmelCase					)


class 		UpperCamelCase__     :
      '''simple docstring'''






      def __init__(     self     , SCREAMING_SNAKE_CASE )				->  Union[str, Any]:
        __lowerCAmelCase		:    Union[str, Any]			     =  args



class 		UpperCamelCase__     (       a							):
      '''simple docstring'''






      def 	snake_case  (     self )				->  Union[str, 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__     (       a							):
      '''simple docstring'''






      def 	snake_case  (     self )				->  List[str]:
        print(
            ANSI.red(
                'WARNING! `transformers-cli whoami` is deprecated and will be removed in v5. Please use '
                '`huggingface-cli whoami` instead.' ) )
        __lowerCAmelCase		:    Any			     =  HfFolder.get_token()
        if token is None:
          print('Not logged in' )
          exit()
        try:
          __lowerCAmelCase     ,					__lowerCAmelCase		:    str			     =  whoami(SCREAMING_SNAKE_CASE )
          print(SCREAMING_SNAKE_CASE )
          if orgs:
            print(ANSI.bold('orgs: ' )     , ','.join(SCREAMING_SNAKE_CASE ) )
        except HTTPError as e:
          print(SCREAMING_SNAKE_CASE )
          print(ANSI.red(e.response.text ) )
          exit(1 )



class 		UpperCamelCase__     (       a							):
      '''simple docstring'''






      def 	snake_case  (     self )				->  Dict:
        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__     (       a							):
      '''simple docstring'''






      def 	snake_case  (     self )				->  Union[str, Any]:
        print(
            ANSI.red(
                'WARNING! Managing repositories through transformers-cli is deprecated. '
                'Please use `huggingface-cli` instead.' ) )
        __lowerCAmelCase		:    Dict			     =  HfFolder.get_token()
        if token is None:
          print('Not logged in' )
          exit(1 )
        try:
          __lowerCAmelCase		:    List[str]			     =  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:
          __lowerCAmelCase		:    Union[str, Any]			     =  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('' )

        __lowerCAmelCase     ,					__lowerCAmelCase		:    Tuple			     =  whoami(SCREAMING_SNAKE_CASE )
        __lowerCAmelCase		:    str			     =  self.args.organization if self.args.organization is not None else user
        __lowerCAmelCase		:    Optional[int]			     =  F"""{namespace}/{self.args.name}"""
        print(F"""You are about to create {ANSI.bold(SCREAMING_SNAKE_CASE )}""" )

        if not self.args.yes:
          __lowerCAmelCase		:    Optional[int]			     =  input('Proceed? [Y/n] ' ).lower()
          if not (choice == "" or choice == "y" or choice == "yes"):
            print('Abort' )
            exit()
        try:
          __lowerCAmelCase		:    List[str]			     =  create_repo(SCREAMING_SNAKE_CASE     , name=self.args.name     , organization=self.args.organization )
        except HTTPError as e:
          print(SCREAMING_SNAKE_CASE )
          print(ANSI.red(e.response.text ) )
          exit(1 )
        print('\nYour repo now lives at:' )
        print(F"""  {ANSI.bold(SCREAMING_SNAKE_CASE )}""" )
        print('\nYou can clone it locally with the command below, and commit/push as usual.' )
        print(F"""\n  git clone {url}""" )
        print('' )












'''simple docstring'''


import numpy as np
import qiskit
from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute




def       A							(      _UpperCAmelCase   :				float = np.pi / 2						,_UpperCAmelCase   :				float = np.pi / 2						,_UpperCAmelCase   :				float = np.pi / 2					)  ->				qiskit.result.counts.Counts:


  '''simple docstring'''




  __lowerCAmelCase		:    Optional[int]			     =  QuantumRegister(3						,'qr'					)  # Define the number of quantum bits
  __lowerCAmelCase		:    Optional[int]			     =  ClassicalRegister(1						,'cr'					)  # Define the number of classical bits

  __lowerCAmelCase		:    List[Any]			     =  QuantumCircuit(_UpperCAmelCase						,_UpperCAmelCase					)  # Define the quantum circuit.

  # Build the circuit
  quantum_circuit.u(_UpperCAmelCase						,_UpperCAmelCase						,_UpperCAmelCase						,0					)  # Quantum State to teleport
  quantum_circuit.h(1					)  # add hadamard gate
  quantum_circuit.cx(
      1						,2					)  # add control gate with qubit 1 as control and 2 as target.
  quantum_circuit.cx(0						,1					)
  quantum_circuit.h(0					)
  quantum_circuit.cz(0						,2					)  # add control z gate.
  quantum_circuit.cx(1						,2					)

  quantum_circuit.measure([2]						,[0]					)  # measure the qubit.

  # Simulate the circuit using qasm simulator
  __lowerCAmelCase		:    List[str]			     =  Aer.get_backend('aer_simulator'					)
  __lowerCAmelCase		:    Optional[Any]			     =  execute(_UpperCAmelCase						,_UpperCAmelCase						,shots=1_0_0_0					)

  return job.result().get_counts(_UpperCAmelCase					)


if __name__ == "__main__":
    print(
        "Total count for teleported state is: "
        F'''{quantum_teleportation(np.pi/2, np.pi/2, np.pi/2)}'''
    )





