Skip to content

Commit 6d00a49

Browse files
committed
Bunch of random clenaups and fixes
1 parent 4049c1d commit 6d00a49

38 files changed

+13
-78
lines changed

cmd2/argparse_custom.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -977,7 +977,7 @@ def _ArgumentParser_check_value(self: argparse.ArgumentParser, action: argparse.
977977
############################################################################################################
978978

979979

980-
def _SubParsersAction_remove_parser(self: argparse._SubParsersAction, name: str) -> None: # type: ignore
980+
def _SubParsersAction_remove_parser(self: argparse._SubParsersAction, name: str) -> None: # type: ignore[type-arg]
981981
"""
982982
Removes a sub-parser from a sub-parsers group. Used to remove subcommands from a parser.
983983
@@ -1289,7 +1289,7 @@ def __init__(
12891289

12901290
self.set_ap_completer_type(ap_completer_type) # type: ignore[attr-defined]
12911291

1292-
def add_subparsers(self, **kwargs: Any) -> argparse._SubParsersAction: # type: ignore
1292+
def add_subparsers(self, **kwargs: Any) -> argparse._SubParsersAction: # type: ignore[type-arg]
12931293
"""
12941294
Custom override. Sets a default title if one was not given.
12951295

cmd2/cmd2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4599,7 +4599,7 @@ def do_ipy(self, _: argparse.Namespace) -> Optional[bool]: # pragma: no cover
45994599

46004600
# Allow users to install ipython from a cmd2 prompt when needed and still have ipy command work
46014601
try:
4602-
start_ipython # noqa F823
4602+
start_ipython # noqa: F823
46034603
except NameError:
46044604
from IPython import start_ipython # type: ignore[import]
46054605

@@ -4636,7 +4636,7 @@ def do_ipy(self, _: argparse.Namespace) -> Optional[bool]: # pragma: no cover
46364636
local_vars['self'] = self
46374637

46384638
# Configure IPython
4639-
config = TraitletsLoader.Config() # type: ignore
4639+
config = TraitletsLoader.Config()
46404640
config.InteractiveShell.banner2 = (
46414641
'Entering an IPython shell. Type exit, quit, or Ctrl-D to exit.\n'
46424642
f'Run CLI commands with: {self.py_bridge_name}("command ...")\n'

cmd2/constants.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#
21
"""This module contains constants used throughout ``cmd2``."""
32

43
# Unless documented in https://cmd2.readthedocs.io/en/latest/api/index.html

cmd2/parsing.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#
21
"""Statement parsing classes for cmd2"""
32

43
import re

cmd2/plugin.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#
21
"""Classes for the cmd2 plugin system"""
32

43
from dataclasses import (

cmd2/transcript.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#
21
"""Machinery for running and validating transcripts.
32
43
If the user wants to run a transcript (see docs/transcript.rst),

examples/modular_commands/commandset_complex.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# coding=utf-8
2-
# flake8: noqa E302
31
"""
42
Test CommandSet
53
"""

examples/override_parser.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
#!/usr/bin/env python
2-
# coding=utf-8
3-
# flake8: noqa F402
42
"""
53
The standard parser used by cmd2 built-in commands is Cmd2ArgumentParser.
64
The following code shows how to override it with your own parser class.

examples/scripts/conditional.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# coding=utf-8
2-
# flake8: noqa F821
31
"""
42
This is a Python script intended to be used with the "python_scripting.py" cmd2 example application.
53

examples/scripts/save_help_text.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# coding=utf-8
2-
# flake8: noqa F821
31
"""
42
A cmd2 script that saves the help text for every command, subcommand, and topic to a file.
53
This is meant to be run within a cmd2 session using run_pyscript.
@@ -29,9 +27,7 @@ def get_sub_commands(parser: argparse.ArgumentParser) -> List[str]:
2927
sub_cmds.append(sub_cmd)
3028

3129
# Look for nested subcommands
32-
for nested_sub_cmd in get_sub_commands(sub_cmd_parser):
33-
sub_cmds.append('{} {}'.format(sub_cmd, nested_sub_cmd))
34-
30+
sub_cmds.extend(f'{sub_cmd} {nested_sub_cmd}' for nested_sub_cmd in get_sub_commands(sub_cmd_parser))
3531
break
3632

3733
sub_cmds.sort()

0 commit comments

Comments
 (0)