Skip to content

Commit d3b8ca8

Browse files
committed
Replace references to override_parser.py example with ones to custom_parser.py
Also: - Delete unused chunk from plugin pyproject.toml - Upgrade version of ruff used by pre-commit
1 parent 43df863 commit d3b8ca8

File tree

5 files changed

+23
-30
lines changed

5 files changed

+23
-30
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ repos:
99
- id: trailing-whitespace
1010

1111
- repo: https://github.com/astral-sh/ruff-pre-commit
12-
rev: "v0.12.1"
12+
rev: "v0.12.2"
1313
hooks:
1414
- id: ruff-format
1515
args: [--config=pyproject.toml]

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@
699699
- Added `read_input()` function that is used to read from stdin. Unlike the Python built-in
700700
`input()`, it also has an argument to disable tab completion while input is being entered.
701701
- Added capability to override the argument parser class used by cmd2 built-in commands. See
702-
override_parser.py example for more details.
702+
custom_parser.py example for more details.
703703
- Added `end` argument to `pfeedback()` to be consistent with the other print functions like
704704
`poutput()`.
705705
- Added `apply_style` to `pwarning()`.

cmd2/argparse_custom.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
parser that inherits from it. This will give a consistent look-and-feel between
77
the help/error output of built-in cmd2 commands and the app-specific commands.
88
If you wish to override the parser used by cmd2's built-in commands, see
9-
override_parser.py example.
9+
custom_parser.py example.
1010
1111
Since the new capabilities are added by patching at the argparse API level,
1212
they are available whether or not Cmd2ArgumentParser is used. However, the help

examples/README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ each:
3535
- [colors.py](https://github.com/python-cmd2/cmd2/blob/main/examples/colors.py)
3636
- Show various ways of using colorized output within a cmd2 application
3737
- [custom_parser.py](https://github.com/python-cmd2/cmd2/blob/main/examples/custom_parser.py)
38-
- Demonstrates how to create your own customer `Cmd2ArgumentParser`; used by the
39-
`override_parser.py` example
38+
- Demonstrates how to create your own customer `Cmd2ArgumentParser`
4039
- [decorator_example.py](https://github.com/python-cmd2/cmd2/blob/main/examples/decorator_example.py)
4140
- Shows how to use cmd2's various argparse decorators to processes command-line arguments
4241
- [default_categories.py](https://github.com/python-cmd2/cmd2/blob/main/examples/default_categories.py)
@@ -78,8 +77,6 @@ each:
7877
command decorators
7978
- [modular_subcommands.py](https://github.com/python-cmd2/cmd2/blob/main/examples/modular_subcommands.py)
8079
- Shows how to dynamically add and remove subcommands at runtime using `CommandSets`
81-
- [override-parser.py](https://github.com/python-cmd2/cmd2/blob/main/examples/override_parser.py)
82-
- Shows how to override cmd2's default `Cmd2ArgumentParser` with your own customer parser class
8380
- [paged_output.py](https://github.com/python-cmd2/cmd2/blob/main/examples/paged_output.py)
8481
- Shows how to use output pagination within `cmd2` apps via the `ppaged` method
8582
- [persistent_history.py](https://github.com/python-cmd2/cmd2/blob/main/examples/persistent_history.py)

plugins/ext_test/pyproject.toml

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ disallow_incomplete_defs = true
66
disallow_untyped_calls = true
77
disallow_untyped_defs = true
88
exclude = [
9-
"^examples/", # examples directory
9+
"^examples/", # examples directory
1010
"^noxfile\\.py$", # nox config file
11-
"setup\\.py$", # any files named setup.py
12-
"^tasks\\.py$", # tasks.py invoke config file
13-
"^tests/", # tests directory
11+
"setup\\.py$", # any files named setup.py
12+
"^tasks\\.py$", # tasks.py invoke config file
13+
"^tests/", # tests directory
1414
]
1515
show_column_numbers = true
1616
show_error_codes = true
@@ -82,7 +82,7 @@ select = [
8282
# "EM", # flake8-errmsg
8383
# "ERA", # eradicate
8484
# "EXE", # flake8-executable
85-
"F", # Pyflakes
85+
"F", # Pyflakes
8686
"FA", # flake8-future-annotations
8787
# "FBT", # flake8-boolean-trap
8888
"G", # flake8-logging-format
@@ -93,7 +93,7 @@ select = [
9393
# "ISC", # flake8-implicit-str-concat
9494
# "N", # pep8-naming
9595
"NPY", # NumPy-specific rules
96-
"PD", # pandas-vet
96+
"PD", # pandas-vet
9797
# "PGH", # pygrep-hooks
9898
# "PIE", # flake8-pie
9999
# "PL", # Pylint
@@ -119,21 +119,21 @@ select = [
119119
]
120120
ignore = [
121121
# `ruff rule S101` for a description of that rule
122-
"B904", # Within an `except` clause, raise exceptions with `raise ... from err` -- FIX ME
123-
"B905", # `zip()` without an explicit `strict=` parameter -- FIX ME
124-
"E501", # Line too long
125-
"EM101", # Exception must not use a string literal, assign to variable first
126-
"EXE001", # Shebang is present but file is not executable -- DO NOT FIX
127-
"G004", # Logging statement uses f-string
122+
"B904", # Within an `except` clause, raise exceptions with `raise ... from err` -- FIX ME
123+
"B905", # `zip()` without an explicit `strict=` parameter -- FIX ME
124+
"E501", # Line too long
125+
"EM101", # Exception must not use a string literal, assign to variable first
126+
"EXE001", # Shebang is present but file is not executable -- DO NOT FIX
127+
"G004", # Logging statement uses f-string
128128
"PLC1901", # `{}` can be simplified to `{}` as an empty string is falsey
129-
"PLW060", # Using global for `{name}` but no assignment is done -- DO NOT FIX
129+
"PLW060", # Using global for `{name}` but no assignment is done -- DO NOT FIX
130130
"PLW2901", # PLW2901: Redefined loop variable -- FIX ME
131-
"PT011", # `pytest.raises(Exception)` is too broad, set the `match` parameter or use a more specific exception
132-
"PT018", # Assertion should be broken down into multiple parts
133-
"S101", # Use of `assert` detected -- DO NOT FIX
134-
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes -- FIX ME
135-
"SLF001", # Private member accessed: `_Iterator` -- FIX ME
136-
"UP038", # Use `X | Y` in `{}` call instead of `(X, Y)` -- DO NOT FIX
131+
"PT011", # `pytest.raises(Exception)` is too broad, set the `match` parameter or use a more specific exception
132+
"PT018", # Assertion should be broken down into multiple parts
133+
"S101", # Use of `assert` detected -- DO NOT FIX
134+
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes -- FIX ME
135+
"SLF001", # Private member accessed: `_Iterator` -- FIX ME
136+
"UP038", # Use `X | Y` in `{}` call instead of `(X, Y)` -- DO NOT FIX
137137
]
138138

139139
# Allow fix for all enabled rules (when `--fix`) is provided.
@@ -145,10 +145,6 @@ dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
145145

146146
mccabe.max-complexity = 49
147147

148-
per-file-ignores."docs/conf.py" = [
149-
"F401", # Unused import
150-
]
151-
152148
per-file-ignores."examples/scripts/*.py" = [
153149
"F821", # Undefined name `app`
154150
]

0 commit comments

Comments
 (0)