


'''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       a							(						_UpperCamelCase			):


     """simple docstring"""






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

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



class       a							:


     """simple docstring"""






     SCREAMING_SNAKE_CASE			:					Any				  =  '\u001b[1m'
     SCREAMING_SNAKE_CASE			:					List[str]				  =  '\u001b[31m'
     SCREAMING_SNAKE_CASE			:					Tuple				  =  '\u001b[90m'
     SCREAMING_SNAKE_CASE			:					Optional[Any]				  =  '\u001b[0m'

     @classmethod
     def 					lowerCamelCase__					(							cls	:						Optional[int]				,					snake_case	:						Optional[Any]     )		->				Optional[Any]:
          return f'{cls._bold}{s}{cls._reset}'

     @classmethod
     def 					lowerCamelCase__					(							cls	:						Any				,					snake_case	:						Union[str, Any]     )		->				Dict:
          return f'{cls._bold}{cls._red}{s}{cls._reset}'






     @classmethod
     def 					lowerCamelCase__					(							cls	:						Optional[Any]				,					snake_case	:						Optional[int]     )		->				str:
          return f'{cls._gray}{s}{cls._reset}'




def       _a      (		_lowercase   :      List[List[Union[str, int]]]     ,   _lowercase   :      List[str]    ):





     '''simple docstring'''






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


     """simple docstring"""






     def __init__(							self	:						int				,					snake_case	:						Dict     )		->				Optional[Any]:
          __UpperCAmelCase      :					Union[str, Any]    				=     args



class       a							(						_UpperCamelCase			):


     """simple docstring"""






     def 					lowerCamelCase__					(							self	:						str     )		->				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       a							(						_UpperCamelCase			):


     """simple docstring"""






     def 					lowerCamelCase__					(							self	:						int     )		->				List[str]:
          print(
              ANSI.red(
                  '''WARNING! `transformers-cli whoami` is deprecated and will be removed in v5. Please use '''
                  '''`huggingface-cli whoami` instead.'''     )     )
          __UpperCAmelCase      :					str    				=     HfFolder.get_token()
          if token is None:
               print('''Not logged in'''     )
               exit()
          try:
               __UpperCAmelCase				,  __UpperCAmelCase      :					int    				=     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       a							(						_UpperCamelCase			):


     """simple docstring"""






     def 					lowerCamelCase__					(							self	:						List[Any]     )		->				Any:
          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       a							(						_UpperCamelCase			):


     """simple docstring"""






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

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

          if not self.args.yes:
               __UpperCAmelCase      :					List[Any]    				=     input('''Proceed? [Y/n] '''     ).lower()
               if not (choice == "" or choice == "y" or choice == "yes"):
                    print('''Abort'''     )
                    exit()
          try:
               __UpperCAmelCase      :					Optional[Any]    				=     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 itertools





def 	_UpperCAmelCase       (				_UpperCamelCase       :      int = 1_00_00_00  )      -> int:
    A_      =  [1]

    for i in itertools.count(len(_UpperCamelCase  )  ):
        A_      =  0
        for j in itertools.count(1  ):
            A_      =  -1 if j % 2 == 0 else +1
            A_      =  (j * j * 3 - j) // 2
            if index > i:
                break
            item += partitions[i - index] * sign
            item %= number
            index += j
            if index > i:
                break
            item += partitions[i - index] * sign
            item %= number

        if item == 0:
            return i
        partitions.append(_UpperCamelCase  )

    return 0


if __name__ == "__main__":
  import doctest

  doctest.testmod()

  print(F"""{solution() = }""")






