Skip to content

Commit

Permalink
Fix listing of subcommands for "ipython profile" and "ipython history…
Browse files Browse the repository at this point in the history
…". (#14421)

The previous code (likely going back to Py2) would print

    Must specify one of: dict_keys(['create', 'list', 'locate'])

This PR fixes it to

    Must specify one of: 'create', 'list', 'locate'.
  • Loading branch information
Carreau committed May 6, 2024
2 parents 85bb530 + d34e2fd commit 51f1187
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
8 changes: 5 additions & 3 deletions IPython/core/historyapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,11 @@ class HistoryApp(Application):

def start(self):
if self.subapp is None:
print("No subcommand specified. Must specify one of: %s" % \
(self.subcommands.keys()))
print()
print(
"No subcommand specified. Must specify one of: "
+ ", ".join(map(repr, self.subcommands))
+ ".\n"
)
self.print_description()
self.print_subcommands()
self.exit(1)
Expand Down
7 changes: 5 additions & 2 deletions IPython/core/profileapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,11 @@ class ProfileApp(Application):

def start(self):
if self.subapp is None:
print("No subcommand specified. Must specify one of: %s"%(self.subcommands.keys()))
print()
print(
"No subcommand specified. Must specify one of: "
+ ", ".join(map(repr, self.subcommands))
+ ".\n"
)
self.print_description()
self.print_subcommands()
self.exit(1)
Expand Down

0 comments on commit 51f1187

Please sign in to comment.