From eebf6475373eb3a4916d6817dbfbdcbb9202b922 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 12 Dec 2024 23:02:42 -0500 Subject: [PATCH 1/4] Add github action to codespell master on push and PRs --- .github/workflows/codespell.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/codespell.yml diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml new file mode 100644 index 0000000..12f226a --- /dev/null +++ b/.github/workflows/codespell.yml @@ -0,0 +1,25 @@ +# Codespell configuration is within setup.cfg +--- +name: Codespell + +on: + push: + branches: [master] + pull_request: + branches: [master] + +permissions: + contents: read + +jobs: + codespell: + name: Check for spelling errors + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Annotate locations with typos + uses: codespell-project/codespell-problem-matcher@v1 + - name: Codespell + uses: codespell-project/actions-codespell@v2 From 3edb27c6120b8727b1a209506615427cef1b986e Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 12 Dec 2024 23:02:42 -0500 Subject: [PATCH 2/4] Add rudimentary codespell config --- setup.cfg | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/setup.cfg b/setup.cfg index 5bf5311..ef595b5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -11,3 +11,10 @@ ignore_missing_imports = True [mypy-wcwidth.*] ignore_missing_imports = True + +[codespell] +# Ref: https://github.com/codespell-project/codespell#using-a-config-file +skip = .git*,MANIFEST.in +check-hidden = true +ignore-regex = \b(iTerm|THIRDPARTY)\b|/Softwares/ +ignore-words-list = padd,parms From f9daadc8fceca5ea56af1bcb2e4025f4604bc842 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 12 Dec 2024 23:05:24 -0500 Subject: [PATCH 3/4] [DATALAD RUNCMD] Do interactive fixing of some ambigous typos === Do not change lines below === { "chain": [], "cmd": "codespell -w -i 3 -C 2 ./tox.ini ./docs/keyboard.rst", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ --- docs/keyboard.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/keyboard.rst b/docs/keyboard.rst index 78aa8c5..613d6ff 100644 --- a/docs/keyboard.rst +++ b/docs/keyboard.rst @@ -106,7 +106,7 @@ It is therefore a recommendation to **avoid alt or meta keys entirely** in appli And instead prefer the ctrl-key combinations, maybe along with :meth:`~.Terminal.raw`, to avoid instructing users to custom-configure their terminal emulators to communicate *Alt* sequences. -If you still wish to optionall decode them, *ALT+z* becomes *Escape + z* (or, in raw form +If you still wish to optionally decode them, *ALT+z* becomes *Escape + z* (or, in raw form ``\x1bz``). This is detected by blessings as two keystrokes, ``KEY_ESCAPE`` and ``'z'``. Blessings currently provides no further assistance in detecting these key combinations. From 0e8f09dee1e741f07050ae22e6bdd057fcfd30ad Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 12 Dec 2024 23:09:12 -0500 Subject: [PATCH 4/4] [DATALAD RUNCMD] run codespell throughout fixing few left typos automagically === Do not change lines below === { "chain": [], "cmd": "codespell -w", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ --- bin/display-fpathconf.py | 2 +- bin/display-maxcanon.py | 4 ++-- bin/display-terminalinfo.py | 2 +- bin/strip.py | 2 +- blessed/formatters.py | 4 ++-- blessed/terminal.py | 6 +++--- tests/test_core.py | 2 +- tests/test_full_keyboard.py | 2 +- tests/test_keyboard.py | 4 ++-- tests/test_length_sequence.py | 2 +- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/bin/display-fpathconf.py b/bin/display-fpathconf.py index 25adf48..da0f141 100755 --- a/bin/display-fpathconf.py +++ b/bin/display-fpathconf.py @@ -30,7 +30,7 @@ def display_fpathconf(): # VEOF EOF ^D # VEOL EOL _POSIX_VDISABLE # - # irregardless, this value is almost always \xff. + # regardless, this value is almost always \xff. ('PC_VDISABLE', 'Terminal character disabling value.') ) fmt = '{name:<13} {value:<10} {description:<11}' diff --git a/bin/display-maxcanon.py b/bin/display-maxcanon.py index 021719c..d4931a4 100755 --- a/bin/display-maxcanon.py +++ b/bin/display-maxcanon.py @@ -12,7 +12,7 @@ as if it is always set." Although these tests ensure it is enabled, this is a non-op for Linux. FreeBSD supports neither, and instead uses a fraction (1/5) of the tty speed which is always 9600. -Therefor, the maximum limited input line length is 9600 / 5 = 1920. +Therefore, the maximum limited input line length is 9600 / 5 = 1920. In other words, the only way to determine the true MAX_CANON in a cross-platform manner is through this systems integrated test: the given system definitions are misleading on some operating systems. @@ -30,7 +30,7 @@ def detect_maxcanon(): """Program entry point.""" import pexpect bashrc = os.path.join( - # re-use pexpect/replwrap.py's bashrc file, + # reuse pexpect/replwrap.py's bashrc file, os.path.dirname(__file__), os.path.pardir, 'pexpect', 'bashrc.sh') child = pexpect.spawn('bash', ['--rcfile', bashrc], diff --git a/bin/display-terminalinfo.py b/bin/display-terminalinfo.py index ad41eaf..f7b6708 100755 --- a/bin/display-terminalinfo.py +++ b/bin/display-terminalinfo.py @@ -126,7 +126,7 @@ def display_bitmask(kind, bitmap, value): def display_ctl_chars(index, ctlc): - """Display all control character indicies, names, and values.""" + """Display all control character indices, names, and values.""" import termios title = 'Special Character' col1_width = len(title) diff --git a/bin/strip.py b/bin/strip.py index 1229ab7..d7b1fdb 100755 --- a/bin/strip.py +++ b/bin/strip.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -"""Example scrip that strips input of terminal sequences.""" +"""Example script that strips input of terminal sequences.""" # std imports import sys diff --git a/blessed/formatters.py b/blessed/formatters.py index 871f9ab..f5c18fb 100644 --- a/blessed/formatters.py +++ b/blessed/formatters.py @@ -353,7 +353,7 @@ def get_proxy_string(term, attr): def split_compound(compound): """ - Split compound formating string into segments. + Split compound formatting string into segments. >>> split_compound('bold_underline_bright_blue_on_red') ['bold', 'underline', 'bright_blue', 'on_red'] @@ -361,7 +361,7 @@ def split_compound(compound): :arg str compound: a string that may contain compounds, separated by underline (``_``). :rtype: list - :returns: List of formating string segments + :returns: List of formatting string segments """ merged_segs = [] # These occur only as prefixes, so they can always be merged: diff --git a/blessed/terminal.py b/blessed/terminal.py index e6b6876..8d0b86d 100644 --- a/blessed/terminal.py +++ b/blessed/terminal.py @@ -421,7 +421,7 @@ def width(self): @property def pixel_height(self): """ - Read-only property: Height ofthe terminal (in pixels). + Read-only property: Height of the terminal (in pixels). :rtype: int """ @@ -578,7 +578,7 @@ def location(self, x=None, y=None): .. note:: The argument order *(x, y)* differs from the return value order *(y, x)* of :meth:`get_location`, or argument order *(y, x)* of :meth:`move`. This is - for API Compaibility with the blessings library, sorry for the trouble! + for API Compatibility with the blessings library, sorry for the trouble! """ # pylint: disable=invalid-name # Invalid argument name "x" @@ -1250,7 +1250,7 @@ def getch(self): the keyboard string at a time. This method should always return without blocking if called after :meth:`kbhit` has returned True. - Implementors of alternate input stream methods should override + Implementers of alternate input stream methods should override this method. """ assert self._keyboard_fd is not None diff --git a/tests/test_core.py b/tests/test_core.py index cb6cf6f..6b30d51 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -458,7 +458,7 @@ def test_time_left_infinite_None(): assert _time_left(stime=time.time(), timeout=None) is None -@pytest.mark.skipif(IS_WINDOWS, reason="cant multiprocess") +@pytest.mark.skipif(IS_WINDOWS, reason="can't multiprocess") def test_termcap_repr(): """Ensure ``hidden_cursor()`` writes hide_cursor and normal_cursor.""" diff --git a/tests/test_full_keyboard.py b/tests/test_full_keyboard.py index e5fafde..e8d8fdd 100644 --- a/tests/test_full_keyboard.py +++ b/tests/test_full_keyboard.py @@ -311,7 +311,7 @@ def test_keystroke_0s_cbreak_multibyte_utf8(): assert math.floor(time.time() - stime) == 0.0 -# Avylove: Added delay which should account for race contition. Re-add skip if randomly fail +# Avylove: Added delay which should account for race condition. Re-add skip if randomly fail # @pytest.mark.skipif(os.environ.get('TRAVIS', None) is not None, # reason="travis-ci does not handle ^C very well.") @pytest.mark.skipif(platform.system() == 'Darwin', diff --git a/tests/test_keyboard.py b/tests/test_keyboard.py index 6039a48..6517c10 100644 --- a/tests/test_keyboard.py +++ b/tests/test_keyboard.py @@ -69,7 +69,7 @@ def child(): def test_notty_kb_is_None(): """term._keyboard_fd should be None when os.isatty returns False.""" - # in this scenerio, stream is sys.__stdout__, + # in this scenario, stream is sys.__stdout__, # but os.isatty(0) is False, # such as when piping output to less(1) @as_subprocess @@ -227,7 +227,7 @@ def test_resolve_sequence(): # takes precedence over LONGSEQ, first-match (u'KEY_LONGSEQ_longest', 3), (u'LONGSEQ', 4), - # wont match, LONGSEQ is first-match in this order + # won't match, LONGSEQ is first-match in this order (u'LONGSEQ_longer', 5), # falls through for L{anything_else} (u'L', 6))) diff --git a/tests/test_length_sequence.py b/tests/test_length_sequence.py index cc45ba1..a12fec2 100644 --- a/tests/test_length_sequence.py +++ b/tests/test_length_sequence.py @@ -292,7 +292,7 @@ def child(kind): assert (term.length(term.cud(10)) == 0) # this is how manpages perform underlining, this is done - # with the 'overstrike' capability of teletypes, and aparently + # with the 'overstrike' capability of teletypes, and apparently # less(1), '123' -> '1\b_2\b_3\b_' text_wseqs = u''.join(itertools.chain( *zip(plain_text, itertools.cycle(['\b_']))))