Skip to content

Commit 1a4b13c

Browse files
committed
Removed unnecessary use of pass
1 parent ada27c5 commit 1a4b13c

17 files changed

+6
-54
lines changed

cmd2/ansi.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,11 @@ def __radd__(self, other: Any) -> str:
211211
class FgColor(AnsiSequence):
212212
"""Base class for ANSI Sequences which set foreground text color"""
213213

214-
pass
215214

216215

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

220-
pass
221219

222220

223221
####################################################################################

cmd2/cmd2.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2463,7 +2463,6 @@ def preloop(self) -> None:
24632463
to run hooks before the command loop begins. See
24642464
[Hooks](../features/hooks.md) for more information.
24652465
"""
2466-
pass
24672466

24682467
def postloop(self) -> None:
24692468
"""Hook method executed once when the [cmd2.Cmd.cmdloop][] method is about to return.
@@ -2472,7 +2471,6 @@ def postloop(self) -> None:
24722471
to run hooks after the command loop completes. See
24732472
[Hooks](../features/hooks.md) for more information.
24742473
"""
2475-
pass
24762474

24772475
def parseline(self, line: str) -> tuple[str, str, str]:
24782476
"""Parse the line into a command name and a string containing the arguments.

cmd2/command_definition.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,12 @@ def on_registered(self) -> None:
136136
Subclasses can override this to perform custom steps related to the newly added commands (e.g. setting
137137
them to a disabled state).
138138
"""
139-
pass
140139

141140
def on_unregister(self) -> None:
142141
"""
143142
Called by ``cmd2.Cmd`` as the first step to unregistering a CommandSet. Subclasses can override this to
144143
perform any cleanup steps which require their commands being registered in the CLI.
145144
"""
146-
pass
147145

148146
def on_unregistered(self) -> None:
149147
"""

cmd2/exceptions.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ class SkipPostcommandHooks(Exception):
1515
hooks, but not bad enough to print the exception to the user.
1616
"""
1717

18-
pass
1918

2019

2120
class Cmd2ArgparseError(SkipPostcommandHooks):
@@ -26,7 +25,6 @@ class Cmd2ArgparseError(SkipPostcommandHooks):
2625
after parsing fails, just return instead of raising an exception.
2726
"""
2827

29-
pass
3028

3129

3230
class CommandSetRegistrationError(Exception):
@@ -35,7 +33,6 @@ class CommandSetRegistrationError(Exception):
3533
from a cmd2 application.
3634
"""
3735

38-
pass
3936

4037

4138
class CompletionError(Exception):
@@ -86,22 +83,18 @@ def __init__(self, *args: Any, wrapped_ex: BaseException) -> None:
8683
class Cmd2ShlexError(Exception):
8784
"""Raised when shlex fails to parse a command line string in StatementParser"""
8885

89-
pass
9086

9187

9288
class EmbeddedConsoleExit(SystemExit):
9389
"""Custom exception class for use with the py command."""
9490

95-
pass
9691

9792

9893
class EmptyStatement(Exception):
9994
"""Custom exception class for handling behavior when the user just presses <Enter>."""
10095

101-
pass
10296

10397

10498
class RedirectionError(Exception):
10599
"""Custom exception class for when redirecting or piping output fails"""
106100

107-
pass

examples/alias_startup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ def __init__(self):
1818

1919
def do_nothing(self, args):
2020
"""This command does nothing and produces no output."""
21-
pass
2221

2322

2423
if __name__ == '__main__':

examples/async_printing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def _get_alerts(self) -> list[str]:
108108
if rand_num > 2:
109109
return []
110110

111-
for i in range(0, rand_num):
111+
for i in range(rand_num):
112112
self._alert_count += 1
113113
alerts.append(f"Alert {self._alert_count}")
114114

examples/default_categories.py

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

17-
pass
1817

1918

2019
class ChildInheritsParentCategories(MyBaseCommandSet):

plugins/tasks.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
@invoke.task()
4040
def pytest(_):
4141
"""Run tests and code coverage using pytest"""
42-
pass
4342

4443

4544
namespace.add_task(pytest)
@@ -48,7 +47,6 @@ def pytest(_):
4847
@invoke.task(pre=[ext_test_tasks.pytest_clean])
4948
def pytest_clean(_):
5049
"""Remove pytest cache and code coverage files and directories"""
51-
pass
5250

5351

5452
namespace_clean.add_task(pytest_clean, 'pytest')
@@ -57,7 +55,6 @@ def pytest_clean(_):
5755
@invoke.task(pre=[ext_test_tasks.mypy])
5856
def mypy(_):
5957
"""Run mypy optional static type checker"""
60-
pass
6158

6259

6360
namespace.add_task(mypy)
@@ -67,7 +64,6 @@ def mypy(_):
6764
def mypy_clean(_):
6865
"""Remove mypy cache directory"""
6966
# pylint: disable=unused-argument
70-
pass
7167

7268

7369
namespace_clean.add_task(mypy_clean, 'mypy')
@@ -85,7 +81,6 @@ def mypy_clean(_):
8581
@invoke.task(pre=[ext_test_tasks.build_clean])
8682
def build_clean(_):
8783
"""Remove the build directory"""
88-
pass
8984

9085

9186
namespace_clean.add_task(build_clean, 'build')
@@ -94,7 +89,6 @@ def build_clean(_):
9489
@invoke.task(pre=[ext_test_tasks.dist_clean])
9590
def dist_clean(_):
9691
"""Remove the dist directory"""
97-
pass
9892

9993

10094
namespace_clean.add_task(dist_clean, 'dist')
@@ -108,7 +102,6 @@ def dist_clean(_):
108102
def clean_all(_):
109103
"""Run all clean tasks"""
110104
# pylint: disable=unused-argument
111-
pass
112105

113106

114107
namespace_clean.add_task(clean_all, 'all')
@@ -117,7 +110,6 @@ def clean_all(_):
117110
@invoke.task(pre=[clean_all], post=[ext_test_tasks.sdist])
118111
def sdist(_):
119112
"""Create a source distribution"""
120-
pass
121113

122114

123115
namespace.add_task(sdist)
@@ -126,7 +118,6 @@ def sdist(_):
126118
@invoke.task(pre=[clean_all], post=[ext_test_tasks.wheel])
127119
def wheel(_):
128120
"""Build a wheel distribution"""
129-
pass
130121

131122

132123
namespace.add_task(wheel)

plugins/template/tasks.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ def bytecode_clean(context):
160160
def clean_all(context):
161161
"""Run all clean tasks"""
162162
# pylint: disable=unused-argument
163-
pass
164163

165164

166165
namespace_clean.add_task(clean_all, 'all')

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,9 @@ select = [
194194
"PD", # pandas-vet (Pandas specific rules)
195195
"PERF", # Perflint (warn about performance issues)
196196
"PGH", # pygrep-hooks (force specific rule codes when ignoring type or linter issues on a line)
197-
# "PIE", # flake8-pie (eliminate unnecessary use of pass, range starting at 0, etc.)
198-
"PLC", # Pylint Conventions
199-
"PLE", # Pylint Errors
197+
"PIE", # flake8-pie (eliminate unnecessary use of pass, range starting at 0, etc.)
198+
"PLC", # Pylint Conventions
199+
"PLE", # Pylint Errors
200200
# "PLR", # Pylint Refactoring suggestions
201201
# "PLW", # Pylint Warnings
202202
# "PT", # flake8-pytest-style (warnings about unit test best practices)

0 commit comments

Comments
 (0)