Skip to content

Commit f217861

Browse files
committed
Deleted cmd2.fg and cmd2.bg which were deprecated in 2.3.0. Use cmd2.Fg and cmd2.Bg instead.
1 parent 9676f8b commit f217861

File tree

4 files changed

+3
-74
lines changed

4 files changed

+3
-74
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
## 2.3.4 (TBD, 2021)
1+
## 2.4.0 (TBD, 2021)
22
* Bug Fixes
33
* Fixed issue in `ansi.async_alert_str()` which would raise `IndexError` if prompt was blank.
44
* Fixed issue where tab completion was quoting argparse flags in some cases.
55
* Enhancements
66
* Added broader exception handling when enabling clipboard functionality via `pyperclip`.
77
* Added `PassThroughException` to `__init__.py` imports.
8+
* Deletions (potentially breaking changes)
9+
* Deleted `cmd2.fg` and `cmd2.bg` which were deprecated in 2.3.0. Use `cmd2.Fg` and `cmd2.Bg` instead.
810

911
## 2.3.3 (November 29, 2021)
1012
* Enhancements

cmd2/__init__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
RgbBg,
2929
RgbFg,
3030
TextStyle,
31-
bg, # DEPRECATED: Use Bg
32-
fg, # DEPRECATED: Use Fg
3331
style,
3432
)
3533
from .argparse_custom import (
@@ -81,8 +79,6 @@
8179
'RgbBg',
8280
'RgbFg',
8381
'TextStyle',
84-
'bg', # DEPRECATED: Use Bg
85-
'fg', # DEPRECATED: Use Fg
8682
'style',
8783
# Argparse Exports
8884
'Cmd2ArgumentParser',

cmd2/ansi.py

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -940,8 +940,6 @@ def __str__(self) -> str:
940940
return self._sequence
941941

942942

943-
# TODO: Remove this PyShadowingNames usage when deprecated fg and bg classes are removed.
944-
# noinspection PyShadowingNames
945943
def style(
946944
value: Any,
947945
*,
@@ -1086,68 +1084,3 @@ def async_alert_str(*, terminal_columns: int, prompt: str, line: str, cursor_off
10861084
# Move the cursor to the beginning of the first prompt line and print the alert
10871085
terminal_str += '\r' + alert_msg
10881086
return terminal_str
1089-
1090-
1091-
####################################################################################
1092-
# The following classes are deprecated.
1093-
####################################################################################
1094-
# noinspection PyPep8Naming
1095-
class fg(FgColor, Enum):
1096-
"""Deprecated Enum class for foreground colors. Use Fg instead."""
1097-
1098-
black = 30
1099-
red = 31
1100-
green = 32
1101-
yellow = 33
1102-
blue = 34
1103-
magenta = 35
1104-
cyan = 36
1105-
white = 37
1106-
reset = 39
1107-
bright_black = 90
1108-
bright_red = 91
1109-
bright_green = 92
1110-
bright_yellow = 93
1111-
bright_blue = 94
1112-
bright_magenta = 95
1113-
bright_cyan = 96
1114-
bright_white = 97
1115-
1116-
def __str__(self) -> str:
1117-
"""
1118-
Return ANSI color sequence instead of enum name
1119-
This is helpful when using an fg in an f-string or format() call
1120-
e.g. my_str = f"{fg.blue}hello{fg.reset}"
1121-
"""
1122-
return f"{CSI}{self.value}m"
1123-
1124-
1125-
# noinspection PyPep8Naming
1126-
class bg(BgColor, Enum):
1127-
"""Deprecated Enum class for background colors. Use Bg instead."""
1128-
1129-
black = 40
1130-
red = 41
1131-
green = 42
1132-
yellow = 43
1133-
blue = 44
1134-
magenta = 45
1135-
cyan = 46
1136-
white = 47
1137-
reset = 49
1138-
bright_black = 100
1139-
bright_red = 101
1140-
bright_green = 102
1141-
bright_yellow = 103
1142-
bright_blue = 104
1143-
bright_magenta = 105
1144-
bright_cyan = 106
1145-
bright_white = 107
1146-
1147-
def __str__(self) -> str:
1148-
"""
1149-
Return ANSI color sequence instead of enum name
1150-
This is helpful when using a bg in an f-string or format() call
1151-
e.g. my_str = f"{bg.black}hello{bg.reset}"
1152-
"""
1153-
return f"{CSI}{self.value}m"

tests/test_ansi.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,6 @@ def test_cursor():
217217
@pytest.mark.parametrize(
218218
'ansi_sequence',
219219
[
220-
ansi.fg.green,
221-
ansi.bg.blue,
222220
ansi.Fg.MAGENTA,
223221
ansi.Bg.LIGHT_GRAY,
224222
ansi.EightBitBg.CHARTREUSE_2A,

0 commit comments

Comments
 (0)