We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Error when creating a repository
This error happens on huggingface_hub version 0.0.14 (current version) when creating a new dataset repository

```bash
(py38) bash-3.2$ huggingface-cli repo create --type dataset codeparrot-train
git version 2.29.2
git-lfs/2.13.3 (GitHub; darwin amd64; go 1.16.2; git a5e65851)

Traceback (most recent call last):
  File "/Users/thomwolf/miniconda2/envs/py38/bin/huggingface-cli", line 8, in <module>
    sys.exit(main())
  File "/Users/thomwolf/miniconda2/envs/py38/lib/python3.8/site-packages/huggingface_hub/commands/huggingface_cli.py", line 41, in main
    service.run()
  File "/Users/thomwolf/miniconda2/envs/py38/lib/python3.8/site-packages/huggingface_hub/commands/user.py", line 228, in run
    user, _ = self._api.whoami(token)
ValueError: too many values to unpack (expected 2)
```

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/huggingface_hub/commands/user.py`
Content:
```
1 # Copyright 2020 The HuggingFace Team. All rights reserved.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 
15 import subprocess
16 from argparse import ArgumentParser
17 from getpass import getpass
18 from typing import List, Union
19 
20 from huggingface_hub.commands import BaseHuggingfaceCLICommand
21 from huggingface_hub.constants import REPO_TYPES, REPO_TYPES_URL_PREFIXES
22 from huggingface_hub.hf_api import HfApi, HfFolder
23 from requests.exceptions import HTTPError
24 
25 
26 class UserCommands(BaseHuggingfaceCLICommand):
27     @staticmethod
28     def register_subcommand(parser: ArgumentParser):
29         login_parser = parser.add_parser(
30             "login", help="Log in using the same credentials as on huggingface.co"
31         )
32         login_parser.set_defaults(func=lambda args: LoginCommand(args))
33         whoami_parser = parser.add_parser(
34             "whoami", help="Find out which huggingface.co account you are logged in as."
35         )
36         whoami_parser.set_defaults(func=lambda args: WhoamiCommand(args))
37         logout_parser = parser.add_parser("logout", help="Log out")
38         logout_parser.set_defaults(func=lambda args: LogoutCommand(args))
39 
40         # new system: git-based repo system
41         repo_parser = parser.add_parser(
42             "repo",
43             help="{create, ls-files} Commands to interact with your huggingface.co repos.",
44         )
45         repo_subparsers = repo_parser.add_subparsers(
46             help="huggingface.co repos related commands"
47         )
48         ls_parser = repo_subparsers.add_parser(
49             "ls-files", help="List all your files on huggingface.co"
50         )
51         ls_parser.add_argument(
52             "--organization", type=str, help="Optional: organization namespace."
53         )
54         ls_parser.set_defaults(func=lambda args: ListReposObjsCommand(args))
55         repo_create_parser = repo_subparsers.add_parser(
56             "create", help="Create a new repo on huggingface.co"
57         )
58         repo_create_parser.add_argument(
59             "name",
60             type=str,
61             help="Name for your repo. Will be namespaced under your username to build the repo id.",
62         )
63         repo_create_parser.add_argument(
64             "--type",
65             type=str,
66             help='Optional: repo_type: set to "dataset" or "space" if creating a dataset or space, default is model.',
67         )
68         repo_create_parser.add_argument(
69             "--organization", type=str, help="Optional: organization namespace."
70         )
71         repo_create_parser.add_argument(
72             "-y",
73             "--yes",
74             action="store_true",
75             help="Optional: answer Yes to the prompt",
76         )
77         repo_create_parser.set_defaults(func=lambda args: RepoCreateCommand(args))
78 
79 
80 class ANSI:
81     """
82     Helper for en.wikipedia.org/wiki/ANSI_escape_code
83     """
84 
85     _bold = "\u001b[1m"
86     _red = "\u001b[31m"
87     _gray = "\u001b[90m"
88     _reset = "\u001b[0m"
89 
90     @classmethod
91     def bold(cls, s):
92         return "{}{}{}".format(cls._bold, s, cls._reset)
93 
94     @classmethod
95     def red(cls, s):
96         return "{}{}{}".format(cls._bold + cls._red, s, cls._reset)
97 
98     @classmethod
99     def gray(cls, s):
100         return "{}{}{}".format(cls._gray, s, cls._reset)
101 
102 
103 def tabulate(rows: List[List[Union[str, int]]], headers: List[str]) -> str:
104     """
105     Inspired by:
106 
107     - stackoverflow.com/a/8356620/593036
108     - stackoverflow.com/questions/9535954/printing-lists-as-tabular-data
109     """
110     col_widths = [max(len(str(x)) for x in col) for col in zip(*rows, headers)]
111     row_format = ("{{:{}}} " * len(headers)).format(*col_widths)
112     lines = []
113     lines.append(row_format.format(*headers))
114     lines.append(row_format.format(*["-" * w for w in col_widths]))
115     for row in rows:
116         lines.append(row_format.format(*row))
117     return "\n".join(lines)
118 
119 
120 class BaseUserCommand:
121     def __init__(self, args):
122         self.args = args
123         self._api = HfApi()
124 
125 
126 class LoginCommand(BaseUserCommand):
127     def run(self):
128         print(  # docstyle-ignore
129             """
130         _|    _|  _|    _|    _|_|_|    _|_|_|  _|_|_|  _|      _|    _|_|_|      _|_|_|_|    _|_|      _|_|_|  _|_|_|_|
131         _|    _|  _|    _|  _|        _|          _|    _|_|    _|  _|            _|        _|    _|  _|        _|
132         _|_|_|_|  _|    _|  _|  _|_|  _|  _|_|    _|    _|  _|  _|  _|  _|_|      _|_|_|    _|_|_|_|  _|        _|_|_|
133         _|    _|  _|    _|  _|    _|  _|    _|    _|    _|    _|_|  _|    _|      _|        _|    _|  _|        _|
134         _|    _|    _|_|      _|_|_|    _|_|_|  _|_|_|  _|      _|    _|_|_|      _|        _|    _|    _|_|_|  _|_|_|_|
135 
136         """
137         )
138         username = input("Username: ")
139         password = getpass()
140         try:
141             token = self._api.login(username, password)
142         except HTTPError as e:
143             # probably invalid credentials, display error message.
144             print(e)
145             print(ANSI.red(e.response.text))
146             exit(1)
147         HfFolder.save_token(token)
148         print("Login successful")
149         print("Your token has been saved to", HfFolder.path_token)
150 
151 
152 class WhoamiCommand(BaseUserCommand):
153     def run(self):
154         token = HfFolder.get_token()
155         if token is None:
156             print("Not logged in")
157             exit()
158         try:
159             info = self._api.whoami(token)
160             print(info["name"])
161             orgs = [org["name"] for org in info["orgs"]]
162             if orgs:
163                 print(ANSI.bold("orgs: "), ",".join(orgs))
164         except HTTPError as e:
165             print(e)
166             print(ANSI.red(e.response.text))
167             exit(1)
168 
169 
170 class LogoutCommand(BaseUserCommand):
171     def run(self):
172         token = HfFolder.get_token()
173         if token is None:
174             print("Not logged in")
175             exit()
176         HfFolder.delete_token()
177         self._api.logout(token)
178         print("Successfully logged out.")
179 
180 
181 class ListReposObjsCommand(BaseUserCommand):
182     def run(self):
183         token = HfFolder.get_token()
184         if token is None:
185             print("Not logged in")
186             exit(1)
187         try:
188             objs = self._api.list_repos_objs(token, organization=self.args.organization)
189         except HTTPError as e:
190             print(e)
191             print(ANSI.red(e.response.text))
192             exit(1)
193         if len(objs) == 0:
194             print("No shared file yet")
195             exit()
196         rows = [[obj.filename, obj.lastModified, obj.commit, obj.size] for obj in objs]
197         print(
198             tabulate(rows, headers=["Filename", "LastModified", "Commit-Sha", "Size"])
199         )
200 
201 
202 class RepoCreateCommand(BaseUserCommand):
203     def run(self):
204         token = HfFolder.get_token()
205         if token is None:
206             print("Not logged in")
207             exit(1)
208         try:
209             stdout = subprocess.check_output(["git", "--version"]).decode("utf-8")
210             print(ANSI.gray(stdout.strip()))
211         except FileNotFoundError:
212             print("Looks like you do not have git installed, please install.")
213 
214         try:
215             stdout = subprocess.check_output(["git-lfs", "--version"]).decode("utf-8")
216             print(ANSI.gray(stdout.strip()))
217         except FileNotFoundError:
218             print(
219                 ANSI.red(
220                     "Looks like you do not have git-lfs installed, please install."
221                     " You can install from https://git-lfs.github.com/."
222                     " Then run `git lfs install` (you only have to do this once)."
223                 )
224             )
225         print("")
226 
227         user, _ = self._api.whoami(token)
228         namespace = (
229             self.args.organization if self.args.organization is not None else user
230         )
231 
232         repo_id = f"{namespace}/{self.args.name}"
233 
234         if self.args.type not in REPO_TYPES:
235             print("Invalid repo --type")
236             exit(1)
237 
238         if self.args.type in REPO_TYPES_URL_PREFIXES:
239             repo_id = REPO_TYPES_URL_PREFIXES[self.args.type] + repo_id
240 
241         print("You are about to create {}".format(ANSI.bold(repo_id)))
242 
243         if not self.args.yes:
244             choice = input("Proceed? [Y/n] ").lower()
245             if not (choice == "" or choice == "y" or choice == "yes"):
246                 print("Abort")
247                 exit()
248         try:
249             url = self._api.create_repo(
250                 token,
251                 name=self.args.name,
252                 organization=self.args.organization,
253                 repo_type=self.args.type,
254             )
255         except HTTPError as e:
256             print(e)
257             print(ANSI.red(e.response.text))
258             exit(1)
259         print("\nYour repo now lives at:")
260         print("  {}".format(ANSI.bold(url)))
261         print(
262             "\nYou can clone it locally with the command below,"
263             " and commit/push as usual."
264         )
265         print(f"\n  git clone {url}")
266         print("")
267
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/src/huggingface_hub/commands/user.py b/src/huggingface_hub/commands/user.py
--- a/src/huggingface_hub/commands/user.py
+++ b/src/huggingface_hub/commands/user.py
@@ -224,7 +224,7 @@
             )
         print("")
 
