From a34e33ee878e96f9fc53d3606fafd19ab037cbb8 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Tue, 13 Feb 2024 23:30:54 -0500 Subject: [PATCH 1/9] Add github action to codespell master on push and PRs --- .github/workflows/codespell.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 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 00000000..22650fda --- /dev/null +++ b/.github/workflows/codespell.yml @@ -0,0 +1,23 @@ +# Codespell configuration is within pyproject.toml +--- +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: Codespell + uses: codespell-project/actions-codespell@v2 From b5891c7735451d98962015913b20070c10867cdf Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Tue, 13 Feb 2024 23:30:54 -0500 Subject: [PATCH 2/9] Add rudimentary codespell config --- pyproject.toml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 77145f48..464ab429 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -61,3 +61,10 @@ exclude = [ "tests/.mypy_cache", "update_pyparsing_timestamp.py", ] + +[tool.codespell] +# Ref: https://github.com/codespell-project/codespell#using-a-config-file +skip = '.git' +check-hidden = true +# ignore-regex = '' +# ignore-words-list = '' From 48e41d38c397f2ebfe6a79c00b76866b88000d48 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Tue, 13 Feb 2024 23:30:54 -0500 Subject: [PATCH 3/9] Add pre-commit definition for codespell --- .pre-commit-config.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 799985da..16579325 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,3 +4,11 @@ repos: hooks: - id: black language_version: python3.6 + +# Configuration for codespell is in pyproject.toml +- repo: https://github.com/codespell-project/codespell + rev: v2.2.6 + hooks: + - id: codespell + additional_dependencies: + - tomli From ba14369de9527fb6e2a88b146907cdf9aea4e754 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Tue, 13 Feb 2024 23:41:07 -0500 Subject: [PATCH 4/9] Custom skips for codespell --- pyproject.toml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 464ab429..56a561db 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,7 +64,8 @@ exclude = [ [tool.codespell] # Ref: https://github.com/codespell-project/codespell#using-a-config-file -skip = '.git' +skip = '.git,hola_mundo.py' check-hidden = true -# ignore-regex = '' -# ignore-words-list = '' +# case sensitive names, lines likely with regexpressions +ignore-regex = '\b(OnlyOnce|fontEnd|Nd|Ned|Bu|Donn|[a-zA-Z]*\*[a-zA-Z]*)\b|.*\(.*\|.*\).*|itemsvisibles visibles' +ignore-words-list = 'inout,halp,strng,te,ans,strin,datas,helpe,fourty' From a6dd0a4cc23e61036f7e024472351f7737fb56ba Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Tue, 13 Feb 2024 23:41:26 -0500 Subject: [PATCH 5/9] [DATALAD RUNCMD] Fix comparitor to be comparator === Do not change lines below === { "chain": [], "cmd": "git-sedi comparitor comparator", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ --- tests/test_unit.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/test_unit.py b/tests/test_unit.py index 8b2ae5ad..80ded51b 100644 --- a/tests/test_unit.py +++ b/tests/test_unit.py @@ -3505,16 +3505,16 @@ def keywords(name): modifier_key = charString1 # relations - comparitor_symbol = oneOf(RELATION_SYMBOLS) - named_comparitors = keywords("comparitors") - comparitor = Group(comparitor_symbol | named_comparitors)("comparitor") - comparitor.addParseAction(_set_info) + comparator_symbol = oneOf(RELATION_SYMBOLS) + named_comparators = keywords("comparators") + comparator = Group(comparator_symbol | named_comparators)("comparator") + comparator.addParseAction(_set_info) def modifier_list1(key): modifier = Dict( Literal("/") + Group(modifier_key(key))("name") - + Optional(comparitor_symbol("symbol") + term("value")) + + Optional(comparator_symbol("symbol") + term("value")) )("modifier") modifier.addParseAction(_set_info) return ZeroOrMore(modifier)("modifier_list") @@ -3523,7 +3523,7 @@ def modifier_list2(key): modifier = Dict( Literal("/") + Group(modifier_key(key))("name") - + Optional(comparitor_symbol("symbol") + term("value")), + + Optional(comparator_symbol("symbol") + term("value")), asdict=True, )("modifier") modifier.addParseAction(_set_info) @@ -3534,7 +3534,7 @@ def modifier_list3(key): Dict( Literal("/") + Group(modifier_key(key))("name") - + Optional(comparitor_symbol("symbol") + term("value")) + + Optional(comparator_symbol("symbol") + term("value")) ) ) modifier.addParseAction(_set_info) @@ -3544,7 +3544,7 @@ def modifier_list4(key): modifier = Dict( Literal("/") + Group(modifier_key(key))("name") - + Optional(comparitor_symbol("symbol") + term("value")), + + Optional(comparator_symbol("symbol") + term("value")), asdict=True, ) modifier.addParseAction(_set_info) From 2c9f053889cef70b4bc4c67042a73a7a29e37729 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Tue, 13 Feb 2024 23:42:37 -0500 Subject: [PATCH 6/9] Style pre-commit config the same way as prior section --- .pre-commit-config.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 16579325..4630a73f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,10 +5,10 @@ repos: - id: black language_version: python3.6 -# Configuration for codespell is in pyproject.toml -- repo: https://github.com/codespell-project/codespell - rev: v2.2.6 - hooks: - - id: codespell - additional_dependencies: - - tomli +- repo: https://github.com/codespell-project/codespell + # Configuration for codespell is in pyproject.toml + rev: v2.2.6 + hooks: + - id: codespell + additional_dependencies: + - tomli From bac665cadc0a4df9a188c1c48868ffb93e13073a Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Tue, 13 Feb 2024 23:43:32 -0500 Subject: [PATCH 7/9] TMP: add typo --- README.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/README.rst b/README.rst index 24d603c7..4127eeff 100644 --- a/README.rst +++ b/README.rst @@ -91,3 +91,4 @@ See `CHANGES `__ fil .. |Snyk Score| image:: https://snyk.io//advisor/python/pyparsing/badge.svg :target: https://snyk.io//advisor/python/pyparsing :alt: pyparsing +Installating From 5169aaa5510bb87e062ea18336617d8a1fd7c213 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 15 Feb 2024 15:31:29 -0500 Subject: [PATCH 8/9] [DATALAD RUNCMD] run codespell throughout fixing typo automagically === Do not change lines below === { "chain": [], "cmd": "codespell -w", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ --- CHANGES | 8 ++++---- README.rst | 2 +- examples/bf.py | 2 +- tests/json_parser_tests.py | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGES b/CHANGES index 9d999e29..1b3183a9 100644 --- a/CHANGES +++ b/CHANGES @@ -2321,7 +2321,7 @@ Version 2.1.0 - February, 2016 aristotle2600 on reddit. - Removed keepOriginalText helper method, which was deprecated ages ago. - Superceded by originalTextFor. + Superseded by originalTextFor. - Same for the Upcase class, which was long ago deprecated and replaced with the upcaseTokens method. @@ -2605,7 +2605,7 @@ Version 1.5.6 - June, 2011 and robust in the face of future Python versions - much thanks to Raymond Hettinger for this rewrite! -- Removal of exception cacheing, addressing a memory leak condition +- Removal of exception caching, addressing a memory leak condition in Python 3. Thanks to Michael Droettboom and the Cape Town PUG for their analysis and work on this problem! @@ -3583,7 +3583,7 @@ Version 1.4.2 - April 1, 2006 (No foolin'!) 2004, so I'm guessing people really shouldn't have been using this feature - I'll drop it altogether in the next release, which will allow users to return a tuple from a parse action (which is really - handy when trying to reconstuct tuples from a tuple string + handy when trying to reconstruct tuples from a tuple string representation!). @@ -4029,7 +4029,7 @@ Version 1.2beta2 - 19 May 2004 sample Delphi forms as tests. (Well done, Dang!) - Another performance speedup, 5-10%, inspired by Dang! Plus about a 20% - speedup, by pre-constructing and cacheing exception objects instead of + speedup, by pre-constructing and caching exception objects instead of constructing them on the fly. - Fixed minor bug when specifying oneOf() with 'caseless=True'. diff --git a/README.rst b/README.rst index 4127eeff..4aa37a18 100644 --- a/README.rst +++ b/README.rst @@ -91,4 +91,4 @@ See `CHANGES `__ fil .. |Snyk Score| image:: https://snyk.io//advisor/python/pyparsing/badge.svg :target: https://snyk.io//advisor/python/pyparsing :alt: pyparsing -Installating +Installing diff --git a/examples/bf.py b/examples/bf.py index 76144295..dbb0e8ef 100644 --- a/examples/bf.py +++ b/examples/bf.py @@ -15,7 +15,7 @@ # define the basic parser -# define Literals for each symbol in the BF langauge +# define Literals for each symbol in the BF language PLUS, MINUS, GT, LT, INP, OUT, LBRACK, RBRACK = pp.Literal.using_each("+-<>,.[]") # use a pyparsing Forward for the recursive definition of an instruction that can diff --git a/tests/json_parser_tests.py b/tests/json_parser_tests.py index 1b8c058d..b2603732 100644 --- a/tests/json_parser_tests.py +++ b/tests/json_parser_tests.py @@ -156,7 +156,7 @@ /* Defines the implementation of org.cofax.Redirection that Cofax will use. If this Redirection class does not suit - your needs simply implenet a new Redirection class + your needs simply implement a new Redirection class and set here. */ "redirectionClass": "org.cofax.SqlRedirection", From 4ecf11b0a0ff7d9111c431ed8d9a738fced6997e Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 15 Feb 2024 15:33:38 -0500 Subject: [PATCH 9/9] Add pre-commit workflow this particular setup borrowed from lark's mypy workflow --- .github/workflows/pre-commit.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .github/workflows/pre-commit.yml diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 00000000..3da32f4a --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,10 @@ +name: Pre-commit +on: [push, pull_request] +jobs: + pre-commit: + name: Format + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + - uses: pre-commit/action@v3.0.1