"""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 			_lowerCamelCase      (__lowerCamelCase  ):







				@staticmethod
				def 				__UpperCAmelCase       (			lowerCamelCase_     :							ArgumentParser    ):

					"""simple docstring"""






					_lowercase			:     Optional[int]      					=				parser.add_parser('login'      ,       help='Log in using the same credentials as on huggingface.co'    )
					login_parser.set_defaults(func=lambda lowerCamelCase_    : LoginCommand(lowerCamelCase_    )    )
					_lowercase			:     Any      					=				parser.add_parser('whoami'      ,       help='Find out which huggingface.co account you are logged in as.'    )
					whoami_parser.set_defaults(func=lambda lowerCamelCase_    : WhoamiCommand(lowerCamelCase_    )    )
					_lowercase			:     Tuple      					=				parser.add_parser('logout'      ,       help='Log out'    )
					logout_parser.set_defaults(func=lambda lowerCamelCase_    : LogoutCommand(lowerCamelCase_    )    )

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



class 			_lowerCamelCase      :
				_snake_case  =	"\u001b[1m"
				_snake_case  =	"\u001b[31m"
				_snake_case  =	"\u001b[90m"
				_snake_case  =	"\u001b[0m"







				@classmethod
				def 				__UpperCAmelCase       (			cls     :							int      ,       lowerCamelCase_     :							List[str]    ):

					"""simple docstring"""






					return F'''{cls._bold}{s}{cls._reset}'''







				@classmethod
				def 				__UpperCAmelCase       (			cls     :							List[Any]      ,       lowerCamelCase_     :							Optional[Any]    ):

					"""simple docstring"""






					return F'''{cls._bold}{cls._red}{s}{cls._reset}'''







				@classmethod
				def 				__UpperCAmelCase       (			cls     :							List[str]      ,       lowerCamelCase_     :							List[str]    ):

					"""simple docstring"""






					return F'''{cls._gray}{s}{cls._reset}'''



def   __lowerCAmelCase(		__UpperCAmelCase  ,__UpperCAmelCase      ):






	"""simple docstring"""





	_lowercase			:     Optional[Any]      					=				[max(len(str(__UpperCAmelCase      )      ) for x in col      ) for col in zip(*__UpperCAmelCase  ,__UpperCAmelCase      )]
	_lowercase			:     Optional[Any]      					=				('{{:{}}} ' * len(__UpperCAmelCase      )).format(*__UpperCAmelCase      )
	_lowercase			:     List[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 			_lowerCamelCase      :







				def __init__(			self     :							str      ,       lowerCamelCase_     :							List[str]    ):

					"""simple docstring"""






					_lowercase			:     List[Any]      					=				args



class 			_lowerCamelCase      (__lowerCamelCase  ):







				def 				__UpperCAmelCase       (			self     :							List[Any]    ):

					"""simple docstring"""






					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 			_lowerCamelCase      (__lowerCamelCase  ):







				def 				__UpperCAmelCase       (			self     :							Optional[Any]    ):

					"""simple docstring"""






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



class 			_lowerCamelCase      (__lowerCamelCase  ):







				def 				__UpperCAmelCase       (			self     :							Tuple    ):

					"""simple docstring"""






					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 			_lowerCamelCase      (__lowerCamelCase  ):







				def 				__UpperCAmelCase       (			self     :							List[str]    ):

					"""simple docstring"""






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

					_lowercase					,   _lowercase			:     List[str]      					=				whoami(lowerCamelCase_    )
					_lowercase			:     Any      					=				self.args.organization if self.args.organization is not None else user
					_lowercase			:     Tuple      					=				F'''{namespace}/{self.args.name}'''
					print(F'''You are about to create {ANSI.bold(lowerCamelCase_    )}'''    )

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




"""simple docstring"""







def   __lowerCAmelCase(		__UpperCAmelCase  ,__UpperCAmelCase      ):






	"""simple docstring"""





	if n == 0:
		return 1

	elif n % 2 == 1:
		return binary_exponentiation(__UpperCAmelCase  ,n - 1      ) * a

	else:
		_lowercase			:     Dict      					=				binary_exponentiation(__UpperCAmelCase  ,n / 2      )
		return b * b


if __name__ == "__main__":
						try:
												SCREAMING_SNAKE_CASE						=    int(input('Enter Base : ').strip())
												SCREAMING_SNAKE_CASE						=    int(input('Enter Power : ').strip())
						except ValueError:
												print('Invalid literal for integer')

						SCREAMING_SNAKE_CASE						=    binary_exponentiation(BASE, POWER)
						print(f"""{BASE}^({POWER}) : {RESULT}""")