-        user, _ = self._api.whoami(token)
+        user = self._api.whoami(token)["name"]
         namespace = (
             self.args.organization if self.args.organization is not None else user
         )

{"golden_diff": "diff --git a/src/huggingface_hub/commands/user.py b/src/huggingface_hub/commands/user.py\n--- a/src/huggingface_hub/commands/user.py\n+++ b/src/huggingface_hub/commands/user.py\n@@ -224,7 +224,7 @@\n             )\n         print(\"\")\n \n-        user, _ = self._api.whoami(token)\n+        user = self._api.whoami(token)[\"name\"]\n         namespace = (\n             self.args.organization if self.args.organization is not None else user\n         )\n", "issue": "Error when creating a repository\nThis error happens on huggingface_hub version 0.0.14 (current version) when creating a new dataset repository\r\n\r\n```bash\r\n(py38) bash-3.2$ huggingface-cli repo create --type dataset codeparrot-train\r\ngit version 2.29.2\r\ngit-lfs/2.13.3 (GitHub; darwin amd64; go 1.16.2; git a5e65851)\r\n\r\nTraceback (most recent call last):\r\n  File \"/Users/thomwolf/miniconda2/envs/py38/bin/huggingface-cli\", line 8, in <module>\r\n    sys.exit(main())\r\n  File \"/Users/thomwolf/miniconda2/envs/py38/lib/python3.8/site-packages/huggingface_hub/commands/huggingface_cli.py\", line 41, in main\r\n    service.run()\r\n  File \"/Users/thomwolf/miniconda2/envs/py38/lib/python3.8/site-packages/huggingface_hub/commands/user.py\", line 228, in run\r\n    user, _ = self._api.whoami(token)\r\nValueError: too many values to unpack (expected 2)\r\n```\n", "before_files": [{"content": "# Copyright 2020 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport subprocess\nfrom argparse import ArgumentParser\nfrom getpass import getpass\nfrom typing import List, Union\n\nfrom huggingface_hub.commands import BaseHuggingfaceCLICommand\nfrom huggingface_hub.constants import REPO_TYPES, REPO_TYPES_URL_PREFIXES\nfrom huggingface_hub.hf_api import HfApi, HfFolder\nfrom requests.exceptions import HTTPError\n\n\nclass UserCommands(BaseHuggingfaceCLICommand):\n    @staticmethod\n    def register_subcommand(parser: ArgumentParser):\n        login_parser = parser.add_parser(\n            \"login\", help=\"Log in using the same credentials as on huggingface.co\"\n        )\n        login_parser.set_defaults(func=lambda args: LoginCommand(args))\n        whoami_parser = parser.add_parser(\n            \"whoami\", help=\"Find out which huggingface.co account you are logged in as.\"\n        )\n        whoami_parser.set_defaults(func=lambda args: WhoamiCommand(args))\n        logout_parser = parser.add_parser(\"logout\", help=\"Log out\")\n        logout_parser.set_defaults(func=lambda args: LogoutCommand(args))\n\n        # new system: git-based repo system\n        repo_parser = parser.add_parser(\n            \"repo\",\n            help=\"{create, ls-files} Commands to interact with your huggingface.co repos.\",\n        )\n        repo_subparsers = repo_parser.add_subparsers(\n            help=\"huggingface.co repos related commands\"\n        )\n        ls_parser = repo_subparsers.add_parser(\n            \"ls-files\", help=\"List all your files on huggingface.co\"\n        )\n        ls_parser.add_argument(\n            \"--organization\", type=str, help=\"Optional: organization namespace.\"\n        )\n        ls_parser.set_defaults(func=lambda args: ListReposObjsCommand(args))\n        repo_create_parser = repo_subparsers.add_parser(\n            \"create\", help=\"Create a new repo on huggingface.co\"\n        )\n        repo_create_parser.add_argument(\n            \"name\",\n            type=str,\n            help=\"Name for your repo. Will be namespaced under your username to build the repo id.\",\n        )\n        repo_create_parser.add_argument(\n            \"--type\",\n            type=str,\n            help='Optional: repo_type: set to \"dataset\" or \"space\" if creating a dataset or space, default is model.',\n        )\n        repo_create_parser.add_argument(\n            \"--organization\", type=str, help=\"Optional: organization namespace.\"\n        )\n        repo_create_parser.add_argument(\n            \"-y\",\n            \"--yes\",\n            action=\"store_true\",\n            help=\"Optional: answer Yes to the prompt\",\n        )\n        repo_create_parser.set_defaults(func=lambda args: RepoCreateCommand(args))\n\n\nclass ANSI:\n    \"\"\"\n    Helper for en.wikipedia.org/wiki/ANSI_escape_code\n    \"\"\"\n\n    _bold = \"\\u001b[1m\"\n    _red = \"\\u001b[31m\"\n    _gray = \"\\u001b[90m\"\n    _reset = \"\\u001b[0m\"\n\n    @classmethod\n    def bold(cls, s):\n        return \"{}{}{}\".format(cls._bold, s, cls._reset)\n\n    @classmethod\n    def red(cls, s):\n        return \"{}{}{}\".format(cls._bold + cls._red, s, cls._reset)\n\n    @classmethod\n    def gray(cls, s):\n        return \"{}{}{}\".format(cls._gray, s, cls._reset)\n\n\ndef tabulate(rows: List[List[Union[str, int]]], headers: List[str]) -> str:\n    \"\"\"\n    Inspired by:\n\n    - stackoverflow.com/a/8356620/593036\n    - stackoverflow.com/questions/9535954/printing-lists-as-tabular-data\n    \"\"\"\n    col_widths = [max(len(str(x)) for x in col) for col in zip(*rows, headers)]\n    row_format = (\"{{:{}}} \" * len(headers)).format(*col_widths)\n    lines = []\n    lines.append(row_format.format(*headers))\n    lines.append(row_format.format(*[\"-\" * w for w in col_widths]))\n    for row in rows:\n        lines.append(row_format.format(*row))\n    return \"\\n\".join(lines)\n\n\nclass BaseUserCommand:\n    def __init__(self, args):\n        self.args = args\n        self._api = HfApi()\n\n\nclass LoginCommand(BaseUserCommand):\n    def run(self):\n        print(  # docstyle-ignore\n            \"\"\"\n        _|    _|  _|    _|    _|_|_|    _|_|_|  _|_|_|  _|      _|    _|_|_|      _|_|_|_|    _|_|      _|_|_|  _|_|_|_|\n        _|    _|  _|    _|  _|        _|          _|    _|_|    _|  _|            _|        _|    _|  _|        _|\n        _|_|_|_|  _|    _|  _|  _|_|  _|  _|_|    _|    _|  _|  _|  _|  _|_|      _|_|_|    _|_|_|_|  _|        _|_|_|\n        _|    _|  _|    _|  _|    _|  _|    _|    _|    _|    _|_|  _|    _|      _|        _|    _|  _|        _|\n        _|    _|    _|_|      _|_|_|    _|_|_|  _|_|_|  _|      _|    _|_|_|      _|        _|    _|    _|_|_|  _|_|_|_|\n\n        \"\"\"\n        )\n        username = input(\"Username: \")\n        password = getpass()\n        try:\n            token = self._api.login(username, password)\n        except HTTPError as e:\n            # probably invalid credentials, display error message.\n            print(e)\n            print(ANSI.red(e.response.text))\n            exit(1)\n        HfFolder.save_token(token)\n        print(\"Login successful\")\n        print(\"Your token has been saved to\", HfFolder.path_token)\n\n\nclass WhoamiCommand(BaseUserCommand):\n    def run(self):\n        token = HfFolder.get_token()\n        if token is None:\n            print(\"Not logged in\")\n            exit()\n        try:\n            info = self._api.whoami(token)\n            print(info[\"name\"])\n            orgs = [org[\"name\"] for org in info[\"orgs\"]]\n            if orgs:\n                print(ANSI.bold(\"orgs: \"), \",\".join(orgs))\n        except HTTPError as e:\n            print(e)\n            print(ANSI.red(e.response.text))\n            exit(1)\n\n\nclass LogoutCommand(BaseUserCommand):\n    def run(self):\n        token = HfFolder.get_token()\n        if token is None:\n            print(\"Not logged in\")\n            exit()\n        HfFolder.delete_token()\n        self._api.logout(token)\n        print(\"Successfully logged out.\")\n\n\nclass ListReposObjsCommand(BaseUserCommand):\n    def run(self):\n        token = HfFolder.get_token()\n        if token is None:\n            print(\"Not logged in\")\n            exit(1)\n        try:\n            objs = self._api.list_repos_objs(token, organization=self.args.organization)\n        except HTTPError as e:\n            print(e)\n            print(ANSI.red(e.response.text))\n            exit(1)\n        if len(objs) == 0:\n            print(\"No shared file yet\")\n            exit()\n        rows = [[obj.filename, obj.lastModified, obj.commit, obj.size] for obj in objs]\n        print(\n            tabulate(rows, headers=[\"Filename\", \"LastModified\", \"Commit-Sha\", \"Size\"])\n        )\n\n\nclass RepoCreateCommand(BaseUserCommand):\n    def run(self):\n        token = HfFolder.get_token()\n        if token is None:\n            print(\"Not logged in\")\n            exit(1)\n        try:\n            stdout = subprocess.check_output([\"git\", \"--version\"]).decode(\"utf-8\")\n            print(ANSI.gray(stdout.strip()))\n        except FileNotFoundError:\n            print(\"Looks like you do not have git installed, please install.\")\n\n        try:\n            stdout = subprocess.check_output([\"git-lfs\", \"--version\"]).decode(\"utf-8\")\n            print(ANSI.gray(stdout.strip()))\n        except FileNotFoundError:\n            print(\n                ANSI.red(\n                    \"Looks like you do not have git-lfs installed, please install.\"\n                    \" You can install from https://git-lfs.github.com/.\"\n                    \" Then run `git lfs install` (you only have to do this once).\"\n                )\n            )\n        print(\"\")\n\n        user, _ = self._api.whoami(token)\n        namespace = (\n            self.args.organization if self.args.organization is not None else user\n        )\n\n        repo_id = f\"{namespace}/{self.args.name}\"\n\n        if self.args.type not in REPO_TYPES:\n            print(\"Invalid repo --type\")\n            exit(1)\n\n        if self.args.type in REPO_TYPES_URL_PREFIXES:\n            repo_id = REPO_TYPES_URL_PREFIXES[self.args.type] + repo_id\n\n        print(\"You are about to create {}\".format(ANSI.bold(repo_id)))\n\n        if not self.args.yes:\n            choice = input(\"Proceed? [Y/n] \").lower()\n            if not (choice == \"\" or choice == \"y\" or choice == \"yes\"):\n                print(\"Abort\")\n                exit()\n        try:\n            url = self._api.create_repo(\n                token,\n                name=self.args.name,\n                organization=self.args.organization,\n                repo_type=self.args.type,\n            )\n        except HTTPError as e:\n            print(e)\n            print(ANSI.red(e.response.text))\n            exit(1)\n        print(\"\\nYour repo now lives at:\")\n        print(\"  {}\".format(ANSI.bold(url)))\n        print(\n            \"\\nYou can clone it locally with the command below,\"\n            \" and commit/push as usual.\"\n        )\n        print(f\"\\n  git clone {url}\")\n        print(\"\")\n", "path": "src/huggingface_hub/commands/user.py"}], "after_files": [{"content": "# Copyright 2020 The HuggingFace Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport subprocess\nfrom argparse import ArgumentParser\nfrom getpass import getpass\nfrom typing import List, Union\n\nfrom huggingface_hub.commands import BaseHuggingfaceCLICommand\nfrom huggingface_hub.constants import REPO_TYPES, REPO_TYPES_URL_PREFIXES\nfrom huggingface_hub.hf_api import HfApi, HfFolder\nfrom requests.exceptions import HTTPError\n\n\nclass UserCommands(BaseHuggingfaceCLICommand):\n    @staticmethod\n    def register_subcommand(parser: ArgumentParser):\n        login_parser = parser.add_parser(\n            \"login\", help=\"Log in using the same credentials as on huggingface.co\"\n        )\n        login_parser.set_defaults(func=lambda args: LoginCommand(args))\n        whoami_parser = parser.add_parser(\n            \"whoami\", help=\"Find out which huggingface.co account you are logged in as.\"\n        )\n        whoami_parser.set_defaults(func=lambda args: WhoamiCommand(args))\n        logout_parser = parser.add_parser(\"logout\", help=\"Log out\")\n        logout_parser.set_defaults(func=lambda args: LogoutCommand(args))\n\n        # new system: git-based repo system\n        repo_parser = parser.add_parser(\n            \"repo\",\n            help=\"{create, ls-files} Commands to interact with your huggingface.co repos.\",\n        )\n        repo_subparsers = repo_parser.add_subparsers(\n            help=\"huggingface.co repos related commands\"\n        )\n        ls_parser = repo_subparsers.add_parser(\n            \"ls-files\", help=\"List all your files on huggingface.co\"\n        )\n        ls_parser.add_argument(\n            \"--organization\", type=str, help=\"Optional: organization namespace.\"\n        )\n        ls_parser.set_defaults(func=lambda args: ListReposObjsCommand(args))\n        repo_create_parser = repo_subparsers.add_parser(\n            \"create\", help=\"Create a new repo on huggingface.co\"\n        )\n        repo_create_parser.add_argument(\n            \"name\",\n            type=str,\n            help=\"Name for your repo. Will be namespaced under your username to build the repo id.\",\n        )\n        repo_create_parser.add_argument(\n            \"--type\",\n            type=str,\n            help='Optional: repo_type: set to \"dataset\" or \"space\" if creating a dataset or space, default is model.',\n        )\n        repo_create_parser.add_argument(\n            \"--organization\", type=str, help=\"Optional: organization namespace.\"\n        )\n        repo_create_parser.add_argument(\n            \"-y\",\n            \"--yes\",\n            action=\"store_true\",\n            help=\"Optional: answer Yes to the prompt\",\n        )\n        repo_create_parser.set_defaults(func=lambda args: RepoCreateCommand(args))\n\n\nclass ANSI:\n    \"\"\"\n    Helper for en.wikipedia.org/wiki/ANSI_escape_code\n    \"\"\"\n\n    _bold = \"\\u001b[1m\"\n    _red = \"\\u001b[31m\"\n    _gray = \"\\u001b[90m\"\n    _reset = \"\\u001b[0m\"\n\n    @classmethod\n    def bold(cls, s):\n        return \"{}{}{}\".format(cls._bold, s, cls._reset)\n\n    @classmethod\n    def red(cls, s):\n        return \"{}{}{}\".format(cls._bold + cls._red, s, cls._reset)\n\n    @classmethod\n    def gray(cls, s):\n        return \"{}{}{}\".format(cls._gray, s, cls._reset)\n\n\ndef tabulate(rows: List[List[Union[str, int]]], headers: List[str]) -> str:\n    \"\"\"\n    Inspired by:\n\n    - stackoverflow.com/a/8356620/593036\n    - stackoverflow.com/questions/9535954/printing-lists-as-tabular-data\n    \"\"\"\n    col_widths = [max(len(str(x)) for x in col) for col in zip(*rows, headers)]\n    row_format = (\"{{:{}}} \" * len(headers)).format(*col_widths)\n    lines = []\n    lines.append(row_format.format(*headers))\n    lines.append(row_format.format(*[\"-\" * w for w in col_widths]))\n    for row in rows:\n        lines.append(row_format.format(*row))\n    return \"\\n\".join(lines)\n\n\nclass BaseUserCommand:\n    def __init__(self, args):\n        self.args = args\n        self._api = HfApi()\n\n\nclass LoginCommand(BaseUserCommand):\n    def run(self):\n        print(  # docstyle-ignore\n            \"\"\"\n        _|    _|  _|    _|    _|_|_|    _|_|_|  _|_|_|  _|      _|    _|_|_|      _|_|_|_|    _|_|      _|_|_|  _|_|_|_|\n        _|    _|  _|    _|  _|        _|          _|    _|_|    _|  _|            _|        _|    _|  _|        _|\n        _|_|_|_|  _|    _|  _|  _|_|  _|  _|_|    _|    _|  _|  _|  _|  _|_|      _|_|_|    _|_|_|_|  _|        _|_|_|\n        _|    _|  _|    _|  _|    _|  _|    _|    _|    _|    _|_|  _|    _|      _|        _|    _|  _|        _|\n        _|    _|    _|_|      _|_|_|    _|_|_|  _|_|_|  _|      _|    _|_|_|      _|        _|    _|    _|_|_|  _|_|_|_|\n\n        \"\"\"\n        )\n        username = input(\"Username: \")\n        password = getpass()\n        try:\n            token = self._api.login(username, password)\n        except HTTPError as e:\n            # probably invalid credentials, display error message.\n            print(e)\n            print(ANSI.red(e.response.text))\n            exit(1)\n        HfFolder.save_token(token)\n        print(\"Login successful\")\n        print(\"Your token has been saved to\", HfFolder.path_token)\n\n\nclass WhoamiCommand(BaseUserCommand):\n    def run(self):\n        token = HfFolder.get_token()\n        if token is None:\n            print(\"Not logged in\")\n            exit()\n        try:\n            info = self._api.whoami(token)\n            print(info[\"name\"])\n            orgs = [org[\"name\"] for org in info[\"orgs\"]]\n            if orgs:\n                print(ANSI.bold(\"orgs: \"), \",\".join(orgs))\n        except HTTPError as e:\n            print(e)\n            print(ANSI.red(e.response.text))\n            exit(1)\n\n\nclass LogoutCommand(BaseUserCommand):\n    def run(self):\n        token = HfFolder.get_token()\n        if token is None:\n            print(\"Not logged in\")\n            exit()\n        HfFolder.delete_token()\n        self._api.logout(token)\n        print(\"Successfully logged out.\")\n\n\nclass ListReposObjsCommand(BaseUserCommand):\n    def run(self):\n        token = HfFolder.get_token()\n        if token is None:\n            print(\"Not logged in\")\n            exit(1)\n        try:\n            objs = self._api.list_repos_objs(token, organization=self.args.organization)\n        except HTTPError as e:\n            print(e)\n            print(ANSI.red(e.response.text))\n            exit(1)\n        if len(objs) == 0:\n            print(\"No shared file yet\")\n            exit()\n        rows = [[obj.filename, obj.lastModified, obj.commit, obj.size] for obj in objs]\n        print(\n            tabulate(rows, headers=[\"Filename\", \"LastModified\", \"Commit-Sha\", \"Size\"])\n        )\n\n\nclass RepoCreateCommand(BaseUserCommand):\n    def run(self):\n        token = HfFolder.get_token()\n        if token is None:\n            print(\"Not logged in\")\n            exit(1)\n        try:\n            stdout = subprocess.check_output([\"git\", \"--version\"]).decode(\"utf-8\")\n            print(ANSI.gray(stdout.strip()))\n        except FileNotFoundError:\n            print(\"Looks like you do not have git installed, please install.\")\n\n        try:\n            stdout = subprocess.check_output([\"git-lfs\", \"--version\"]).decode(\"utf-8\")\n            print(ANSI.gray(stdout.strip()))\n        except FileNotFoundError:\n            print(\n                ANSI.red(\n                    \"Looks like you do not have git-lfs installed, please install.\"\n                    \" You can install from https://git-lfs.github.com/.\"\n                    \" Then run `git lfs install` (you only have to do this once).\"\n                )\n            )\n        print(\"\")\n\n        user = self._api.whoami(token)[\"name\"]\n        namespace = (\n            self.args.organization if self.args.organization is not None else user\n        )\n\n        repo_id = f\"{namespace}/{self.args.name}\"\n\n        if self.args.type not in REPO_TYPES:\n            print(\"Invalid repo --type\")\n            exit(1)\n\n        if self.args.type in REPO_TYPES_URL_PREFIXES:\n            repo_id = REPO_TYPES_URL_PREFIXES[self.args.type] + repo_id\n\n        print(\"You are about to create {}\".format(ANSI.bold(repo_id)))\n\n        if not self.args.yes:\n            choice = input(\"Proceed? [Y/n] \").lower()\n            if not (choice == \"\" or choice == \"y\" or choice == \"yes\"):\n                print(\"Abort\")\n                exit()\n        try:\n            url = self._api.create_repo(\n                token,\n                name=self.args.name,\n                organization=self.args.organization,\n                repo_type=self.args.type,\n            )\n        except HTTPError as e:\n            print(e)\n            print(ANSI.red(e.response.text))\n            exit(1)\n        print(\"\\nYour repo now lives at:\")\n        print(\"  {}\".format(ANSI.bold(url)))\n        print(\n            \"\\nYou can clone it locally with the command below,\"\n            \" and commit/push as usual.\"\n        )\n        print(f\"\\n  git clone {url}\")\n        print(\"\")\n", "path": "src/huggingface_hub/commands/user.py"}]}