Skip to content

Commit 47a52ad

Browse files
committed
Enable ruff PIE ruleset and fix related issues
1 parent 1a4b13c commit 47a52ad

File tree

7 files changed

+9
-20
lines changed

7 files changed

+9
-20
lines changed

cmd2/ansi.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,12 +212,10 @@ class FgColor(AnsiSequence):
212212
"""Base class for ANSI Sequences which set foreground text color"""
213213

214214

215-
216215
class BgColor(AnsiSequence):
217216
"""Base class for ANSI Sequences which set background text color"""
218217

219218

220-
221219
####################################################################################
222220
# Implementations intended for direct use
223221
####################################################################################

cmd2/exceptions.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ class SkipPostcommandHooks(Exception):
1616
"""
1717

1818

19-
2019
class Cmd2ArgparseError(SkipPostcommandHooks):
2120
"""
2221
A ``SkipPostcommandHooks`` exception for when a command fails to parse its arguments.
@@ -26,15 +25,13 @@ class Cmd2ArgparseError(SkipPostcommandHooks):
2625
"""
2726

2827

29-
3028
class CommandSetRegistrationError(Exception):
3129
"""
3230
Exception that can be thrown when an error occurs while a CommandSet is being added or removed
3331
from a cmd2 application.
3432
"""
3533

3634

37-
3835
class CompletionError(Exception):
3936
"""
4037
Raised during tab completion operations to report any sort of error you want printed. This can also be used
@@ -84,17 +81,13 @@ class Cmd2ShlexError(Exception):
8481
"""Raised when shlex fails to parse a command line string in StatementParser"""
8582

8683

87-
8884
class EmbeddedConsoleExit(SystemExit):
8985
"""Custom exception class for use with the py command."""
9086

9187

92-
9388
class EmptyStatement(Exception):
9489
"""Custom exception class for handling behavior when the user just presses <Enter>."""
9590

9691

97-
9892
class RedirectionError(Exception):
9993
"""Custom exception class for when redirecting or piping output fails"""
100-

examples/default_categories.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ class MyBaseCommandSet(CommandSet):
1515
"""Defines a default category for all sub-class CommandSets"""
1616

1717

18-
1918
class ChildInheritsParentCategories(MyBaseCommandSet):
2019
"""
2120
This subclass doesn't declare any categories so all commands here are also categorized under 'Default Category'

plugins/ext_test/tasks.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ def dist_clean(context):
144144
def clean_all(context):
145145
"""Run all clean tasks"""
146146
# pylint: disable=unused-argument
147-
pass
148147

149148

150149
namespace_clean.add_task(clean_all, 'all')

tests/test_argparse.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,9 +293,9 @@ def base_helpless(self, args):
293293
# This subcommand has aliases and no help text. It exists to prevent changes to _set_parser_prog() which
294294
# use an approach which relies on action._choices_actions list. See comment in that function for more
295295
# details.
296-
parser_bar = base_subparsers.add_parser('helpless', aliases=['helpless_1', 'helpless_2'])
297-
parser_bar.add_argument('z', help='string')
298-
parser_bar.set_defaults(func=base_bar)
296+
parser_helpless = base_subparsers.add_parser('helpless', aliases=['helpless_1', 'helpless_2'])
297+
parser_helpless.add_argument('z', help='string')
298+
parser_helpless.set_defaults(func=base_bar)
299299

300300
@cmd2.with_argparser(base_parser)
301301
def do_base(self, args):

tests/test_argparse_completer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,10 +1263,10 @@ def _subcmd_no_custom(self, args: argparse.Namespace) -> None:
12631263
pass
12641264

12651265
# Parser for a subcommand with a custom completer type
1266-
custom_completer_parser = Cmd2ArgumentParser(description="Custom completer", ap_completer_type=CustomCompleter)
1267-
custom_completer_parser.add_argument('--myflag', complete_when_ready=True)
1266+
custom_completer_parser2 = Cmd2ArgumentParser(description="Custom completer", ap_completer_type=CustomCompleter)
1267+
custom_completer_parser2.add_argument('--myflag', complete_when_ready=True)
12681268

1269-
@cmd2.as_subcommand_to('top', 'custom', custom_completer_parser, help="custom completer")
1269+
@cmd2.as_subcommand_to('top', 'custom', custom_completer_parser2, help="custom completer")
12701270
def _subcmd_custom(self, args: argparse.Namespace) -> None:
12711271
pass
12721272

tests_isolated/test_commandset/test_argparse_subcommands.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ def base_helpless(self, args):
5050
# This subcommand has aliases and no help text. It exists to prevent changes to _set_parser_prog() which
5151
# use an approach which relies on action._choices_actions list. See comment in that function for more
5252
# details.
53-
parser_bar = base_subparsers.add_parser('helpless', aliases=['helpless_1', 'helpless_2'])
54-
parser_bar.add_argument('z', help='string')
55-
parser_bar.set_defaults(func=base_bar)
53+
parser_helpless = base_subparsers.add_parser('helpless', aliases=['helpless_1', 'helpless_2'])
54+
parser_helpless.add_argument('z', help='string')
55+
parser_helpless.set_defaults(func=base_bar)
5656

5757
@cmd2.with_argparser(base_parser)
5858
def do_base(self, args):

0 commit comments

Comments
 (0)