diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2022-02-16 13:34:13 -0500 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2022-02-17 08:52:04 -0500 |
commit | f217861feae45a0a1abb56436e68c5dd859d64c0 (patch) | |
tree | 526303d9fd3fac7f33c05c1c6f15affae10773d9 | |
parent | 9676f8bf6ad62175eb7c3f091c717d3dacaaf567 (diff) | |
download | cmd2-git-f217861feae45a0a1abb56436e68c5dd859d64c0.tar.gz |
Deleted cmd2.fg and cmd2.bg which were deprecated in 2.3.0. Use cmd2.Fg and cmd2.Bg instead.
-rw-r--r-- | CHANGELOG.md | 4 | ||||
-rw-r--r-- | cmd2/__init__.py | 4 | ||||
-rw-r--r-- | cmd2/ansi.py | 67 | ||||
-rw-r--r-- | tests/test_ansi.py | 2 |
4 files changed, 3 insertions, 74 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 427be1e2..7b8d74c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,12 @@ -## 2.3.4 (TBD, 2021) +## 2.4.0 (TBD, 2021) * Bug Fixes * Fixed issue in `ansi.async_alert_str()` which would raise `IndexError` if prompt was blank. * Fixed issue where tab completion was quoting argparse flags in some cases. * Enhancements * Added broader exception handling when enabling clipboard functionality via `pyperclip`. * Added `PassThroughException` to `__init__.py` imports. +* Deletions (potentially breaking changes) + * Deleted `cmd2.fg` and `cmd2.bg` which were deprecated in 2.3.0. Use `cmd2.Fg` and `cmd2.Bg` instead. ## 2.3.3 (November 29, 2021) * Enhancements diff --git a/cmd2/__init__.py b/cmd2/__init__.py index 46dbca80..9b3fdbc3 100644 --- a/cmd2/__init__.py +++ b/cmd2/__init__.py @@ -28,8 +28,6 @@ from .ansi import ( RgbBg, RgbFg, TextStyle, - bg, # DEPRECATED: Use Bg - fg, # DEPRECATED: Use Fg style, ) from .argparse_custom import ( @@ -81,8 +79,6 @@ __all__: List[str] = [ 'RgbBg', 'RgbFg', 'TextStyle', - 'bg', # DEPRECATED: Use Bg - 'fg', # DEPRECATED: Use Fg 'style', # Argparse Exports 'Cmd2ArgumentParser', diff --git a/cmd2/ansi.py b/cmd2/ansi.py index fba6e050..badd309f 100644 --- a/cmd2/ansi.py +++ b/cmd2/ansi.py @@ -940,8 +940,6 @@ class RgbBg(BgColor): return self._sequence -# TODO: Remove this PyShadowingNames usage when deprecated fg and bg classes are removed. -# noinspection PyShadowingNames def style( value: Any, *, @@ -1086,68 +1084,3 @@ def async_alert_str(*, terminal_columns: int, prompt: str, line: str, cursor_off # Move the cursor to the beginning of the first prompt line and print the alert terminal_str += '\r' + alert_msg return terminal_str - - -#################################################################################### -# The following classes are deprecated. -#################################################################################### -# noinspection PyPep8Naming -class fg(FgColor, Enum): - """Deprecated Enum class for foreground colors. Use Fg instead.""" - - black = 30 - red = 31 - green = 32 - yellow = 33 - blue = 34 - magenta = 35 - cyan = 36 - white = 37 - reset = 39 - bright_black = 90 - bright_red = 91 - bright_green = 92 - bright_yellow = 93 - bright_blue = 94 - bright_magenta = 95 - bright_cyan = 96 - bright_white = 97 - - def __str__(self) -> str: - """ - Return ANSI color sequence instead of enum name - This is helpful when using an fg in an f-string or format() call - e.g. my_str = f"{fg.blue}hello{fg.reset}" - """ - return f"{CSI}{self.value}m" - - -# noinspection PyPep8Naming -class bg(BgColor, Enum): - """Deprecated Enum class for background colors. Use Bg instead.""" - - black = 40 - red = 41 - green = 42 - yellow = 43 - blue = 44 - magenta = 45 - cyan = 46 - white = 47 - reset = 49 - bright_black = 100 - bright_red = 101 - bright_green = 102 - bright_yellow = 103 - bright_blue = 104 - bright_magenta = 105 - bright_cyan = 106 - bright_white = 107 - - def __str__(self) -> str: - """ - Return ANSI color sequence instead of enum name - This is helpful when using a bg in an f-string or format() call - e.g. my_str = f"{bg.black}hello{bg.reset}" - """ - return f"{CSI}{self.value}m" diff --git a/tests/test_ansi.py b/tests/test_ansi.py index bed60eab..f769d718 100644 --- a/tests/test_ansi.py +++ b/tests/test_ansi.py @@ -217,8 +217,6 @@ def test_cursor(): @pytest.mark.parametrize( 'ansi_sequence', [ - ansi.fg.green, - ansi.bg.blue, ansi.Fg.MAGENTA, ansi.Bg.LIGHT_GRAY, ansi.EightBitBg.CHARTREUSE_2A, |