From babbe22870f7f2c6d345b97f93eb028daaed7559 Mon Sep 17 00:00:00 2001 From: Nytelife26 Date: Tue, 6 Jul 2021 18:51:25 +0100 Subject: [PATCH 1/3] ci(lint-test): switch pycodestyle -> flake8 --- .github/workflows/ci-lint-test.yml | 2 +- poetry.lock | 78 +++++++++++++++++++++++++++++- pyproject.toml | 8 ++- run_ci_checks.sh | 2 +- 4 files changed, 82 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci-lint-test.yml b/.github/workflows/ci-lint-test.yml index de9894fa6..6f3aaaa15 100644 --- a/.github/workflows/ci-lint-test.yml +++ b/.github/workflows/ci-lint-test.yml @@ -32,7 +32,7 @@ jobs: if: ${{ !steps.cache-restore.outputs.cache-hit }} run: pip install poetry && poetry install - name: "[EXEC] Lint" - run: poetry run pycodestyle --config pyproject.toml . && poetry run pydocstyle . + run: poetry run flake8 proselint && poetry run pydocstyle proselint test-cover: name: Test & Cover if: "!(contains(github.event.head_commit.message, '[skip_ci]'))" diff --git a/poetry.lock b/poetry.lock index 82113d9c3..5cfd383a6 100644 --- a/poetry.lock +++ b/poetry.lock @@ -171,6 +171,46 @@ category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +[[package]] +name = "flake8" +version = "3.9.2" +description = "the modular source code checker: pep8 pyflakes and co" +category = "dev" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" + +[package.dependencies] +importlib-metadata = {version = "*", markers = "python_version < \"3.8\""} +mccabe = ">=0.6.0,<0.7.0" +pycodestyle = ">=2.7.0,<2.8.0" +pyflakes = ">=2.3.0,<2.4.0" + +[[package]] +name = "flake8-bugbear" +version = "21.4.3" +description = "A plugin for flake8 finding likely bugs and design problems in your program. Contains warnings that don't belong in pyflakes and pycodestyle." +category = "dev" +optional = false +python-versions = ">=3.6" + +[package.dependencies] +attrs = ">=19.2.0" +flake8 = ">=3.0.0" + +[package.extras] +dev = ["coverage", "black", "hypothesis", "hypothesmith"] + +[[package]] +name = "flake8-import-order" +version = "0.18.1" +description = "Flake8 and pylama plugin that checks the ordering of import statements." +category = "dev" +optional = false +python-versions = "*" + +[package.dependencies] +pycodestyle = "*" + [[package]] name = "flask" version = "2.0.1" @@ -365,6 +405,14 @@ category = "dev" optional = false python-versions = ">=3.6" +[[package]] +name = "mccabe" +version = "0.6.1" +description = "McCabe checker, plugin for flake8" +category = "dev" +optional = false +python-versions = "*" + [[package]] name = "mock" version = "4.0.3" @@ -452,6 +500,14 @@ snowballstemmer = "*" [package.extras] toml = ["toml"] +[[package]] +name = "pyflakes" +version = "2.3.1" +description = "passive checker of Python programs" +category = "dev" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" + [[package]] name = "pygments" version = "2.9.0" @@ -723,7 +779,7 @@ testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytes [metadata] lock-version = "1.1" python-versions = "^3.6" -content-hash = "237bfbe6aa936e3a2dd7594deb92d34fa8345de4f3db794db53363cd3a80b63d" +content-hash = "7bae64341d720abacebcbe6916a3f4dfcac37055c3287fd67ddfa30c13a7857d" [metadata.files] apscheduler = [ @@ -893,6 +949,18 @@ docutils = [ {file = "docutils-0.17.1-py2.py3-none-any.whl", hash = "sha256:cf316c8370a737a022b72b56874f6602acf974a37a9fba42ec2876387549fc61"}, {file = "docutils-0.17.1.tar.gz", hash = "sha256:686577d2e4c32380bb50cbb22f575ed742d58168cee37e99117a854bcd88f125"}, ] +flake8 = [ + {file = "flake8-3.9.2-py2.py3-none-any.whl", hash = "sha256:bf8fd333346d844f616e8d47905ef3a3384edae6b4e9beb0c5101e25e3110907"}, + {file = "flake8-3.9.2.tar.gz", hash = "sha256:07528381786f2a6237b061f6e96610a4167b226cb926e2aa2b6b1d78057c576b"}, +] +flake8-bugbear = [ + {file = "flake8-bugbear-21.4.3.tar.gz", hash = "sha256:2346c81f889955b39e4a368eb7d508de723d9de05716c287dc860a4073dc57e7"}, + {file = "flake8_bugbear-21.4.3-py36.py37.py38-none-any.whl", hash = "sha256:4f305dca96be62bf732a218fe6f1825472a621d3452c5b994d8f89dae21dbafa"}, +] +flake8-import-order = [ + {file = "flake8-import-order-0.18.1.tar.gz", hash = "sha256:a28dc39545ea4606c1ac3c24e9d05c849c6e5444a50fb7e9cdd430fc94de6e92"}, + {file = "flake8_import_order-0.18.1-py2.py3-none-any.whl", hash = "sha256:90a80e46886259b9c396b578d75c749801a41ee969a235e163cfe1be7afd2543"}, +] flask = [ {file = "Flask-2.0.1-py3-none-any.whl", hash = "sha256:a6209ca15eb63fc9385f38e452704113d679511d9574d09b2cf9183ae7d20dc9"}, {file = "Flask-2.0.1.tar.gz", hash = "sha256:1c4c257b1892aec1398784c63791cbaa43062f1f7aeb555c4da961b20ee68f55"}, @@ -986,6 +1054,10 @@ markupsafe = [ {file = "MarkupSafe-2.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:693ce3f9e70a6cf7d2fb9e6c9d8b204b6b39897a2c4a1aa65728d5ac97dcc1d8"}, {file = "MarkupSafe-2.0.1.tar.gz", hash = "sha256:594c67807fb16238b30c44bdf74f36c02cdf22d1c8cda91ef8a0ed8dabf5620a"}, ] +mccabe = [ + {file = "mccabe-0.6.1-py2.py3-none-any.whl", hash = "sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42"}, + {file = "mccabe-0.6.1.tar.gz", hash = "sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"}, +] mock = [ {file = "mock-4.0.3-py3-none-any.whl", hash = "sha256:122fcb64ee37cfad5b3f48d7a7d51875d7031aaf3d8be7c42e2bee25044eee62"}, {file = "mock-4.0.3.tar.gz", hash = "sha256:7d3fbbde18228f4ff2f1f119a45cdffa458b4c0dee32eb4d2bb2f82554bac7bc"}, @@ -1018,6 +1090,10 @@ pydocstyle = [ {file = "pydocstyle-6.1.1-py3-none-any.whl", hash = "sha256:6987826d6775056839940041beef5c08cc7e3d71d63149b48e36727f70144dc4"}, {file = "pydocstyle-6.1.1.tar.gz", hash = "sha256:1d41b7c459ba0ee6c345f2eb9ae827cab14a7533a88c5c6f7e94923f72df92dc"}, ] +pyflakes = [ + {file = "pyflakes-2.3.1-py2.py3-none-any.whl", hash = "sha256:7893783d01b8a89811dd72d7dfd4d84ff098e5eed95cfa8905b22bbffe52efc3"}, + {file = "pyflakes-2.3.1.tar.gz", hash = "sha256:f5bc8ecabc05bb9d291eb5203d6810b49040f6ff446a756326104746cc00c1db"}, +] pygments = [ {file = "Pygments-2.9.0-py3-none-any.whl", hash = "sha256:d66e804411278594d764fc69ec36ec13d9ae9147193a1740cd34d272ca383b8e"}, {file = "Pygments-2.9.0.tar.gz", hash = "sha256:a18f47b506a429f6f4b9df81bb02beab9ca21d0a5fee38ed15aef65f0545519f"}, diff --git a/pyproject.toml b/pyproject.toml index e2476a661..ad9e4bd10 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,9 +32,11 @@ pytest = "^6.2.4" redis = ">=2.10.6" requests = ">=2.19.1" rq = ">=0.12.0" -pycodestyle = "^2.7.0" pydocstyle = "^6.1.1" twine = "^3.4.1" +flake8 = "^3.9.2" +flake8-bugbear = "^21.4.3" +flake8-import-order = "^0.18.1" [tool.poetry.scripts] proselint = "proselint.command_line:proselint" @@ -42,7 +44,3 @@ proselint = "proselint.command_line:proselint" [build-system] requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" - -[pycodestyle] -show-source = true -show-pep8 = true diff --git a/run_ci_checks.sh b/run_ci_checks.sh index fa5f0129d..401119daf 100755 --- a/run_ci_checks.sh +++ b/run_ci_checks.sh @@ -11,7 +11,7 @@ Please install it from python-poetry.org." exit 1 fi -if ! poetry run pycodestyle --config pyproject.toml || ! poetry run pydocstyle; then +if ! poetry run flake8 proselint || ! poetry run pydocstyle proselint; then echo -e "\n\n=== LINT ISSUES FOUND! SEE ABOVE. ===" exit 1 fi From 72bcdcc0fd9b4ae97b3e0973be8ec892c3be8217 Mon Sep 17 00:00:00 2001 From: Nytelife26 Date: Tue, 6 Jul 2021 21:58:14 +0100 Subject: [PATCH 2/3] style: apply linting --- poetry.lock | 22 +++++++++++++++-- proselint/__init__.py | 4 +++- proselint/checks/cliches/misc.py | 2 +- proselint/checks/dates_times/am_pm.py | 2 +- proselint/checks/dates_times/dates.py | 3 ++- proselint/checks/jargon/misc.py | 2 +- proselint/checks/lgbtq/offensive_terms.py | 2 +- proselint/checks/links/broken.py | 12 +++++----- proselint/checks/misc/apologizing.py | 2 +- proselint/checks/misc/but.py | 2 +- proselint/checks/misc/false_plurals.py | 2 +- proselint/checks/misc/greylist.py | 3 ++- proselint/checks/misc/metadiscourse.py | 2 +- proselint/checks/misc/narcissism.py | 2 +- proselint/checks/misc/phrasal_adjectives.py | 2 +- proselint/checks/misc/scare_quotes.py | 2 +- proselint/checks/misc/suddenly.py | 2 +- proselint/checks/misc/tense_present.py | 3 ++- proselint/checks/mixed_metaphors/misc.py | 2 +- proselint/checks/psychology/misc.py | 2 +- proselint/checks/terms/venery.py | 2 +- proselint/checks/typography/symbols.py | 2 +- proselint/checks/uncomparables/misc.py | 4 ++-- proselint/checks/weasel_words/very.py | 2 +- proselint/command_line.py | 19 ++++++--------- proselint/score.py | 5 ++-- proselint/tools.py | 26 ++++++++++----------- pyproject.toml | 3 ++- tests/_test_version.py | 6 +++-- tests/check.py | 4 ++-- tests/test_annotations.py | 4 ++-- tests/test_archaism.py | 4 ++-- tests/test_butterick_symbols.py | 4 ++-- tests/test_clear_cache.py | 1 - tests/test_cliches.py | 4 ++-- tests/test_config_flag.py | 3 ++- tests/test_consistency_check.py | 4 ++-- tests/test_consistency_spacing.py | 4 ++-- tests/test_consistency_spelling.py | 4 ++-- tests/test_corporate_speak.py | 4 ++-- tests/test_cursing_filth.py | 4 ++-- tests/test_cursing_nfl.py | 4 ++-- tests/test_cursing_nword.py | 4 ++-- tests/test_dates_times_am_pm.py | 4 ++-- tests/test_dates_times_dates.py | 4 ++-- tests/test_existence_check.py | 4 ++-- tests/test_exit_codes.py | 4 +++- tests/test_garner_dates.py | 6 ++--- tests/test_gmeu/test_a_A.py | 1 - tests/test_gmeu/test_a_B.py | 1 - tests/test_hedging.py | 4 ++-- tests/test_hyperbole.py | 4 ++-- tests/test_illegal_chars.py | 7 ++++-- tests/test_jargon.py | 4 ++-- tests/test_leonard.py | 6 ++--- tests/test_lexical_illusions.py | 4 ++-- tests/test_lgbtq_offensive_terms.py | 4 ++-- tests/test_lgbtq_terms.py | 4 ++-- tests/test_malaproprisms.py | 4 ++-- tests/test_misc_apologizing.py | 4 ++-- tests/test_misc_back_formations.py | 4 ++-- tests/test_misc_bureaucratese.py | 4 ++-- tests/test_misc_but.py | 4 ++-- tests/test_misc_capitalization.py | 4 ++-- tests/test_misc_chatspeak.py | 4 ++-- tests/test_misc_commercialese.py | 4 ++-- tests/test_misc_composition.py | 4 ++-- tests/test_misc_currency.py | 4 ++-- tests/test_misc_debased.py | 4 ++-- tests/test_misc_false_plurals.py | 4 ++-- tests/test_misc_greylist.py | 4 ++-- tests/test_misc_illogic.py | 4 ++-- tests/test_misc_inferior_superior.py | 4 ++-- tests/test_misc_latin.py | 4 ++-- tests/test_misc_many_a.py | 4 ++-- tests/test_misc_metaconcepts.py | 4 ++-- tests/test_misc_metadiscourse.py | 4 ++-- tests/test_misc_narcissism.py | 4 ++-- tests/test_misc_not_guilty.py | 4 ++-- tests/test_misc_phrasal_adjectives.py | 4 ++-- tests/test_misc_preferred_forms.py | 4 ++-- tests/test_misc_pretension.py | 4 ++-- tests/test_misc_professions.py | 4 ++-- tests/test_misc_punctuation.py | 4 ++-- tests/test_misc_scare_quotes.py | 4 ++-- tests/test_misc_suddenly.py | 4 ++-- tests/test_misc_tense_present.py | 4 ++-- tests/test_misc_usage.py | 4 ++-- tests/test_misc_waxed.py | 4 ++-- tests/test_misc_whence.py | 4 ++-- tests/test_mixed_metaphors.py | 4 ++-- tests/test_mondegreens.py | 4 ++-- tests/test_needless_variants.py | 4 ++-- tests/test_nonwords.py | 4 ++-- tests/test_oxymorons.py | 4 ++-- tests/test_preferred_forms_check.py | 4 ++-- tests/test_psychology.py | 4 ++-- tests/test_redundancy_misc.py | 4 ++-- tests/test_redundancy_ras_syndrome.py | 4 ++-- tests/test_security_credit_card.py | 4 ++-- tests/test_security_password.py | 4 ++-- tests/test_sexism.py | 4 ++-- tests/test_skunked_terms.py | 4 ++-- tests/test_spelling_able_atable.py | 4 ++-- tests/test_spelling_able_ible.py | 4 ++-- tests/test_spelling_athletes.py | 4 ++-- tests/test_spelling_em_im_en_in.py | 4 ++-- tests/test_spelling_er_or.py | 4 ++-- tests/test_spelling_in_un.py | 4 ++-- tests/test_spelling_misc.py | 4 ++-- tests/test_terms_animal_adjectives.py | 4 ++-- tests/test_terms_denizen_labels.py | 4 ++-- tests/test_terms_eponymous_adjectives.py | 4 ++-- tests/test_terms_venery.py | 4 ++-- tests/test_tools.py | 4 ++-- tests/test_typography_diacritical_marks.py | 4 ++-- tests/test_typography_exclamation.py | 4 ++-- tests/test_typography_symbols.py | 4 ++-- tests/test_uncomparables.py | 4 +++- tests/test_weasel_words_misc.py | 4 ++-- tests/test_weasel_words_very.py | 4 ++-- 121 files changed, 267 insertions(+), 242 deletions(-) diff --git a/poetry.lock b/poetry.lock index 5cfd383a6..d3b90c68b 100644 --- a/poetry.lock +++ b/poetry.lock @@ -335,6 +335,20 @@ category = "dev" optional = false python-versions = "*" +[[package]] +name = "isort" +version = "5.9.1" +description = "A Python utility / library to sort Python imports." +category = "dev" +optional = false +python-versions = ">=3.6.1,<4.0" + +[package.extras] +pipfile_deprecated_finder = ["pipreqs", "requirementslib"] +requirements_deprecated_finder = ["pipreqs", "pip-api"] +colors = ["colorama (>=0.4.3,<0.5.0)"] +plugins = ["setuptools"] + [[package]] name = "itsdangerous" version = "2.0.1" @@ -778,8 +792,8 @@ testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytes [metadata] lock-version = "1.1" -python-versions = "^3.6" -content-hash = "7bae64341d720abacebcbe6916a3f4dfcac37055c3287fd67ddfa30c13a7857d" +python-versions = "^3.6.1" +content-hash = "f799f5ee17a6bb19ee349529eeff39d517c8291f58857d7f01107d72ecb0fbdf" [metadata.files] apscheduler = [ @@ -998,6 +1012,10 @@ iniconfig = [ {file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"}, {file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"}, ] +isort = [ + {file = "isort-5.9.1-py3-none-any.whl", hash = "sha256:8e2c107091cfec7286bc0f68a547d0ba4c094d460b732075b6fba674f1035c0c"}, + {file = "isort-5.9.1.tar.gz", hash = "sha256:83510593e07e433b77bd5bff0f6f607dbafa06d1a89022616f02d8b699cfcd56"}, +] itsdangerous = [ {file = "itsdangerous-2.0.1-py3-none-any.whl", hash = "sha256:5174094b9637652bdb841a3029700391451bd092ba3db90600dea710ba28e97c"}, {file = "itsdangerous-2.0.1.tar.gz", hash = "sha256:9e724d68fc22902a1435351f84c3fb8623f303fffcc566a4cb952df8c572cff0"}, diff --git a/proselint/__init__.py b/proselint/__init__.py index 5483d1f3c..f1e5525c9 100644 --- a/proselint/__init__.py +++ b/proselint/__init__.py @@ -1,4 +1,6 @@ +# flake8: noqa + """Proselint applies advice from great writers to your writing.""" from . import tools -__all__ = ('tools') +__all__ = ("tools") diff --git a/proselint/checks/cliches/misc.py b/proselint/checks/cliches/misc.py index 96b47b929..30bacfb92 100644 --- a/proselint/checks/cliches/misc.py +++ b/proselint/checks/cliches/misc.py @@ -2,7 +2,7 @@ u"""Cliches are cliché.""" -from proselint.tools import memoize, existence_check +from proselint.tools import existence_check, memoize @memoize diff --git a/proselint/checks/dates_times/am_pm.py b/proselint/checks/dates_times/am_pm.py index 4e7506910..d80c46b9c 100644 --- a/proselint/checks/dates_times/am_pm.py +++ b/proselint/checks/dates_times/am_pm.py @@ -11,7 +11,7 @@ --- """ -from proselint.tools import memoize, existence_check +from proselint.tools import existence_check, memoize @memoize diff --git a/proselint/checks/dates_times/dates.py b/proselint/checks/dates_times/dates.py index 747d58519..0fec0dbee 100644 --- a/proselint/checks/dates_times/dates.py +++ b/proselint/checks/dates_times/dates.py @@ -13,9 +13,10 @@ Dates. """ -from proselint.tools import existence_check, memoize import calendar +from proselint.tools import existence_check, memoize + @memoize def check_decade_apostrophes_short(text): diff --git a/proselint/checks/jargon/misc.py b/proselint/checks/jargon/misc.py index 8e71bdb55..9fa7d695b 100644 --- a/proselint/checks/jargon/misc.py +++ b/proselint/checks/jargon/misc.py @@ -13,7 +13,7 @@ Cliches are cliché. """ -from proselint.tools import memoize, existence_check +from proselint.tools import existence_check, memoize @memoize diff --git a/proselint/checks/lgbtq/offensive_terms.py b/proselint/checks/lgbtq/offensive_terms.py index daf96946a..7e81ddb23 100644 --- a/proselint/checks/lgbtq/offensive_terms.py +++ b/proselint/checks/lgbtq/offensive_terms.py @@ -15,7 +15,7 @@ Associated Press have also adopted this style guide. """ -from proselint.tools import memoize, existence_check +from proselint.tools import existence_check, memoize @memoize diff --git a/proselint/checks/links/broken.py b/proselint/checks/links/broken.py index 92771c522..bbe2f0a10 100644 --- a/proselint/checks/links/broken.py +++ b/proselint/checks/links/broken.py @@ -13,14 +13,14 @@ Check that links are not broken. """ -from proselint.tools import memoize -from future import standard_library import re -try: - import urllib.request as urllib_request # for Python 3 -except ImportError: - import urllib2 as urllib_request # for Python 2 +import urllib.request as urllib_request # for Python 3 from socket import error as SocketError + +from future import standard_library + +from proselint.tools import memoize + standard_library.install_aliases() diff --git a/proselint/checks/misc/apologizing.py b/proselint/checks/misc/apologizing.py index 17a4bbd38..966cba385 100644 --- a/proselint/checks/misc/apologizing.py +++ b/proselint/checks/misc/apologizing.py @@ -13,7 +13,7 @@ Points out excessive apologizing. """ -from proselint.tools import memoize, existence_check +from proselint.tools import existence_check, memoize @memoize diff --git a/proselint/checks/misc/but.py b/proselint/checks/misc/but.py index 0bf7f0b72..4833b11fd 100644 --- a/proselint/checks/misc/but.py +++ b/proselint/checks/misc/but.py @@ -13,7 +13,7 @@ Paragraphs should not start with certain bad words. """ -from proselint.tools import memoize, existence_check +from proselint.tools import existence_check, memoize @memoize diff --git a/proselint/checks/misc/false_plurals.py b/proselint/checks/misc/false_plurals.py index 011dd168d..0a11a21ab 100644 --- a/proselint/checks/misc/false_plurals.py +++ b/proselint/checks/misc/false_plurals.py @@ -13,7 +13,7 @@ Using the incorrect form of the plural. """ -from proselint.tools import memoize, preferred_forms_check, existence_check +from proselint.tools import existence_check, memoize, preferred_forms_check @memoize diff --git a/proselint/checks/misc/greylist.py b/proselint/checks/misc/greylist.py index aa112e5f5..6a66c6c93 100644 --- a/proselint/checks/misc/greylist.py +++ b/proselint/checks/misc/greylist.py @@ -13,9 +13,10 @@ """ -from proselint.tools import memoize import re +from proselint.tools import memoize + @memoize def check(text): diff --git a/proselint/checks/misc/metadiscourse.py b/proselint/checks/misc/metadiscourse.py index 661c314cc..154817e67 100644 --- a/proselint/checks/misc/metadiscourse.py +++ b/proselint/checks/misc/metadiscourse.py @@ -13,7 +13,7 @@ Points out metadiscourse. """ -from proselint.tools import memoize, existence_check +from proselint.tools import existence_check, memoize @memoize diff --git a/proselint/checks/misc/narcissism.py b/proselint/checks/misc/narcissism.py index 4df10087e..0630cc296 100644 --- a/proselint/checks/misc/narcissism.py +++ b/proselint/checks/misc/narcissism.py @@ -13,7 +13,7 @@ Points out academic narcissism. """ -from proselint.tools import memoize, existence_check +from proselint.tools import existence_check, memoize @memoize diff --git a/proselint/checks/misc/phrasal_adjectives.py b/proselint/checks/misc/phrasal_adjectives.py index 7fedbdc4e..e7d0c62ce 100644 --- a/proselint/checks/misc/phrasal_adjectives.py +++ b/proselint/checks/misc/phrasal_adjectives.py @@ -13,7 +13,7 @@ Phrasal adjectives. """ -from proselint.tools import existence_check, preferred_forms_check, memoize +from proselint.tools import existence_check, memoize, preferred_forms_check @memoize diff --git a/proselint/checks/misc/scare_quotes.py b/proselint/checks/misc/scare_quotes.py index 1b3ad5dad..7f48bfcba 100644 --- a/proselint/checks/misc/scare_quotes.py +++ b/proselint/checks/misc/scare_quotes.py @@ -13,7 +13,7 @@ Points out misuse of scare quotes. """ -from proselint.tools import memoize, existence_check +from proselint.tools import existence_check, memoize @memoize diff --git a/proselint/checks/misc/suddenly.py b/proselint/checks/misc/suddenly.py index 08d734e82..4b7ecbae7 100644 --- a/proselint/checks/misc/suddenly.py +++ b/proselint/checks/misc/suddenly.py @@ -25,7 +25,7 @@ anymore,” the “suddenly” substantially changes the way we think about the shift in emotional calibration. """ -from proselint.tools import memoize, existence_check +from proselint.tools import existence_check, memoize @memoize diff --git a/proselint/checks/misc/tense_present.py b/proselint/checks/misc/tense_present.py index c141ecf33..f41e17e5b 100644 --- a/proselint/checks/misc/tense_present.py +++ b/proselint/checks/misc/tense_present.py @@ -13,9 +13,10 @@ Archaism. """ -from proselint.tools import memoize import re +from proselint.tools import memoize + @memoize def check(text): diff --git a/proselint/checks/mixed_metaphors/misc.py b/proselint/checks/mixed_metaphors/misc.py index 851bdae51..1943a7551 100644 --- a/proselint/checks/mixed_metaphors/misc.py +++ b/proselint/checks/mixed_metaphors/misc.py @@ -2,7 +2,7 @@ """Mixed metaphors.""" -from proselint.tools import memoize, existence_check, preferred_forms_check +from proselint.tools import existence_check, memoize, preferred_forms_check @memoize diff --git a/proselint/checks/psychology/misc.py b/proselint/checks/psychology/misc.py index 577f1b652..5e48b50bb 100644 --- a/proselint/checks/psychology/misc.py +++ b/proselint/checks/psychology/misc.py @@ -13,7 +13,7 @@ Psychological and psychiatric terms to avoid. """ -from proselint.tools import preferred_forms_check, existence_check, memoize +from proselint.tools import existence_check, memoize, preferred_forms_check @memoize diff --git a/proselint/checks/terms/venery.py b/proselint/checks/terms/venery.py index 0b451f4d0..5829d5ca8 100644 --- a/proselint/checks/terms/venery.py +++ b/proselint/checks/terms/venery.py @@ -13,7 +13,7 @@ Names for groups of animals. """ -from proselint.tools import preferred_forms_check, memoize +from proselint.tools import memoize, preferred_forms_check @memoize diff --git a/proselint/checks/typography/symbols.py b/proselint/checks/typography/symbols.py index 77e7646e2..14c13b244 100644 --- a/proselint/checks/typography/symbols.py +++ b/proselint/checks/typography/symbols.py @@ -5,7 +5,7 @@ source_url: http://practicaltypography.com/ """ -from proselint.tools import memoize, existence_check, preferred_forms_check +from proselint.tools import existence_check, memoize @memoize diff --git a/proselint/checks/uncomparables/misc.py b/proselint/checks/uncomparables/misc.py index 4dce6aabf..3cd7e12e5 100644 --- a/proselint/checks/uncomparables/misc.py +++ b/proselint/checks/uncomparables/misc.py @@ -44,10 +44,10 @@ One axiom of Standard Written English is that your reader is paying close attention and expects you to have done the same. """ -import re -from proselint.tools import existence_check, memoize import itertools +from proselint.tools import existence_check, memoize + @memoize def check(text): diff --git a/proselint/checks/weasel_words/very.py b/proselint/checks/weasel_words/very.py index 716bdc4ce..8145dccdd 100644 --- a/proselint/checks/weasel_words/very.py +++ b/proselint/checks/weasel_words/very.py @@ -14,7 +14,7 @@ delete it and the writing will be just as it should be. """ -from proselint.tools import memoize, existence_check +from proselint.tools import existence_check, memoize @memoize diff --git a/proselint/command_line.py b/proselint/command_line.py index e3768bb02..81e6efc98 100644 --- a/proselint/command_line.py +++ b/proselint/command_line.py @@ -1,25 +1,20 @@ # -*- coding: utf-8 -*- """Command line utility for proselint.""" -from __future__ import print_function -from __future__ import absolute_import -from builtins import str - +from __future__ import absolute_import, print_function -import click import os -from .tools import ( - close_cache_shelves_after, - close_cache_shelves, - errors_to_json, - lint, -) import shutil import subprocess import sys -from .version import __version__ import traceback +from builtins import str + +import click +from .tools import (close_cache_shelves, close_cache_shelves_after, + errors_to_json, lint) +from .version import __version__ CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help']) base_url = "proselint.com/" diff --git a/proselint/score.py b/proselint/score.py index 57e5ffe71..3b2d0ee90 100644 --- a/proselint/score.py +++ b/proselint/score.py @@ -3,12 +3,11 @@ """Compute the lintscore on the corpus.""" from __future__ import print_function -from builtins import input -from builtins import int import os -import subprocess import re +import subprocess +from builtins import input, int proselint_path = os.path.dirname(os.path.realpath(__file__)) diff --git a/proselint/tools.py b/proselint/tools.py index a6b8c60ad..f49a09dea 100644 --- a/proselint/tools.py +++ b/proselint/tools.py @@ -2,21 +2,21 @@ """General-purpose tools shared across linting checks.""" -from __future__ import print_function -from __future__ import unicode_literals -import sys -import traceback -import os -import shelve -import inspect +from __future__ import print_function, unicode_literals + +import copy +import dbm import functools -import re import hashlib -import json import importlib -import copy +import inspect +import json +import os +import re +import shelve +import sys +import traceback -import dbm _cache_shelves = dict() proselint_path = os.path.dirname(os.path.realpath(__file__)) home_dir = os.path.expanduser("~") @@ -25,7 +25,7 @@ def close_cache_shelves(): """Close previously opened cache shelves.""" - for pth, cache in _cache_shelves.items(): + for _, cache in _cache_shelves.items(): cache.close() _cache_shelves.clear() @@ -331,7 +331,7 @@ def preferred_forms_check(text, list, err, msg, ignore_case=True, offset=0, def existence_check(text, list, err, msg, ignore_case=True, str=False, max_errors=float("inf"), offset=0, require_padding=True, dotall=False, - excluded_topics=None, exceptions=[], join=False): + excluded_topics=None, exceptions=(), join=False): """Build a checker that prohibits certain words or phrases.""" flags = 0 diff --git a/pyproject.toml b/pyproject.toml index ad9e4bd10..c1aff8465 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,7 @@ include = ["proselint", "demo.md", ".proselintrc"] exclude = ["tests"] [tool.poetry.dependencies] -python = "^3.6" +python = "^3.6.1" click = "^8.0.0" future = "^0.18.2" six = "^1.15.0" @@ -37,6 +37,7 @@ twine = "^3.4.1" flake8 = "^3.9.2" flake8-bugbear = "^21.4.3" flake8-import-order = "^0.18.1" +isort = "^5.9.1" [tool.poetry.scripts] proselint = "proselint.command_line:proselint" diff --git a/tests/_test_version.py b/tests/_test_version.py index 32969008f..e66fb1a9a 100644 --- a/tests/_test_version.py +++ b/tests/_test_version.py @@ -1,8 +1,10 @@ """Test version number.""" -from .check import Check from click.testing import CliRunner -from proselint.version import __version__ + from proselint.command_line import proselint +from proselint.version import __version__ + +from .check import Check class TestCheck(Check): diff --git a/tests/check.py b/tests/check.py index 542c41477..c5f74f50f 100644 --- a/tests/check.py +++ b/tests/check.py @@ -1,8 +1,8 @@ """Check that a check is working.""" -from unittest import TestCase -import os import codecs +import os +from unittest import TestCase class Check(TestCase): diff --git a/tests/test_annotations.py b/tests/test_annotations.py index 87b633363..37ca4ca4d 100644 --- a/tests/test_annotations.py +++ b/tests/test_annotations.py @@ -1,10 +1,10 @@ """Tests for annotations.misc check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.annotations import misc as chk +from .check import Check + class TestCheck(Check): """The test class for annotations.misc.""" diff --git a/tests/test_archaism.py b/tests/test_archaism.py index 2a20762c9..6dea5015c 100644 --- a/tests/test_archaism.py +++ b/tests/test_archaism.py @@ -1,10 +1,10 @@ """Tests for archaism.misc check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.archaism import misc as chk +from .check import Check + class TestCheck(Check): """The test class for archaism.misc.""" diff --git a/tests/test_butterick_symbols.py b/tests/test_butterick_symbols.py index fb8eade36..00b2ed292 100644 --- a/tests/test_butterick_symbols.py +++ b/tests/test_butterick_symbols.py @@ -1,10 +1,10 @@ """Test Butterick's symbols.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.typography import symbols as chk +from .check import Check + class TestCheck(Check): """The test class for typography.symbols.""" diff --git a/tests/test_clear_cache.py b/tests/test_clear_cache.py index 41a935244..cc8fd7144 100644 --- a/tests/test_clear_cache.py +++ b/tests/test_clear_cache.py @@ -6,7 +6,6 @@ from proselint import command_line as cl - try: from unittest import mock except ImportError: diff --git a/tests/test_cliches.py b/tests/test_cliches.py index 678401ac6..03cbac8c7 100644 --- a/tests/test_cliches.py +++ b/tests/test_cliches.py @@ -1,10 +1,10 @@ """Test the Cliches.misc module.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.cliches import misc as chk +from .check import Check + class TestCheck(Check): """The test class for cliches.misc.""" diff --git a/tests/test_config_flag.py b/tests/test_config_flag.py index 8d1a44b43..e9fc2651f 100644 --- a/tests/test_config_flag.py +++ b/tests/test_config_flag.py @@ -1,7 +1,8 @@ """Test user option overrides using --config and load_options""" from click.testing import CliRunner -from proselint.tools import deepmerge_dicts, load_options + from proselint.command_line import proselint +from proselint.tools import deepmerge_dicts, load_options def test_deepmerge_dicts(): diff --git a/tests/test_consistency_check.py b/tests/test_consistency_check.py index 9ca02071a..bd1ac6d0e 100644 --- a/tests/test_consistency_check.py +++ b/tests/test_consistency_check.py @@ -1,10 +1,10 @@ """Test the consistency_check function from the tools.py module.""" from __future__ import absolute_import -from .check import Check - from proselint.tools import consistency_check as chk +from .check import Check + class TestCheck(Check): """The test class for tools.consistency_check.""" diff --git a/tests/test_consistency_spacing.py b/tests/test_consistency_spacing.py index 5a047c66b..b5af89c03 100644 --- a/tests/test_consistency_spacing.py +++ b/tests/test_consistency_spacing.py @@ -1,10 +1,10 @@ """Tests for consistency.spacing check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.consistency import spacing as chk +from .check import Check + class TestCheck(Check): """The test class for consistency.spacing.""" diff --git a/tests/test_consistency_spelling.py b/tests/test_consistency_spelling.py index dfe6f7099..1ff15b9b3 100644 --- a/tests/test_consistency_spelling.py +++ b/tests/test_consistency_spelling.py @@ -1,10 +1,10 @@ """Tests for consistency.spelling check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.consistency import spelling as chk +from .check import Check + class TestCheck(Check): """The test class for consistency.spelling.""" diff --git a/tests/test_corporate_speak.py b/tests/test_corporate_speak.py index aa1073185..aa5f3eea5 100644 --- a/tests/test_corporate_speak.py +++ b/tests/test_corporate_speak.py @@ -1,10 +1,10 @@ """Tests for corporate_speak.misc check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.corporate_speak import misc as chk +from .check import Check + class TestCheck(Check): """The test class for corporate_speak.misc.""" diff --git a/tests/test_cursing_filth.py b/tests/test_cursing_filth.py index dede26d86..df252aee2 100644 --- a/tests/test_cursing_filth.py +++ b/tests/test_cursing_filth.py @@ -1,10 +1,10 @@ """Tests for cursing.filth check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.cursing import filth as chk +from .check import Check + class TestCheck(Check): """The test class for cursing.filth.""" diff --git a/tests/test_cursing_nfl.py b/tests/test_cursing_nfl.py index 8ff2a5b3b..42578f816 100644 --- a/tests/test_cursing_nfl.py +++ b/tests/test_cursing_nfl.py @@ -1,10 +1,10 @@ """Tests for cursing.nfl check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.cursing import nfl as chk +from .check import Check + class TestCheck(Check): """The test class for cursing.nfl.""" diff --git a/tests/test_cursing_nword.py b/tests/test_cursing_nword.py index 2f6acbcab..2370de431 100644 --- a/tests/test_cursing_nword.py +++ b/tests/test_cursing_nword.py @@ -1,10 +1,10 @@ """Tests for cursing.nword check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.cursing import nword as chk +from .check import Check + class TestCheck(Check): """The test class for cursing.nword.""" diff --git a/tests/test_dates_times_am_pm.py b/tests/test_dates_times_am_pm.py index 66fb68f2a..87b9f64e2 100644 --- a/tests/test_dates_times_am_pm.py +++ b/tests/test_dates_times_am_pm.py @@ -1,10 +1,10 @@ """Tests for dates_times.am_pm check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.dates_times import am_pm as chk +from .check import Check + class TestCheck(Check): """The test class for dates_times.am_pm.""" diff --git a/tests/test_dates_times_dates.py b/tests/test_dates_times_dates.py index c7334af82..741fb9086 100644 --- a/tests/test_dates_times_dates.py +++ b/tests/test_dates_times_dates.py @@ -1,10 +1,10 @@ """Tests for dates_times.dates check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.dates_times import dates as chk +from .check import Check + class TestCheck(Check): """The test class for dates_times.dates.""" diff --git a/tests/test_existence_check.py b/tests/test_existence_check.py index fb0194a5d..8e293b4ee 100644 --- a/tests/test_existence_check.py +++ b/tests/test_existence_check.py @@ -1,10 +1,10 @@ """Test the existence_check function from the tools.py module.""" from __future__ import absolute_import -from .check import Check - from proselint.tools import existence_check as chk +from .check import Check + class TestCheck(Check): """The test class for tools.existence_check.""" diff --git a/tests/test_exit_codes.py b/tests/test_exit_codes.py index 88849ea25..8f30d239b 100644 --- a/tests/test_exit_codes.py +++ b/tests/test_exit_codes.py @@ -1,9 +1,11 @@ """Check that the CLI returns the appropriate exit code.""" -from .check import Check from click.testing import CliRunner + from proselint.command_line import proselint +from .check import Check + class TestExitCodes(Check): """Test class for CLI exit codes""" diff --git a/tests/test_garner_dates.py b/tests/test_garner_dates.py index cf5323b5f..c15a12efd 100644 --- a/tests/test_garner_dates.py +++ b/tests/test_garner_dates.py @@ -1,10 +1,10 @@ """Test garner.dates.""" -from __future__ import absolute_import -from __future__ import print_function +from __future__ import absolute_import, print_function -from .check import Check from proselint.checks.dates_times import dates +from .check import Check + class TestCheck(Check): """Test class for garner.dates.""" diff --git a/tests/test_gmeu/test_a_A.py b/tests/test_gmeu/test_a_A.py index d871d46b3..4dba144a9 100644 --- a/tests/test_gmeu/test_a_A.py +++ b/tests/test_gmeu/test_a_A.py @@ -6,7 +6,6 @@ from __future__ import absolute_import from proselint.tools import assert_error - from tests.check import Check diff --git a/tests/test_gmeu/test_a_B.py b/tests/test_gmeu/test_a_B.py index e1d651aae..70a4f04ab 100644 --- a/tests/test_gmeu/test_a_B.py +++ b/tests/test_gmeu/test_a_B.py @@ -6,7 +6,6 @@ from __future__ import absolute_import from proselint.tools import assert_error - from tests.check import Check diff --git a/tests/test_hedging.py b/tests/test_hedging.py index 8417cf504..e4b96bf88 100644 --- a/tests/test_hedging.py +++ b/tests/test_hedging.py @@ -1,10 +1,10 @@ """Tests for hedging.misc check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.hedging import misc as chk +from .check import Check + class TestCheck(Check): """The test class for hedging.misc.""" diff --git a/tests/test_hyperbole.py b/tests/test_hyperbole.py index 4ce928bbf..c51c9eead 100644 --- a/tests/test_hyperbole.py +++ b/tests/test_hyperbole.py @@ -1,10 +1,10 @@ """Tests for hyperbole.misc check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.hyperbole import misc as chk +from .check import Check + class TestCheck(Check): """The test class for hyperbole.misc.""" diff --git a/tests/test_illegal_chars.py b/tests/test_illegal_chars.py index d12924f83..aad126c2c 100644 --- a/tests/test_illegal_chars.py +++ b/tests/test_illegal_chars.py @@ -1,10 +1,13 @@ """Check that the CLI can handle invalid characters.""" -from .check import Check +from os.path import abspath, dirname, join + from click.testing import CliRunner -from os.path import dirname, abspath, join + from proselint.command_line import proselint +from .check import Check + class TestInvalidCharacters(Check): """Test class for testing invalid characters on the CLI""" diff --git a/tests/test_jargon.py b/tests/test_jargon.py index 3d87bbd60..2bd59bac9 100644 --- a/tests/test_jargon.py +++ b/tests/test_jargon.py @@ -1,10 +1,10 @@ """Tests for jargon.misc check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.jargon import misc as chk +from .check import Check + class TestCheck(Check): """The test class for jargon.misc.""" diff --git a/tests/test_leonard.py b/tests/test_leonard.py index 6f5117308..ba9c0aec4 100644 --- a/tests/test_leonard.py +++ b/tests/test_leonard.py @@ -1,10 +1,10 @@ """Test garner.dates.""" -from __future__ import absolute_import -from __future__ import print_function +from __future__ import absolute_import, print_function -from .check import Check from proselint.checks.typography import exclamation +from .check import Check + class TestCheck(Check): """Test class for leonard.exclamation.""" diff --git a/tests/test_lexical_illusions.py b/tests/test_lexical_illusions.py index d9a2f85e0..af8d83ff6 100644 --- a/tests/test_lexical_illusions.py +++ b/tests/test_lexical_illusions.py @@ -1,10 +1,10 @@ """Tests for lexical_illusions.misc check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.lexical_illusions import misc as chk +from .check import Check + class TestCheck(Check): """The test class for lexical_illusions.misc.""" diff --git a/tests/test_lgbtq_offensive_terms.py b/tests/test_lgbtq_offensive_terms.py index 2d759a8cc..6ab5ed87f 100644 --- a/tests/test_lgbtq_offensive_terms.py +++ b/tests/test_lgbtq_offensive_terms.py @@ -1,10 +1,10 @@ """Tests for lgbtq.terms check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.lgbtq import offensive_terms as chk +from .check import Check + class TestCheck(Check): """The test class for lgbtq.offensive_terms.""" diff --git a/tests/test_lgbtq_terms.py b/tests/test_lgbtq_terms.py index 6aef9b26c..88599c9bd 100644 --- a/tests/test_lgbtq_terms.py +++ b/tests/test_lgbtq_terms.py @@ -1,10 +1,10 @@ """Tests for lgbtq.offensive_terms check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.lgbtq import terms as chk +from .check import Check + class TestCheck(Check): """The test class for lgbtq.terms.""" diff --git a/tests/test_malaproprisms.py b/tests/test_malaproprisms.py index 3edeb2d9a..817051f43 100644 --- a/tests/test_malaproprisms.py +++ b/tests/test_malaproprisms.py @@ -1,10 +1,10 @@ """Tests for malaproprisms.misc check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.malapropisms import misc as chk +from .check import Check + class TestCheck(Check): """The test class for malaproprisms.misc.""" diff --git a/tests/test_misc_apologizing.py b/tests/test_misc_apologizing.py index 32a3146c9..ac83d381f 100644 --- a/tests/test_misc_apologizing.py +++ b/tests/test_misc_apologizing.py @@ -1,10 +1,10 @@ """Tests for misc.apologizing check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.misc import apologizing as chk +from .check import Check + class TestCheck(Check): """The test class for misc.apologizing.""" diff --git a/tests/test_misc_back_formations.py b/tests/test_misc_back_formations.py index 0c6a24f84..45f44e1cd 100644 --- a/tests/test_misc_back_formations.py +++ b/tests/test_misc_back_formations.py @@ -1,10 +1,10 @@ """Tests for misc.back_formations check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.misc import back_formations as chk +from .check import Check + class TestCheck(Check): """The test class for misc.back_formations.""" diff --git a/tests/test_misc_bureaucratese.py b/tests/test_misc_bureaucratese.py index ffcf8276f..f45caec97 100644 --- a/tests/test_misc_bureaucratese.py +++ b/tests/test_misc_bureaucratese.py @@ -1,10 +1,10 @@ """Tests for misc.bureaucratese check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.misc import bureaucratese as chk +from .check import Check + class TestCheck(Check): """The test class for misc.bureaucratese.""" diff --git a/tests/test_misc_but.py b/tests/test_misc_but.py index 59f90941c..7d6f6dee7 100644 --- a/tests/test_misc_but.py +++ b/tests/test_misc_but.py @@ -1,10 +1,10 @@ """Tests for misc.but check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.misc import but as chk +from .check import Check + class TestCheck(Check): """The test class for misc.but.""" diff --git a/tests/test_misc_capitalization.py b/tests/test_misc_capitalization.py index 6ec8bc32f..063a93bde 100644 --- a/tests/test_misc_capitalization.py +++ b/tests/test_misc_capitalization.py @@ -1,10 +1,10 @@ """Tests for misc.capitalization check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.misc import capitalization as chk +from .check import Check + class TestCheck(Check): """The test class for misc.capitalization.""" diff --git a/tests/test_misc_chatspeak.py b/tests/test_misc_chatspeak.py index 5759d69f0..61c8eaa2b 100644 --- a/tests/test_misc_chatspeak.py +++ b/tests/test_misc_chatspeak.py @@ -1,10 +1,10 @@ """Tests for misc.chatspeak check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.misc import chatspeak as chk +from .check import Check + class TestCheck(Check): """The test class for misc.chatspeak.""" diff --git a/tests/test_misc_commercialese.py b/tests/test_misc_commercialese.py index e3636ce66..383dfd4aa 100644 --- a/tests/test_misc_commercialese.py +++ b/tests/test_misc_commercialese.py @@ -1,10 +1,10 @@ """Tests for misc.commercialese check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.misc import commercialese as chk +from .check import Check + class TestCheck(Check): """The test class for misc.commercialese.""" diff --git a/tests/test_misc_composition.py b/tests/test_misc_composition.py index 967ed9ba3..479219680 100644 --- a/tests/test_misc_composition.py +++ b/tests/test_misc_composition.py @@ -1,10 +1,10 @@ """Tests for misc.composition check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.misc import composition as chk +from .check import Check + class TestCheck(Check): """The test class for misc.composition.""" diff --git a/tests/test_misc_currency.py b/tests/test_misc_currency.py index ec07abdb9..6ea863f86 100644 --- a/tests/test_misc_currency.py +++ b/tests/test_misc_currency.py @@ -1,10 +1,10 @@ """Tests for misc.currency check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.misc import currency as chk +from .check import Check + class TestCheck(Check): """The test class for misc.currency.""" diff --git a/tests/test_misc_debased.py b/tests/test_misc_debased.py index 44e2cf581..b0ec6fef5 100644 --- a/tests/test_misc_debased.py +++ b/tests/test_misc_debased.py @@ -1,10 +1,10 @@ """Tests for misc.debased check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.misc import debased as chk +from .check import Check + class TestCheck(Check): """The test class for misc.debased.""" diff --git a/tests/test_misc_false_plurals.py b/tests/test_misc_false_plurals.py index c951e8be6..633b1f56b 100644 --- a/tests/test_misc_false_plurals.py +++ b/tests/test_misc_false_plurals.py @@ -1,10 +1,10 @@ """Tests for misc.false_plurals check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.misc import false_plurals as chk +from .check import Check + class TestCheck(Check): """The test class for misc.false_plurals.""" diff --git a/tests/test_misc_greylist.py b/tests/test_misc_greylist.py index 4794c5b00..7d92395d5 100644 --- a/tests/test_misc_greylist.py +++ b/tests/test_misc_greylist.py @@ -1,10 +1,10 @@ """Tests for misc.greylist check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.misc import greylist as chk +from .check import Check + class TestCheck(Check): """The test class for misc.greylist.""" diff --git a/tests/test_misc_illogic.py b/tests/test_misc_illogic.py index a629fc850..fa0e31dbc 100644 --- a/tests/test_misc_illogic.py +++ b/tests/test_misc_illogic.py @@ -1,10 +1,10 @@ """Tests for misc.illogic check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.misc import illogic as chk +from .check import Check + class TestCheck(Check): """The test class for misc.illogic.""" diff --git a/tests/test_misc_inferior_superior.py b/tests/test_misc_inferior_superior.py index 94a015f10..07795ed3f 100644 --- a/tests/test_misc_inferior_superior.py +++ b/tests/test_misc_inferior_superior.py @@ -1,10 +1,10 @@ """Tests for misc.inferior_superior check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.misc import inferior_superior as chk +from .check import Check + class TestCheck(Check): """The test class for misc.inferior_superior.""" diff --git a/tests/test_misc_latin.py b/tests/test_misc_latin.py index 2c42afde2..a912edf6a 100644 --- a/tests/test_misc_latin.py +++ b/tests/test_misc_latin.py @@ -1,10 +1,10 @@ """Tests for misc.latin check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.misc import latin as chk +from .check import Check + class TestCheck(Check): """The test class for misc.latin.""" diff --git a/tests/test_misc_many_a.py b/tests/test_misc_many_a.py index 2907d6ad8..7effafa2d 100644 --- a/tests/test_misc_many_a.py +++ b/tests/test_misc_many_a.py @@ -1,10 +1,10 @@ """Tests for misc.many_a check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.misc import many_a as chk +from .check import Check + class TestCheck(Check): """The test class for misc.many_a.""" diff --git a/tests/test_misc_metaconcepts.py b/tests/test_misc_metaconcepts.py index c60c8d6fe..c5a68372b 100644 --- a/tests/test_misc_metaconcepts.py +++ b/tests/test_misc_metaconcepts.py @@ -1,10 +1,10 @@ """Tests for misc.metaconcepts check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.misc import metaconcepts as chk +from .check import Check + class TestCheck(Check): """The test class for misc.metaconcepts.""" diff --git a/tests/test_misc_metadiscourse.py b/tests/test_misc_metadiscourse.py index d7c55c2e4..d84d8d403 100644 --- a/tests/test_misc_metadiscourse.py +++ b/tests/test_misc_metadiscourse.py @@ -1,10 +1,10 @@ """Tests for misc.metadiscourse check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.misc import metadiscourse as chk +from .check import Check + class TestCheck(Check): """The test class for misc.metadiscourse.""" diff --git a/tests/test_misc_narcissism.py b/tests/test_misc_narcissism.py index 3cb2beb6a..c23cc3acc 100644 --- a/tests/test_misc_narcissism.py +++ b/tests/test_misc_narcissism.py @@ -1,10 +1,10 @@ """Tests for misc.narcissism check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.misc import narcissism as chk +from .check import Check + class TestCheck(Check): """The test class for misc.narcissism.""" diff --git a/tests/test_misc_not_guilty.py b/tests/test_misc_not_guilty.py index 5e080289d..1ba3e4025 100644 --- a/tests/test_misc_not_guilty.py +++ b/tests/test_misc_not_guilty.py @@ -1,10 +1,10 @@ """Tests for misc.not_guilty check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.misc import not_guilty as chk +from .check import Check + class TestCheck(Check): """The test class for misc.not_guilty.""" diff --git a/tests/test_misc_phrasal_adjectives.py b/tests/test_misc_phrasal_adjectives.py index 4b038b184..70bffffb5 100644 --- a/tests/test_misc_phrasal_adjectives.py +++ b/tests/test_misc_phrasal_adjectives.py @@ -1,10 +1,10 @@ """Tests for misc.phrasal_adjectives check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.misc import phrasal_adjectives as chk +from .check import Check + class TestCheck(Check): """The test class for misc.phrasal_adjectives.""" diff --git a/tests/test_misc_preferred_forms.py b/tests/test_misc_preferred_forms.py index 7f8bbc613..abbc0ed59 100644 --- a/tests/test_misc_preferred_forms.py +++ b/tests/test_misc_preferred_forms.py @@ -1,10 +1,10 @@ """Tests for misc.preferred_forms check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.misc import preferred_forms as chk +from .check import Check + class TestCheck(Check): """The test class for misc.preferred_forms.""" diff --git a/tests/test_misc_pretension.py b/tests/test_misc_pretension.py index a00fa113f..b89448b3d 100644 --- a/tests/test_misc_pretension.py +++ b/tests/test_misc_pretension.py @@ -1,10 +1,10 @@ """Tests for misc.pretension check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.misc import pretension as chk +from .check import Check + class TestCheck(Check): """The test class for misc.pretension.""" diff --git a/tests/test_misc_professions.py b/tests/test_misc_professions.py index d1a47e08f..4af425023 100644 --- a/tests/test_misc_professions.py +++ b/tests/test_misc_professions.py @@ -1,10 +1,10 @@ """Tests for misc.professions check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.misc import professions as chk +from .check import Check + class TestCheck(Check): """The test class for misc.professions.""" diff --git a/tests/test_misc_punctuation.py b/tests/test_misc_punctuation.py index fcddb83d3..4e04e8264 100644 --- a/tests/test_misc_punctuation.py +++ b/tests/test_misc_punctuation.py @@ -1,10 +1,10 @@ """Tests for misc.punctuation check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.misc import punctuation as chk +from .check import Check + class TestCheck(Check): """The test class for misc.punctuation.""" diff --git a/tests/test_misc_scare_quotes.py b/tests/test_misc_scare_quotes.py index b9ccb053e..78cb8c82b 100644 --- a/tests/test_misc_scare_quotes.py +++ b/tests/test_misc_scare_quotes.py @@ -1,10 +1,10 @@ """Tests for misc.scare_quotes check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.misc import scare_quotes as chk +from .check import Check + class TestCheck(Check): """The test class for misc.scare_quotes.""" diff --git a/tests/test_misc_suddenly.py b/tests/test_misc_suddenly.py index 301642e60..f2aef080d 100644 --- a/tests/test_misc_suddenly.py +++ b/tests/test_misc_suddenly.py @@ -1,10 +1,10 @@ """Tests for misc.suddenly check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.misc import suddenly as chk +from .check import Check + class TestCheck(Check): """The test class for misc.suddenly.""" diff --git a/tests/test_misc_tense_present.py b/tests/test_misc_tense_present.py index 0c16a9f0b..4a13f77f0 100644 --- a/tests/test_misc_tense_present.py +++ b/tests/test_misc_tense_present.py @@ -1,10 +1,10 @@ """Tests for misc.tense_present check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.misc import tense_present as chk +from .check import Check + class TestCheck(Check): """The test class for misc.tense_present.""" diff --git a/tests/test_misc_usage.py b/tests/test_misc_usage.py index ffa462e4b..af85adcb3 100644 --- a/tests/test_misc_usage.py +++ b/tests/test_misc_usage.py @@ -1,10 +1,10 @@ """Tests for misc.usage check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.misc import usage as chk +from .check import Check + class TestCheck(Check): """The test class for misc.usage.""" diff --git a/tests/test_misc_waxed.py b/tests/test_misc_waxed.py index 057adf113..020a09d27 100644 --- a/tests/test_misc_waxed.py +++ b/tests/test_misc_waxed.py @@ -1,10 +1,10 @@ """Tests for misc.waxed check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.misc import waxed as chk +from .check import Check + class TestCheck(Check): """The test class for misc.waxed.""" diff --git a/tests/test_misc_whence.py b/tests/test_misc_whence.py index c4f658ac2..44d0c25aa 100644 --- a/tests/test_misc_whence.py +++ b/tests/test_misc_whence.py @@ -1,10 +1,10 @@ """Tests for misc.whence check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.misc import whence as chk +from .check import Check + class TestCheck(Check): """The test class for misc.whence.""" diff --git a/tests/test_mixed_metaphors.py b/tests/test_mixed_metaphors.py index 75b30af8e..e1c385f78 100644 --- a/tests/test_mixed_metaphors.py +++ b/tests/test_mixed_metaphors.py @@ -1,10 +1,10 @@ """Tests for mixed_metaphors.misc check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.mixed_metaphors import misc as chk +from .check import Check + class TestCheck(Check): """The test class for mixed_metaphors.misc.""" diff --git a/tests/test_mondegreens.py b/tests/test_mondegreens.py index da2131cd3..198c19f39 100644 --- a/tests/test_mondegreens.py +++ b/tests/test_mondegreens.py @@ -1,10 +1,10 @@ """Tests for mondegreens.misc check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.mondegreens import misc as chk +from .check import Check + class TestCheck(Check): """The test class for mondegreens.misc.""" diff --git a/tests/test_needless_variants.py b/tests/test_needless_variants.py index d517bed8e..f6a46325c 100644 --- a/tests/test_needless_variants.py +++ b/tests/test_needless_variants.py @@ -1,10 +1,10 @@ """Tests for needless_variants.misc check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.needless_variants import misc as chk +from .check import Check + class TestCheck(Check): """The test class for needless_variants.misc.""" diff --git a/tests/test_nonwords.py b/tests/test_nonwords.py index 3f8bc3f05..0a41e037f 100644 --- a/tests/test_nonwords.py +++ b/tests/test_nonwords.py @@ -1,10 +1,10 @@ """Tests for nonwords.misc check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.nonwords import misc as chk +from .check import Check + class TestCheck(Check): """The test class for nonwords.misc.""" diff --git a/tests/test_oxymorons.py b/tests/test_oxymorons.py index 390695b0a..371df0583 100644 --- a/tests/test_oxymorons.py +++ b/tests/test_oxymorons.py @@ -1,10 +1,10 @@ """Tests for oxymorons.misc check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.oxymorons import misc as chk +from .check import Check + class TestCheck(Check): """The test class for oxymorons.misc.""" diff --git a/tests/test_preferred_forms_check.py b/tests/test_preferred_forms_check.py index d2646acad..b9aaa3594 100644 --- a/tests/test_preferred_forms_check.py +++ b/tests/test_preferred_forms_check.py @@ -1,10 +1,10 @@ """Test the preferred_forms_check function from the tools.py module.""" from __future__ import absolute_import -from .check import Check - from proselint.tools import preferred_forms_check as chk +from .check import Check + class TestCheck(Check): """The test class for tools.preferred_forms_check.""" diff --git a/tests/test_psychology.py b/tests/test_psychology.py index 4b47585b4..a0dbd793c 100644 --- a/tests/test_psychology.py +++ b/tests/test_psychology.py @@ -1,10 +1,10 @@ """Tests for psychology.misc check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.psychology import misc as chk +from .check import Check + class TestCheck(Check): """The test class for psychology.misc.""" diff --git a/tests/test_redundancy_misc.py b/tests/test_redundancy_misc.py index bf0e4ae15..92461043e 100644 --- a/tests/test_redundancy_misc.py +++ b/tests/test_redundancy_misc.py @@ -1,10 +1,10 @@ """Tests for redundancy.misc check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.redundancy import misc as chk +from .check import Check + class TestCheck(Check): """The test class for redundancy.misc.""" diff --git a/tests/test_redundancy_ras_syndrome.py b/tests/test_redundancy_ras_syndrome.py index 581376902..39d84f21a 100644 --- a/tests/test_redundancy_ras_syndrome.py +++ b/tests/test_redundancy_ras_syndrome.py @@ -1,10 +1,10 @@ """Tests for redundancy.ras_syndrome check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.redundancy import ras_syndrome as chk +from .check import Check + class TestCheck(Check): """The test class for redundancy.ras_syndrome.""" diff --git a/tests/test_security_credit_card.py b/tests/test_security_credit_card.py index 65f14d0f6..e02ad1b4d 100644 --- a/tests/test_security_credit_card.py +++ b/tests/test_security_credit_card.py @@ -1,10 +1,10 @@ """Tests for security.credit_card check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.security import credit_card as chk +from .check import Check + class TestCheck(Check): """The test class for security.credit_card.""" diff --git a/tests/test_security_password.py b/tests/test_security_password.py index 4a58d1338..981c1f2ca 100644 --- a/tests/test_security_password.py +++ b/tests/test_security_password.py @@ -1,10 +1,10 @@ """Tests for security.password check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.security import password as chk +from .check import Check + class TestCheck(Check): """The test class for security.password.""" diff --git a/tests/test_sexism.py b/tests/test_sexism.py index 590d1f7d8..0d55cccb6 100644 --- a/tests/test_sexism.py +++ b/tests/test_sexism.py @@ -1,10 +1,10 @@ """Tests for sexism.misc check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.sexism import misc as chk +from .check import Check + class TestCheck(Check): """The test class for sexism.misc.""" diff --git a/tests/test_skunked_terms.py b/tests/test_skunked_terms.py index ce3a78936..7a48e9e52 100644 --- a/tests/test_skunked_terms.py +++ b/tests/test_skunked_terms.py @@ -1,10 +1,10 @@ """Tests for skunked_terms.misc check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.skunked_terms import misc as chk +from .check import Check + class TestCheck(Check): """The test class for skunked_terms.misc.""" diff --git a/tests/test_spelling_able_atable.py b/tests/test_spelling_able_atable.py index 5d847da1e..4d88ac942 100644 --- a/tests/test_spelling_able_atable.py +++ b/tests/test_spelling_able_atable.py @@ -1,10 +1,10 @@ """Tests for spelling.able_atable check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.spelling import able_atable as chk +from .check import Check + class TestCheck(Check): """The test class for spelling.able_atable.""" diff --git a/tests/test_spelling_able_ible.py b/tests/test_spelling_able_ible.py index 5b3105207..f2c3a3486 100644 --- a/tests/test_spelling_able_ible.py +++ b/tests/test_spelling_able_ible.py @@ -1,10 +1,10 @@ """Tests for spelling.able_ible check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.spelling import able_ible as chk +from .check import Check + class TestCheck(Check): """The test class for spelling.able_ible.""" diff --git a/tests/test_spelling_athletes.py b/tests/test_spelling_athletes.py index de9e57b4c..6ce839537 100644 --- a/tests/test_spelling_athletes.py +++ b/tests/test_spelling_athletes.py @@ -1,10 +1,10 @@ """Tests for spelling.athletes check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.spelling import athletes as chk +from .check import Check + class TestCheck(Check): """The test class for spelling.athletes.""" diff --git a/tests/test_spelling_em_im_en_in.py b/tests/test_spelling_em_im_en_in.py index 1c5a50c89..b8e351d88 100644 --- a/tests/test_spelling_em_im_en_in.py +++ b/tests/test_spelling_em_im_en_in.py @@ -1,10 +1,10 @@ """Tests for spelling.em_im_en_in check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.spelling import em_im_en_in as chk +from .check import Check + class TestCheck(Check): """The test class for spelling.em_im_en_in.""" diff --git a/tests/test_spelling_er_or.py b/tests/test_spelling_er_or.py index 48a3e8b39..9dac0689a 100644 --- a/tests/test_spelling_er_or.py +++ b/tests/test_spelling_er_or.py @@ -1,10 +1,10 @@ """Tests for spelling.er_or check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.spelling import er_or as chk +from .check import Check + class TestCheck(Check): """The test class for spelling.er_or.""" diff --git a/tests/test_spelling_in_un.py b/tests/test_spelling_in_un.py index a0af53189..29d2d3c2e 100644 --- a/tests/test_spelling_in_un.py +++ b/tests/test_spelling_in_un.py @@ -1,10 +1,10 @@ """Tests for spelling.in_un check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.spelling import in_un as chk +from .check import Check + class TestCheck(Check): """The test class for spelling.in_un.""" diff --git a/tests/test_spelling_misc.py b/tests/test_spelling_misc.py index f38094af6..a54bee27d 100644 --- a/tests/test_spelling_misc.py +++ b/tests/test_spelling_misc.py @@ -1,10 +1,10 @@ """Tests for spelling.misc check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.spelling import misc as chk +from .check import Check + class TestCheck(Check): """The test class for spelling.misc.""" diff --git a/tests/test_terms_animal_adjectives.py b/tests/test_terms_animal_adjectives.py index ce8f21911..479ebc3ed 100644 --- a/tests/test_terms_animal_adjectives.py +++ b/tests/test_terms_animal_adjectives.py @@ -1,10 +1,10 @@ """Tests for terms.animal_adjectives check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.terms import animal_adjectives as chk +from .check import Check + class TestCheck(Check): """The test class for terms.animal_adjectives.""" diff --git a/tests/test_terms_denizen_labels.py b/tests/test_terms_denizen_labels.py index 3dd0d4438..979ac872c 100644 --- a/tests/test_terms_denizen_labels.py +++ b/tests/test_terms_denizen_labels.py @@ -1,10 +1,10 @@ """Tests for terms.denizen_labels check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.terms import denizen_labels as chk +from .check import Check + class TestCheck(Check): """The test class for terms.denizen_labels.""" diff --git a/tests/test_terms_eponymous_adjectives.py b/tests/test_terms_eponymous_adjectives.py index e81975646..9ec25cc38 100644 --- a/tests/test_terms_eponymous_adjectives.py +++ b/tests/test_terms_eponymous_adjectives.py @@ -1,10 +1,10 @@ """Tests for terms.eponymous_adjectives check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.terms import eponymous_adjectives as chk +from .check import Check + class TestCheck(Check): """The test class for terms.eponymous_adjectives.""" diff --git a/tests/test_terms_venery.py b/tests/test_terms_venery.py index 0fbc474df..4898050b6 100644 --- a/tests/test_terms_venery.py +++ b/tests/test_terms_venery.py @@ -1,10 +1,10 @@ """Tests for terms.venery check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.terms import venery as chk +from .check import Check + class TestCheck(Check): """The test class for terms.venery.""" diff --git a/tests/test_tools.py b/tests/test_tools.py index 80401402a..231e7dd99 100644 --- a/tests/test_tools.py +++ b/tests/test_tools.py @@ -2,9 +2,9 @@ from __future__ import absolute_import -from .check import Check +from proselint.tools import existence_check, lint -from proselint.tools import lint, existence_check +from .check import Check class TestLint(Check): diff --git a/tests/test_typography_diacritical_marks.py b/tests/test_typography_diacritical_marks.py index 0ec266d4f..72ac67fa6 100644 --- a/tests/test_typography_diacritical_marks.py +++ b/tests/test_typography_diacritical_marks.py @@ -1,10 +1,10 @@ """Tests for typography.diacritical_marks check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.typography import diacritical_marks as chk +from .check import Check + class TestCheck(Check): """The test class for typography.diacritical_marks.""" diff --git a/tests/test_typography_exclamation.py b/tests/test_typography_exclamation.py index eb443a1af..533ecda9d 100644 --- a/tests/test_typography_exclamation.py +++ b/tests/test_typography_exclamation.py @@ -1,10 +1,10 @@ """Tests for typography.exclamation check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.typography import exclamation as chk +from .check import Check + class TestCheck(Check): """The test class for typography.exclamation.""" diff --git a/tests/test_typography_symbols.py b/tests/test_typography_symbols.py index 5f61efc92..a6c67f40e 100644 --- a/tests/test_typography_symbols.py +++ b/tests/test_typography_symbols.py @@ -1,10 +1,10 @@ """Test Butterick's symbols.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.typography import symbols as chk +from .check import Check + class TestCheck(Check): """The test class for typography.symbols.""" diff --git a/tests/test_uncomparables.py b/tests/test_uncomparables.py index bb1dd03b6..f7e7ec975 100644 --- a/tests/test_uncomparables.py +++ b/tests/test_uncomparables.py @@ -1,8 +1,10 @@ """Test uncomparables.misc""" from __future__ import absolute_import -from .check import Check + from proselint.checks.uncomparables import misc as chk +from .check import Check + class TestCheck(Check): """The test class for uncomparables.misc.""" diff --git a/tests/test_weasel_words_misc.py b/tests/test_weasel_words_misc.py index 8851cb92e..dff0df871 100644 --- a/tests/test_weasel_words_misc.py +++ b/tests/test_weasel_words_misc.py @@ -1,10 +1,10 @@ """Tests for weasel_words.misc check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.weasel_words import misc as chk +from .check import Check + class TestCheck(Check): """The test class for weasel_words.misc.""" diff --git a/tests/test_weasel_words_very.py b/tests/test_weasel_words_very.py index 4f958e098..0fb1dd89f 100644 --- a/tests/test_weasel_words_very.py +++ b/tests/test_weasel_words_very.py @@ -1,10 +1,10 @@ """Tests for weasel_words.very check.""" from __future__ import absolute_import -from .check import Check - from proselint.checks.weasel_words import very as chk +from .check import Check + class TestCheck(Check): """The test class for weasel_words.very.""" From ecf06d678783d4176ebdbe02f8016e9faca9505f Mon Sep 17 00:00:00 2001 From: Nytelife26 Date: Tue, 6 Jul 2021 22:16:13 +0100 Subject: [PATCH 3/3] refactor: finalize port to py3 --- proselint/checks/airlinese/misc.py | 3 +- proselint/checks/annotations/misc.py | 3 +- proselint/checks/archaism/misc.py | 3 +- proselint/checks/cliches/hell.py | 3 +- proselint/checks/cliches/misc.py | 10 +- proselint/checks/consistency/spacing.py | 1 - proselint/checks/consistency/spelling.py | 1 - proselint/checks/corporate_speak/__init__.py | 2 +- proselint/checks/corporate_speak/misc.py | 3 +- proselint/checks/cursing/filth.py | 3 +- proselint/checks/cursing/nfl.py | 3 +- proselint/checks/cursing/nword.py | 3 +- proselint/checks/dates_times/am_pm.py | 11 +- proselint/checks/dates_times/dates.py | 11 +- proselint/checks/hedging/misc.py | 1 - proselint/checks/hyperbole/misc.py | 3 +- .../inprogress/capitalization_errors.py | 5 +- proselint/checks/inprogress/example_check.py | 1 - proselint/checks/jargon/misc.py | 5 +- proselint/checks/lexical_illusions/misc.py | 2 +- proselint/checks/lgbtq/offensive_terms.py | 1 - proselint/checks/lgbtq/terms.py | 1 - proselint/checks/links/broken.py | 3 +- proselint/checks/malapropisms/misc.py | 3 +- proselint/checks/misc/apologizing.py | 1 - proselint/checks/misc/back_formations.py | 1 - proselint/checks/misc/bureaucratese.py | 3 +- proselint/checks/misc/but.py | 5 +- proselint/checks/misc/capitalization.py | 1 - proselint/checks/misc/chatspeak.py | 3 +- proselint/checks/misc/commercialese.py | 1 - proselint/checks/misc/currency.py | 3 +- proselint/checks/misc/debased.py | 3 +- proselint/checks/misc/false_plurals.py | 5 +- proselint/checks/misc/illogic.py | 3 +- proselint/checks/misc/inferior_superior.py | 1 - proselint/checks/misc/institution_name.py | 1 - proselint/checks/misc/latin.py | 1 - proselint/checks/misc/many_a.py | 3 +- proselint/checks/misc/metaconcepts.py | 1 - proselint/checks/misc/metadiscourse.py | 1 - proselint/checks/misc/narcissism.py | 1 - proselint/checks/misc/not_guilty.py | 3 +- proselint/checks/misc/phrasal_adjectives.py | 5 +- proselint/checks/misc/preferred_forms.py | 1 - proselint/checks/misc/pretension.py | 3 +- proselint/checks/misc/professions.py | 1 - proselint/checks/misc/punctuation.py | 3 +- proselint/checks/misc/scare_quotes.py | 1 - proselint/checks/misc/suddenly.py | 5 +- proselint/checks/misc/tense_present.py | 3 +- proselint/checks/misc/waxed.py | 2 +- proselint/checks/misc/whence.py | 3 +- proselint/checks/mixed_metaphors/misc.py | 6 +- proselint/checks/mondegreens/misc.py | 1 - proselint/checks/needless_variants/misc.py | 1 - proselint/checks/nonwords/misc.py | 1 - proselint/checks/oxymorons/misc.py | 3 +- proselint/checks/psychology/misc.py | 1 - proselint/checks/redundancy/misc.py | 4 +- proselint/checks/redundancy/ras_syndrome.py | 2 - proselint/checks/security/credit_card.py | 3 +- proselint/checks/security/password.py | 13 +- proselint/checks/sexism/misc.py | 1 - proselint/checks/skunked_terms/misc.py | 3 +- proselint/checks/spelling/able_atable.py | 2 - proselint/checks/spelling/able_ible.py | 2 - proselint/checks/spelling/athletes.py | 1 - proselint/checks/spelling/em_im_en_in.py | 2 - proselint/checks/spelling/er_or.py | 2 - proselint/checks/spelling/in_un.py | 2 - proselint/checks/spelling/misc.py | 1 - proselint/checks/terms/animal_adjectives.py | 1 - proselint/checks/terms/denizen_labels.py | 4 +- .../checks/terms/eponymous_adjectives.py | 1 - proselint/checks/terms/venery.py | 5 +- .../checks/typography/diacritical_marks.py | 171 +++++++++--------- proselint/checks/typography/exclamation.py | 5 +- proselint/checks/typography/symbols.py | 19 +- proselint/checks/uncomparables/misc.py | 3 +- proselint/checks/weasel_words/very.py | 1 - proselint/command_line.py | 4 - proselint/score.py | 10 +- proselint/tools.py | 7 +- 84 files changed, 168 insertions(+), 267 deletions(-) diff --git a/proselint/checks/airlinese/misc.py b/proselint/checks/airlinese/misc.py index 2789387b0..62e73903f 100644 --- a/proselint/checks/airlinese/misc.py +++ b/proselint/checks/airlinese/misc.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Airlinese. --- @@ -20,7 +19,7 @@ def check(text): """Check the text.""" err = "airlinese.misc" - msg = u"'{}' is airlinese." + msg = "'{}' is airlinese." airlinese = [ "enplan(?:e|ed|ing|ement)", diff --git a/proselint/checks/annotations/misc.py b/proselint/checks/annotations/misc.py index ef9ab3594..9a0f3955d 100644 --- a/proselint/checks/annotations/misc.py +++ b/proselint/checks/annotations/misc.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Annotation left in text. --- @@ -20,7 +19,7 @@ def check(text): """Check the text.""" err = "annotations.misc" - msg = u"Annotation left in text." + msg = "Annotation left in text." annotations = [ "FIXME", diff --git a/proselint/checks/archaism/misc.py b/proselint/checks/archaism/misc.py index e42505e6f..7cfe443f9 100644 --- a/proselint/checks/archaism/misc.py +++ b/proselint/checks/archaism/misc.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Archaism. --- @@ -20,7 +19,7 @@ def check(text): """Check the text.""" err = "archaism.misc" - msg = u"'{}' is archaic." + msg = "'{}' is archaic." archaisms = [ "alack", diff --git a/proselint/checks/cliches/hell.py b/proselint/checks/cliches/hell.py index 61d4b9499..5c6d0764e 100644 --- a/proselint/checks/cliches/hell.py +++ b/proselint/checks/cliches/hell.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Too much yelling. --- @@ -20,7 +19,7 @@ def check_repeated_exclamations(text): """Check the text.""" err = "leonard.hell" - msg = u"Never use the words 'all hell broke loose'." + msg = "Never use the words 'all hell broke loose'." regex = r"all hell broke loose" diff --git a/proselint/checks/cliches/misc.py b/proselint/checks/cliches/misc.py index 30bacfb92..b28bbb745 100644 --- a/proselint/checks/cliches/misc.py +++ b/proselint/checks/cliches/misc.py @@ -1,6 +1,4 @@ -# -*- coding: utf-8 -*- - -u"""Cliches are cliché.""" +"""Cliches are cliché.""" from proselint.tools import existence_check, memoize @@ -13,7 +11,7 @@ def check_cliches_garner(text): source_url: http://bit.ly/1T4alrY """ err = "cliches.garner" - msg = u"'{}' is cliché." + msg = "'{}' is cliché." cliches = [ "a fate worse than death", @@ -107,7 +105,7 @@ def check_cliches_write_good(text): source_url: https://github.com/btford/write-good """ err = "cliches.write_good" - msg = u"'{}' is a cliché." + msg = "'{}' is a cliché." cliches = [ "a chip off the old block", @@ -820,7 +818,7 @@ def check_cliches_gnu_diction(text): source_url: https://directory.fsf.org/wiki/Diction """ err = "cliches.gnu_diction" - msg = u"'{}' is a cliché." + msg = "'{}' is a cliché." list = [ "a matter of concern", diff --git a/proselint/checks/consistency/spacing.py b/proselint/checks/consistency/spacing.py index f7c8527d5..54bece47e 100644 --- a/proselint/checks/consistency/spacing.py +++ b/proselint/checks/consistency/spacing.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Mixed one vs. two spaces after a period. --- diff --git a/proselint/checks/consistency/spelling.py b/proselint/checks/consistency/spelling.py index e02b10fd7..f710ee9b7 100644 --- a/proselint/checks/consistency/spelling.py +++ b/proselint/checks/consistency/spelling.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Inconsistent spelling. --- diff --git a/proselint/checks/corporate_speak/__init__.py b/proselint/checks/corporate_speak/__init__.py index 1f9e4d554..408cb2e21 100644 --- a/proselint/checks/corporate_speak/__init__.py +++ b/proselint/checks/corporate_speak/__init__.py @@ -1 +1 @@ -u"""Corporate-speak.""" +"""Corporate-speak.""" diff --git a/proselint/checks/corporate_speak/misc.py b/proselint/checks/corporate_speak/misc.py index 320eff26d..9c502113f 100644 --- a/proselint/checks/corporate_speak/misc.py +++ b/proselint/checks/corporate_speak/misc.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Corporate speak. --- @@ -20,7 +19,7 @@ def check(text): """Check the text.""" err = "corporate_speak.misc" - msg = u"Minimize your use of corporate catchphrases like this one." + msg = "Minimize your use of corporate catchphrases like this one." list = [ "at the end of the day", diff --git a/proselint/checks/cursing/filth.py b/proselint/checks/cursing/filth.py index a21b4613a..7b07db34a 100644 --- a/proselint/checks/cursing/filth.py +++ b/proselint/checks/cursing/filth.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Filthy words. --- @@ -20,7 +19,7 @@ def check(text): """Check the text.""" err = "cursing.filth" - msg = u"""Nobody ever tells you this as a kid, but you're supposed to avoid + msg = """Nobody ever tells you this as a kid, but you're supposed to avoid this word.""" list = [ diff --git a/proselint/checks/cursing/nfl.py b/proselint/checks/cursing/nfl.py index 9659d47e2..ffac518d6 100644 --- a/proselint/checks/cursing/nfl.py +++ b/proselint/checks/cursing/nfl.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Words the NFL won't print on a jersey. --- @@ -20,7 +19,7 @@ def check(text): """Check the text.""" err = "cursing.nfl" - msg = u"The NFL won't print this word on a jersey." + msg = "The NFL won't print this word on a jersey." list = [ "420", diff --git a/proselint/checks/cursing/nword.py b/proselint/checks/cursing/nword.py index bff04848b..31aafe3f1 100644 --- a/proselint/checks/cursing/nword.py +++ b/proselint/checks/cursing/nword.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """On 'the N word'. --- @@ -20,7 +19,7 @@ def check(text): """Check the text.""" err = "cursing.nword" - msg = u"Take responsibility for the shitty words you want to say." + msg = "Take responsibility for the shitty words you want to say." list = [ "the n-word", diff --git a/proselint/checks/dates_times/am_pm.py b/proselint/checks/dates_times/am_pm.py index d80c46b9c..fbd74e164 100644 --- a/proselint/checks/dates_times/am_pm.py +++ b/proselint/checks/dates_times/am_pm.py @@ -1,5 +1,4 @@ -# -*- coding: utf-8 -*- -u"""a.m. / p.m. +"""a.m. / p.m. --- layout: post @@ -18,7 +17,7 @@ def check_lowercase_periods(text): """Check the text.""" err = "dates_times.am_pm.lowercase_periods" - msg = u"With lowercase letters, the periods are standard." + msg = "With lowercase letters, the periods are standard." return existence_check(text, [r"\d{1,2} ?[ap]m"], err, msg) @@ -27,7 +26,7 @@ def check_lowercase_periods(text): def check_spacing(text): """Check the text.""" err = "dates_times.am_pm.spacing" - msg = u"It's standard to put a space before 'a.m.' or 'p.m.'." + msg = "It's standard to put a space before 'a.m.' or 'p.m.'." return existence_check(text, [r"\d{1,2}[ap]\.?m\.?"], err, msg) @@ -36,7 +35,7 @@ def check_spacing(text): def check_midnight_noon(text): """Check the text.""" err = "dates_times.am_pm.midnight_noon" - msg = (u"12 a.m. and 12 p.m. are wrong and confusing." + msg = ("12 a.m. and 12 p.m. are wrong and confusing." " Use 'midnight' or 'noon'.") return existence_check(text, [r"12 ?[ap]\.?m\.?"], err, msg) @@ -46,7 +45,7 @@ def check_midnight_noon(text): def check_redundancy(text): """Check the text.""" err = "dates_times.am_pm.midnight_noon" - msg = (u"'a.m.' is always morning; 'p.m.' is always night.") + msg = ("'a.m.' is always morning; 'p.m.' is always night.") list = [ r"\d{1,2} ?a\.?m\.? in the morning", diff --git a/proselint/checks/dates_times/dates.py b/proselint/checks/dates_times/dates.py index 0fec0dbee..114dba180 100644 --- a/proselint/checks/dates_times/dates.py +++ b/proselint/checks/dates_times/dates.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Dates. --- @@ -22,7 +21,7 @@ def check_decade_apostrophes_short(text): """Check the text for dates of the form X0's.""" err = "dates_times.dates" - msg = u"Apostrophes aren't needed for decades." + msg = "Apostrophes aren't needed for decades." regex = r"\d0\'s" @@ -34,7 +33,7 @@ def check_decade_apostrophes_short(text): def check_decade_apostrophes_long(text): """Check the text for dates of the form XXX0's.""" err = "dates_times.dates" - msg = u"Apostrophes aren't needed for decades." + msg = "Apostrophes aren't needed for decades." regex = r"\d\d\d0\'s" return existence_check(text, [regex], err, msg) @@ -44,7 +43,7 @@ def check_decade_apostrophes_long(text): def check_dash_and_from(text): """Check the text.""" err = "dates_times.dates" - msg = u"When specifying a date range, write 'from X to Y'." + msg = "When specifying a date range, write 'from X to Y'." regex = r"[fF]rom \d+[^ \t\n\r\f\va-zA-Z0-9_\.]\d+" return existence_check(text, [regex], err, msg) @@ -53,7 +52,7 @@ def check_dash_and_from(text): def check_month_year_comma(text): """Check the text.""" err = "dates_times.dates" - msg = u"When specifying a month and year, no comma is needed." + msg = "When specifying a month and year, no comma is needed." regex = r"(?:" + "|".join(calendar.month_name[1:]) + r"), \d{3,}" return existence_check(text, [regex], err, msg) @@ -63,7 +62,7 @@ def check_month_year_comma(text): def check_month_of_year(text): """Check the text.""" err = "dates_times.dates" - msg = u"When specifying a month and year, 'of' is unnecessary." + msg = "When specifying a month and year, 'of' is unnecessary." regex = r"(?:" + "|".join(calendar.month_name[1:]) + r") of \d{3,}" return existence_check(text, [regex], err, msg) diff --git a/proselint/checks/hedging/misc.py b/proselint/checks/hedging/misc.py index c7daba439..a433f49bd 100644 --- a/proselint/checks/hedging/misc.py +++ b/proselint/checks/hedging/misc.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Hedging. --- diff --git a/proselint/checks/hyperbole/misc.py b/proselint/checks/hyperbole/misc.py index 37b598a6f..f351b6d99 100644 --- a/proselint/checks/hyperbole/misc.py +++ b/proselint/checks/hyperbole/misc.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Hyperbolic language. --- @@ -20,7 +19,7 @@ def check(text): """Check the text.""" err = "hyperbolic.misc" - msg = u"'{}' is hyperbolic." + msg = "'{}' is hyperbolic." words = [ r"[a-z]*[!]{2,}", diff --git a/proselint/checks/inprogress/capitalization_errors.py b/proselint/checks/inprogress/capitalization_errors.py index e2eeede51..b4c2da679 100644 --- a/proselint/checks/inprogress/capitalization_errors.py +++ b/proselint/checks/inprogress/capitalization_errors.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Password in plain text. --- @@ -23,12 +22,12 @@ def check(text): """Check the text.""" err = "MSC104" - msg = u"Don't fail to capitalize roman numeral abbreviations." + msg = "Don't fail to capitalize roman numeral abbreviations." pwd_regex = " (I(i*)|i*)" password = [ - "World War{}".format(pwd_regex), + f"World War{pwd_regex}", ] return blacklist(text, password, err, msg) diff --git a/proselint/checks/inprogress/example_check.py b/proselint/checks/inprogress/example_check.py index 93215462f..4a39ed339 100644 --- a/proselint/checks/inprogress/example_check.py +++ b/proselint/checks/inprogress/example_check.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """First line is always wrong. --- diff --git a/proselint/checks/jargon/misc.py b/proselint/checks/jargon/misc.py index 9fa7d695b..5dac520bb 100644 --- a/proselint/checks/jargon/misc.py +++ b/proselint/checks/jargon/misc.py @@ -1,5 +1,4 @@ -# -*- coding: utf-8 -*- -u"""Cliches. +"""Cliches. --- layout: post @@ -20,7 +19,7 @@ def check(text): """Check the text.""" err = "jargon.misc" - msg = u"'{}' is jargon. Can you replace it with something more standard?" + msg = "'{}' is jargon. Can you replace it with something more standard?" jargon = [ "in the affirmative", diff --git a/proselint/checks/lexical_illusions/misc.py b/proselint/checks/lexical_illusions/misc.py index 115bab1de..7d92b3b04 100644 --- a/proselint/checks/lexical_illusions/misc.py +++ b/proselint/checks/lexical_illusions/misc.py @@ -20,7 +20,7 @@ def check(text): """Check the text.""" err = "lexical_illusions.misc" - msg = u"There's a lexical illusion here: a word is repeated." + msg = "There's a lexical illusion here: a word is repeated." regex = r"\b(\w+)(\b\s\1)+\b" exceptions = [r"^had had$", r"^that that$"] diff --git a/proselint/checks/lgbtq/offensive_terms.py b/proselint/checks/lgbtq/offensive_terms.py index 7e81ddb23..d164b648e 100644 --- a/proselint/checks/lgbtq/offensive_terms.py +++ b/proselint/checks/lgbtq/offensive_terms.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """GLAAD. --- diff --git a/proselint/checks/lgbtq/terms.py b/proselint/checks/lgbtq/terms.py index 67bf37878..de070a8fc 100644 --- a/proselint/checks/lgbtq/terms.py +++ b/proselint/checks/lgbtq/terms.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """GLAAD. --- diff --git a/proselint/checks/links/broken.py b/proselint/checks/links/broken.py index bbe2f0a10..aacebe3b7 100644 --- a/proselint/checks/links/broken.py +++ b/proselint/checks/links/broken.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Checks that links are viable. --- @@ -28,7 +27,7 @@ def check(text): """Check the text.""" err = "links.valid" - msg = u"Broken link: {}" + msg = "Broken link: {}" regex = re.compile( r"""(?i)\b((?:https?://|www\d{0,3}[.] diff --git a/proselint/checks/malapropisms/misc.py b/proselint/checks/malapropisms/misc.py index 53a0d6272..57ae14e51 100644 --- a/proselint/checks/malapropisms/misc.py +++ b/proselint/checks/malapropisms/misc.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Malaproprisms. --- @@ -20,7 +19,7 @@ def check(text): """Check the text.""" err = "malapropisms.misc" - msg = u"'{}' is a malapropism." + msg = "'{}' is a malapropism." illogics = [ "the infinitesimal universe", diff --git a/proselint/checks/misc/apologizing.py b/proselint/checks/misc/apologizing.py index 966cba385..2eb4d35b2 100644 --- a/proselint/checks/misc/apologizing.py +++ b/proselint/checks/misc/apologizing.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Excessive apologizing. --- diff --git a/proselint/checks/misc/back_formations.py b/proselint/checks/misc/back_formations.py index c078a4764..454bae88c 100644 --- a/proselint/checks/misc/back_formations.py +++ b/proselint/checks/misc/back_formations.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Back-formations. --- diff --git a/proselint/checks/misc/bureaucratese.py b/proselint/checks/misc/bureaucratese.py index def17310a..89d9ad016 100644 --- a/proselint/checks/misc/bureaucratese.py +++ b/proselint/checks/misc/bureaucratese.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Bureaucratese. --- @@ -20,7 +19,7 @@ def check(text): """Check the text.""" err = "misc.bureaucratese" - msg = u"'{}' is bureaucratese." + msg = "'{}' is bureaucratese." bureaucratese = [ "meet with your approval", diff --git a/proselint/checks/misc/but.py b/proselint/checks/misc/but.py index 4833b11fd..2ec8518eb 100644 --- a/proselint/checks/misc/but.py +++ b/proselint/checks/misc/but.py @@ -1,5 +1,4 @@ -# -*- coding: utf-8 -*- -u"""Don't start a paragraph with 'But'. +"""Don't start a paragraph with 'But'. --- layout: @@ -20,7 +19,7 @@ def check(text): """Do not start a paragraph with a 'But'.""" err = "misc.but" - msg = u"No paragraph should start with a 'But'." + msg = "No paragraph should start with a 'But'." regex = r"(^|([\n\r]+))(\s*)But" return existence_check(text, [regex], err, msg, ignore_case=False) diff --git a/proselint/checks/misc/capitalization.py b/proselint/checks/misc/capitalization.py index 8d12f8d14..befc57d78 100644 --- a/proselint/checks/misc/capitalization.py +++ b/proselint/checks/misc/capitalization.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Incorrect capitalization. --- diff --git a/proselint/checks/misc/chatspeak.py b/proselint/checks/misc/chatspeak.py index dfef4cd8e..3ee7cbeb6 100644 --- a/proselint/checks/misc/chatspeak.py +++ b/proselint/checks/misc/chatspeak.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Chatspeak. --- @@ -20,7 +19,7 @@ def check(text): """Check the text.""" err = "misc.chatspeak" - msg = u"'{}' is chatspeak. Write it out." + msg = "'{}' is chatspeak. Write it out." words = [ "2day", diff --git a/proselint/checks/misc/commercialese.py b/proselint/checks/misc/commercialese.py index 6531b0102..4ed63826e 100644 --- a/proselint/checks/misc/commercialese.py +++ b/proselint/checks/misc/commercialese.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Commercialese. --- diff --git a/proselint/checks/misc/currency.py b/proselint/checks/misc/currency.py index fe392b897..8ef85601f 100644 --- a/proselint/checks/misc/currency.py +++ b/proselint/checks/misc/currency.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Currency. --- @@ -20,7 +19,7 @@ def check(text): """Check the text.""" err = "misc.currency" - msg = u"Incorrect use of symbols in {}." + msg = "Incorrect use of symbols in {}." symbols = [ r"\$[\d]* ?(?:dollars|usd|us dollars)" diff --git a/proselint/checks/misc/debased.py b/proselint/checks/misc/debased.py index 449886bbf..529ed5206 100644 --- a/proselint/checks/misc/debased.py +++ b/proselint/checks/misc/debased.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Debased language. --- @@ -20,7 +19,7 @@ def check(text): """Check the text.""" err = "misc.debased" - msg = u"Bad usage, debased language, a continuous temptation." + msg = "Bad usage, debased language, a continuous temptation." list = [ "a not unjustifiable assumption", diff --git a/proselint/checks/misc/false_plurals.py b/proselint/checks/misc/false_plurals.py index 0a11a21ab..33963ca58 100644 --- a/proselint/checks/misc/false_plurals.py +++ b/proselint/checks/misc/false_plurals.py @@ -1,5 +1,4 @@ -# -*- coding: utf-8 -*- -u"""False plurals. +"""False plurals. --- layout: post @@ -34,6 +33,6 @@ def check(text): def check_kudos(text): """Check the text.""" err = "misc.false_plurals.kudos" - msg = u"Kudos is singular." + msg = "Kudos is singular." return existence_check(text, ["many kudos"], err, msg) diff --git a/proselint/checks/misc/illogic.py b/proselint/checks/misc/illogic.py index 7088f4f47..75c436cf1 100644 --- a/proselint/checks/misc/illogic.py +++ b/proselint/checks/misc/illogic.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Illogic. --- @@ -20,7 +19,7 @@ def check(text): """Check the text.""" err = "misc.illogic" - msg = u"'{}' is illogical." + msg = "'{}' is illogical." illogics = [ "preplan", diff --git a/proselint/checks/misc/inferior_superior.py b/proselint/checks/misc/inferior_superior.py index 39da3b018..1ddabc822 100644 --- a/proselint/checks/misc/inferior_superior.py +++ b/proselint/checks/misc/inferior_superior.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Inferior / Superior. --- diff --git a/proselint/checks/misc/institution_name.py b/proselint/checks/misc/institution_name.py index b86aeeb82..042aec31e 100644 --- a/proselint/checks/misc/institution_name.py +++ b/proselint/checks/misc/institution_name.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Common errors with institution names. --- diff --git a/proselint/checks/misc/latin.py b/proselint/checks/misc/latin.py index d3bbe49b3..6e8fe8179 100644 --- a/proselint/checks/misc/latin.py +++ b/proselint/checks/misc/latin.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Back-formations. --- diff --git a/proselint/checks/misc/many_a.py b/proselint/checks/misc/many_a.py index 81a5df5df..7192a5436 100644 --- a/proselint/checks/misc/many_a.py +++ b/proselint/checks/misc/many_a.py @@ -1,5 +1,4 @@ -# -*- coding: utf-8 -*- -u"""Many a singular. +"""Many a singular. --- layout: post diff --git a/proselint/checks/misc/metaconcepts.py b/proselint/checks/misc/metaconcepts.py index b8c969341..7d12f39bc 100644 --- a/proselint/checks/misc/metaconcepts.py +++ b/proselint/checks/misc/metaconcepts.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Metaconcepts. --- diff --git a/proselint/checks/misc/metadiscourse.py b/proselint/checks/misc/metadiscourse.py index 154817e67..477a5812e 100644 --- a/proselint/checks/misc/metadiscourse.py +++ b/proselint/checks/misc/metadiscourse.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Metadiscourse. --- diff --git a/proselint/checks/misc/narcissism.py b/proselint/checks/misc/narcissism.py index 0630cc296..4ad9874e5 100644 --- a/proselint/checks/misc/narcissism.py +++ b/proselint/checks/misc/narcissism.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Professional narcissism. --- diff --git a/proselint/checks/misc/not_guilty.py b/proselint/checks/misc/not_guilty.py index 188ca3d23..d393a1a0e 100644 --- a/proselint/checks/misc/not_guilty.py +++ b/proselint/checks/misc/not_guilty.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Not guilty beyond a reasonable doubt. --- @@ -30,7 +29,7 @@ def check(text): """Check the text.""" err = "misc.not_guilty" - msg = u"'not guilty beyond a reasonable doubt' is an ambiguous phrasing." + msg = "'not guilty beyond a reasonable doubt' is an ambiguous phrasing." regex = r"not guilty beyond (a |any )?reasonable doubt" return existence_check(text, [regex], err, msg) diff --git a/proselint/checks/misc/phrasal_adjectives.py b/proselint/checks/misc/phrasal_adjectives.py index e7d0c62ce..ba57341a8 100644 --- a/proselint/checks/misc/phrasal_adjectives.py +++ b/proselint/checks/misc/phrasal_adjectives.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Phrasal adjectives. --- @@ -20,7 +19,7 @@ def check_ly(text): """Check the text.""" err = "garner.phrasal_adjectives.ly" - msg = u"""No hyphen is necessary in phrasal adjectives with an adverb + msg = """No hyphen is necessary in phrasal adjectives with an adverb ending in -ly, unless the -ly adverb is part of a longer phrase""" @@ -34,7 +33,7 @@ def check_ly(text): def check(text): """Check the text.""" err = "garner.phrasal_adjectives.examples" - msg = u"""Hyphenate '{1}', a phrasal adjective, as '{0}'.""" + msg = """Hyphenate '{1}', a phrasal adjective, as '{0}'.""" list = [ ["across-the-board discounts", ["across the board discounts"]], diff --git a/proselint/checks/misc/preferred_forms.py b/proselint/checks/misc/preferred_forms.py index fc3438fd9..c2456e0c1 100644 --- a/proselint/checks/misc/preferred_forms.py +++ b/proselint/checks/misc/preferred_forms.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Preferred forms. --- diff --git a/proselint/checks/misc/pretension.py b/proselint/checks/misc/pretension.py index e04b8ab25..6729e2140 100644 --- a/proselint/checks/misc/pretension.py +++ b/proselint/checks/misc/pretension.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Pretension. --- @@ -20,7 +19,7 @@ def check(text): """Check the text.""" err = "ogilvy.pretension" - msg = u"Jargon words like this one are the hallmarks of a pretentious ass." + msg = "Jargon words like this one are the hallmarks of a pretentious ass." list = [ "reconceptualize", diff --git a/proselint/checks/misc/professions.py b/proselint/checks/misc/professions.py index cd0e524c9..6bce6710a 100644 --- a/proselint/checks/misc/professions.py +++ b/proselint/checks/misc/professions.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Profession. --- diff --git a/proselint/checks/misc/punctuation.py b/proselint/checks/misc/punctuation.py index ebc044df2..08bd11b8e 100644 --- a/proselint/checks/misc/punctuation.py +++ b/proselint/checks/misc/punctuation.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Punctuation. --- @@ -20,7 +19,7 @@ def check(text): """Check the text.""" err = "garner.punctuation" - msg = u"Misplaced punctuation. It's 'et al.'" + msg = "Misplaced punctuation. It's 'et al.'" list = [ "et. al", diff --git a/proselint/checks/misc/scare_quotes.py b/proselint/checks/misc/scare_quotes.py index 7f48bfcba..4c5fa8048 100644 --- a/proselint/checks/misc/scare_quotes.py +++ b/proselint/checks/misc/scare_quotes.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Misuse of scare quotes. --- diff --git a/proselint/checks/misc/suddenly.py b/proselint/checks/misc/suddenly.py index 4b7ecbae7..d561b7f96 100644 --- a/proselint/checks/misc/suddenly.py +++ b/proselint/checks/misc/suddenly.py @@ -1,5 +1,4 @@ -# -*- coding: utf-8 -*- -u"""Suddenly. +"""Suddenly. --- layout: post @@ -32,7 +31,7 @@ def check(text): """Advice on sudden vs suddenly.""" err = "misc.suddenly" - msg = u"Suddenly is nondescript, slows the action, and warns your reader." + msg = "Suddenly is nondescript, slows the action, and warns your reader." regex = "Suddenly," return existence_check(text, [regex], err, msg, max_errors=3, diff --git a/proselint/checks/misc/tense_present.py b/proselint/checks/misc/tense_present.py index f41e17e5b..2c4a6d6f2 100644 --- a/proselint/checks/misc/tense_present.py +++ b/proselint/checks/misc/tense_present.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Tense present. --- @@ -40,7 +39,7 @@ def check(text): errors = [] for i in illogics: - for m in re.finditer(r"\s{}\s".format(i), text, flags=re.U | re.I): + for m in re.finditer(fr"\s{i}\s", text, flags=re.U | re.I): txt = m.group(0).strip() errors.append(( m.start() + 1, diff --git a/proselint/checks/misc/waxed.py b/proselint/checks/misc/waxed.py index 43146513f..15fa31e0d 100644 --- a/proselint/checks/misc/waxed.py +++ b/proselint/checks/misc/waxed.py @@ -22,7 +22,7 @@ def check(text): """Suggest the preferred forms.""" err = "misc.waxed" - msg = u"The modifier following 'waxed' must be an adj.: '{}' is correct" + msg = "The modifier following 'waxed' must be an adj.: '{}' is correct" waxes = ["wax", "waxes", "waxed", "waxing"] modifiers = [("ebullient", "ebulliently"), diff --git a/proselint/checks/misc/whence.py b/proselint/checks/misc/whence.py index def1ef9c5..e480fd1a7 100644 --- a/proselint/checks/misc/whence.py +++ b/proselint/checks/misc/whence.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """From whence it came. --- @@ -20,6 +19,6 @@ def check(text): """Check the text.""" err = "misc.whence" - msg = u"The 'from' in 'from whence' is not needed." + msg = "The 'from' in 'from whence' is not needed." return existence_check(text, ["from whence"], err, msg) diff --git a/proselint/checks/mixed_metaphors/misc.py b/proselint/checks/mixed_metaphors/misc.py index 1943a7551..dca1932f9 100644 --- a/proselint/checks/mixed_metaphors/misc.py +++ b/proselint/checks/mixed_metaphors/misc.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - """Mixed metaphors.""" from proselint.tools import existence_check, memoize, preferred_forms_check @@ -13,7 +11,7 @@ def check_bottleneck(text): source_url: http://bit.ly/1CQPH61 """ err = "mixed_metaphors.misc.bottleneck" - msg = u"Mixed metaphor — bottles with big necks are easy to pass through." + msg = "Mixed metaphor — bottles with big necks are easy to pass through." list = [ "biggest bottleneck", "big bottleneck", @@ -35,7 +33,7 @@ def check_misc(text): source_url: http://bit.ly/1T4alrY """ err = "mixed_metaphors.misc.misc" - msg = u"Mixed metaphor. Try '{}'." + msg = "Mixed metaphor. Try '{}'." preferences = [ diff --git a/proselint/checks/mondegreens/misc.py b/proselint/checks/mondegreens/misc.py index 0eea2785a..5064cd3e2 100644 --- a/proselint/checks/mondegreens/misc.py +++ b/proselint/checks/mondegreens/misc.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Mondegreens. --- diff --git a/proselint/checks/needless_variants/misc.py b/proselint/checks/needless_variants/misc.py index 839f9acc7..13e51cd7f 100644 --- a/proselint/checks/needless_variants/misc.py +++ b/proselint/checks/needless_variants/misc.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Needless variants. --- diff --git a/proselint/checks/nonwords/misc.py b/proselint/checks/nonwords/misc.py index 3834083c1..cf6ead862 100644 --- a/proselint/checks/nonwords/misc.py +++ b/proselint/checks/nonwords/misc.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Nonwords. --- diff --git a/proselint/checks/oxymorons/misc.py b/proselint/checks/oxymorons/misc.py index 0eb8d46b5..be2aa09a9 100644 --- a/proselint/checks/oxymorons/misc.py +++ b/proselint/checks/oxymorons/misc.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Oxymorons. --- @@ -20,7 +19,7 @@ def check(text): """Check the text.""" err = "oxymorons.misc" - msg = u"'{}' is an oxymoron." + msg = "'{}' is an oxymoron." oxymorons = [ "amateur expert", diff --git a/proselint/checks/psychology/misc.py b/proselint/checks/psychology/misc.py index 5e48b50bb..764ecf8d1 100644 --- a/proselint/checks/psychology/misc.py +++ b/proselint/checks/psychology/misc.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Psychological and psychiatric terms to avoid. --- diff --git a/proselint/checks/redundancy/misc.py b/proselint/checks/redundancy/misc.py index 1a46d9012..ddd58aff6 100644 --- a/proselint/checks/redundancy/misc.py +++ b/proselint/checks/redundancy/misc.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - """Redundancy.""" from proselint.tools import memoize, preferred_forms_check @@ -148,7 +146,7 @@ def check_atd(text): msg = "Redundancy. Use '{}' instead of '{}'." redundancies = [ - [u"Bō", ["Bo Staff"]], + ["Bō", ["Bo Staff"]], ["Challah", ["Challah bread"]], ["Hallah", ["Hallah bread"]], ["Challah", ["Challah bread"]], diff --git a/proselint/checks/redundancy/ras_syndrome.py b/proselint/checks/redundancy/ras_syndrome.py index de833160d..dae75add0 100644 --- a/proselint/checks/redundancy/ras_syndrome.py +++ b/proselint/checks/redundancy/ras_syndrome.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - """Redundant Acronym Syndrome (RAS) syndrome.""" from proselint.tools import memoize, preferred_forms_check diff --git a/proselint/checks/security/credit_card.py b/proselint/checks/security/credit_card.py index 666822458..9bf558284 100644 --- a/proselint/checks/security/credit_card.py +++ b/proselint/checks/security/credit_card.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Credit card number printed. --- @@ -20,7 +19,7 @@ def check(text): """Check the text.""" err = "security.credit_card" - msg = u"Don't put credit card numbers in plain text." + msg = "Don't put credit card numbers in plain text." credit_card_numbers = [ r"4\d{15}", diff --git a/proselint/checks/security/password.py b/proselint/checks/security/password.py index 3560308df..c5d271ba5 100644 --- a/proselint/checks/security/password.py +++ b/proselint/checks/security/password.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Password in plain text. --- @@ -19,16 +18,16 @@ def check(text): """Check the text.""" err = "security.password" - msg = u"Don't put passwords in plain text." + msg = "Don't put passwords in plain text." pwd_regex = r"[:]? [\S]{6,30}" password = [ - "the password is{}".format(pwd_regex), - "my password is{}".format(pwd_regex), - "the password's{}".format(pwd_regex), - "my password's{}".format(pwd_regex), - "^[pP]assword{}".format(pwd_regex), + f"the password is{pwd_regex}", + f"my password is{pwd_regex}", + f"the password's{pwd_regex}", + f"my password's{pwd_regex}", + f"^[pP]assword{pwd_regex}", ] return existence_check(text, password, err, msg) diff --git a/proselint/checks/sexism/misc.py b/proselint/checks/sexism/misc.py index 815bdf1fc..cd38324c8 100644 --- a/proselint/checks/sexism/misc.py +++ b/proselint/checks/sexism/misc.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Sexism. --- diff --git a/proselint/checks/skunked_terms/misc.py b/proselint/checks/skunked_terms/misc.py index 6862cc6b7..af8ce7d70 100644 --- a/proselint/checks/skunked_terms/misc.py +++ b/proselint/checks/skunked_terms/misc.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Skunked terms. --- @@ -20,7 +19,7 @@ def check(text): """Check the text.""" err = "skunked_terms.misc" - msg = u"""'{}' is a bit of a skunked term, impossible to use without issue. + msg = """'{}' is a bit of a skunked term, impossible to use without issue. Find some other way to say it.""" skunked_terms = [ diff --git a/proselint/checks/spelling/able_atable.py b/proselint/checks/spelling/able_atable.py index 1cc8e2b92..64e0ea9de 100644 --- a/proselint/checks/spelling/able_atable.py +++ b/proselint/checks/spelling/able_atable.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - """-able vs. -atable.""" from proselint.tools import memoize, preferred_forms_check diff --git a/proselint/checks/spelling/able_ible.py b/proselint/checks/spelling/able_ible.py index af0717f41..331d7f6de 100644 --- a/proselint/checks/spelling/able_ible.py +++ b/proselint/checks/spelling/able_ible.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - """-able vs. -ible.""" from proselint.tools import memoize, preferred_forms_check diff --git a/proselint/checks/spelling/athletes.py b/proselint/checks/spelling/athletes.py index ac6a15c14..73e692b7b 100644 --- a/proselint/checks/spelling/athletes.py +++ b/proselint/checks/spelling/athletes.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Misspellings. --- diff --git a/proselint/checks/spelling/em_im_en_in.py b/proselint/checks/spelling/em_im_en_in.py index 9fce729bc..680a522d0 100644 --- a/proselint/checks/spelling/em_im_en_in.py +++ b/proselint/checks/spelling/em_im_en_in.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - """Em vs. im, en vs. in.""" from proselint.tools import memoize, preferred_forms_check diff --git a/proselint/checks/spelling/er_or.py b/proselint/checks/spelling/er_or.py index dae1bd7e9..d4c84e324 100644 --- a/proselint/checks/spelling/er_or.py +++ b/proselint/checks/spelling/er_or.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - """-er vs. -or.""" from proselint.tools import memoize, preferred_forms_check diff --git a/proselint/checks/spelling/in_un.py b/proselint/checks/spelling/in_un.py index ef4e1701e..4f92f6b2e 100644 --- a/proselint/checks/spelling/in_un.py +++ b/proselint/checks/spelling/in_un.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - """in- vs. un-.""" from proselint.tools import memoize, preferred_forms_check diff --git a/proselint/checks/spelling/misc.py b/proselint/checks/spelling/misc.py index 7ddac5cd4..4dd11f116 100644 --- a/proselint/checks/spelling/misc.py +++ b/proselint/checks/spelling/misc.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Misspellings. --- diff --git a/proselint/checks/terms/animal_adjectives.py b/proselint/checks/terms/animal_adjectives.py index 50211826b..15d03ae5a 100644 --- a/proselint/checks/terms/animal_adjectives.py +++ b/proselint/checks/terms/animal_adjectives.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Animal adjectives. --- diff --git a/proselint/checks/terms/denizen_labels.py b/proselint/checks/terms/denizen_labels.py index 0f7a09696..ba166cb21 100644 --- a/proselint/checks/terms/denizen_labels.py +++ b/proselint/checks/terms/denizen_labels.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - """Denizen labels.""" from proselint.tools import memoize, preferred_forms_check @@ -74,7 +72,7 @@ def check_denizen_labels_norris(text): ["Vallisoletano", ["Valladolidian"]], ["Wulfrunian", ["Wolverhamptonian", "Wolverhamptonite"]], ["Novocastrian", ["Newcastleite", "Newcastlite"]], - ["Trifluvian", [u"Trois-Rivièrester"]], + ["Trifluvian", ["Trois-Rivièrester"]], ["Leodenisian", ["Leedsian"]], ["Minneapolitan", ["Minneapolisian"]], ["Hartlepudlian", ["Hartlepoolian"]], diff --git a/proselint/checks/terms/eponymous_adjectives.py b/proselint/checks/terms/eponymous_adjectives.py index 7126808a3..81e1dd094 100644 --- a/proselint/checks/terms/eponymous_adjectives.py +++ b/proselint/checks/terms/eponymous_adjectives.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Eponymous adjectives. --- diff --git a/proselint/checks/terms/venery.py b/proselint/checks/terms/venery.py index 5829d5ca8..f6d24cf59 100644 --- a/proselint/checks/terms/venery.py +++ b/proselint/checks/terms/venery.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Names for groups of animals. --- @@ -82,8 +81,8 @@ def check(text): list = [] for term_pair in term_list: for generic in generic_terms: - wrong = "a {} of {}".format(generic, term_pair[0]) - right = "a {} of {}".format(term_pair[1], term_pair[0]) + wrong = f"a {generic} of {term_pair[0]}" + right = f"a {term_pair[1]} of {term_pair[0]}" list += [[right, [wrong]]] return preferred_forms_check(text, list, err, msg) diff --git a/proselint/checks/typography/diacritical_marks.py b/proselint/checks/typography/diacritical_marks.py index 3a1b875bf..08a2805ee 100644 --- a/proselint/checks/typography/diacritical_marks.py +++ b/proselint/checks/typography/diacritical_marks.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Diacritical marks. Use of diacritical marks where common. @@ -10,104 +9,104 @@ def check(text): """Suggest the preferred forms.""" err = "typography.diacritical_marks" - msg = u"Use diacritical marks in '{}'." + msg = "Use diacritical marks in '{}'." list = [ # French loanwords - [u"beau idéal", ["beau ideal"]], - [u"boutonnière", ["boutonniere"]], - [u"bric-à-brac", ["bric-a-brac"]], - [u"café", ["cafe"]], - [u"cause célèbre", ["cause celebre"]], - [u"chèvre", ["chevre"]], - [u"cliché", ["cliche"]], - [u"comme ci comme ça", ["comme ci comme ca", "comsi comsa"]], - [u"consommé", ["consomme"]], - [u"coup d'état", ["coup d'etat"]], - [u"coup de grâce", ["coup de grace"]], - [u"crudités", ["crudites"]], - [u"crème brûlée", ["creme brulee"]], - [u"crème de menthe", ["creme de menthe"]], - [u"crème fraîche", ["creme fraice"]], - [u"crème fraîche", ["creme fresh"]], - [u"crêpe", ["crepe"]], - [u"débutante", ["debutante"]], - [u"décor", ["decor"]], - [u"déjà vu", ["deja vu"]], - [u"dénouement", ["denouement"]], - [u"façade", ["facade"]], - [u"fiancé", ["fiance"]], - [u"fiancée", ["fiancee"]], - [u"flambé", ["flambe"]], - [u"garçon", ["garcon"]], - [u"lycée", ["lycee"]], - [u"maître d", ["maitre d"]], - [u"ménage à trois", ["menage a trois"]], - [u"négligée", ["negligee"]], - [u"papier-mâché", ["papier-mache", "paper mache", "paper-mache"]], - [u"protégé", ["protege"]], - [u"protégée", ["protegee"]], - [u"purée", ["puree"]], - [u"raison d'être", ["raison d'etre"]], - [u"my résumé", ["my resume"]], - [u"your résumé", ["your resume"]], - [u"his résumé", ["his resume"]], - [u"her résumé", ["her resume"]], - [u"a résumé", ["a resume"]], - [u"the résumé", ["the resume"]], - [u"risqué", ["risque"]], - [u"roué", ["roue"]], - [u"soirée", ["soiree"]], - [u"soufflé", ["souffle"]], - [u"soupçon", ["soupcon"]], - [u"touché", ["touche"]], - [u"tête-à-tête", ["tete-a-tete"]], - [u"voilà", ["voila"]], - [u"à la carte", ["a la carte"]], - [u"à la mode", ["a la mode"]], - [u"émigré", ["emigre"]], + ["beau idéal", ["beau ideal"]], + ["boutonnière", ["boutonniere"]], + ["bric-à-brac", ["bric-a-brac"]], + ["café", ["cafe"]], + ["cause célèbre", ["cause celebre"]], + ["chèvre", ["chevre"]], + ["cliché", ["cliche"]], + ["comme ci comme ça", ["comme ci comme ca", "comsi comsa"]], + ["consommé", ["consomme"]], + ["coup d'état", ["coup d'etat"]], + ["coup de grâce", ["coup de grace"]], + ["crudités", ["crudites"]], + ["crème brûlée", ["creme brulee"]], + ["crème de menthe", ["creme de menthe"]], + ["crème fraîche", ["creme fraice"]], + ["crème fraîche", ["creme fresh"]], + ["crêpe", ["crepe"]], + ["débutante", ["debutante"]], + ["décor", ["decor"]], + ["déjà vu", ["deja vu"]], + ["dénouement", ["denouement"]], + ["façade", ["facade"]], + ["fiancé", ["fiance"]], + ["fiancée", ["fiancee"]], + ["flambé", ["flambe"]], + ["garçon", ["garcon"]], + ["lycée", ["lycee"]], + ["maître d", ["maitre d"]], + ["ménage à trois", ["menage a trois"]], + ["négligée", ["negligee"]], + ["papier-mâché", ["papier-mache", "paper mache", "paper-mache"]], + ["protégé", ["protege"]], + ["protégée", ["protegee"]], + ["purée", ["puree"]], + ["raison d'être", ["raison d'etre"]], + ["my résumé", ["my resume"]], + ["your résumé", ["your resume"]], + ["his résumé", ["his resume"]], + ["her résumé", ["her resume"]], + ["a résumé", ["a resume"]], + ["the résumé", ["the resume"]], + ["risqué", ["risque"]], + ["roué", ["roue"]], + ["soirée", ["soiree"]], + ["soufflé", ["souffle"]], + ["soupçon", ["soupcon"]], + ["touché", ["touche"]], + ["tête-à-tête", ["tete-a-tete"]], + ["voilà", ["voila"]], + ["à la carte", ["a la carte"]], + ["à la mode", ["a la mode"]], + ["émigré", ["emigre"]], # Spanish loanwords - [u"El Niño", ["El Nino"]], - [u"jalapeño", ["jalapeno"]], - [u"La Niña", ["La Nina"]], - [u"piña colada", ["pina colada"]], - [u"señor", ["senor"]], - [u"señora", ["senora"]], - [u"señorita", ["senorita"]], + ["El Niño", ["El Nino"]], + ["jalapeño", ["jalapeno"]], + ["La Niña", ["La Nina"]], + ["piña colada", ["pina colada"]], + ["señor", ["senor"]], + ["señora", ["senora"]], + ["señorita", ["senorita"]], # Portuguese loanwords - [u"açaí", ["acai"]], + ["açaí", ["acai"]], # German loanwords - [u"doppelgänger", ["doppelganger"]], - [u"Führer", ["Fuhrer"]], - [u"Gewürztraminer", ["Gewurztraminer"]], - [u"vis-à-vis", ["vis-a-vis"]], - [u"Übermensch", ["Ubermensch"]], + ["doppelgänger", ["doppelganger"]], + ["Führer", ["Fuhrer"]], + ["Gewürztraminer", ["Gewurztraminer"]], + ["vis-à-vis", ["vis-a-vis"]], + ["Übermensch", ["Ubermensch"]], # Swedish loanwords - [u"filmjölk", ["filmjolk"]], - [u"smörgåsbord", ["smorgasbord"]], + ["filmjölk", ["filmjolk"]], + ["smörgåsbord", ["smorgasbord"]], # Names, places, and companies - [u"Beyoncé", ["Beyonce"]], - [u"Brontë", ["Bronte"]], - [u"Brontë", ["Bronte"]], - [u"Champs-Élysées", ["Champs-Elysees"]], - [u"Citroën", ["Citroen"]], - [u"Curaçao", ["Curacao"]], - [u"Häagen-Dazs", ["Haagen-Dazs", "Haagen Dazs"]], - [u"Löwenbräu", ["Lowenbrau"]], - [u"Monégasque", ["Monegasque"]], - [u"Mötley Crüe", ["Motley Crue"]], - [u"Nescafé", ["Nescafe"]], - [u"Queensrÿche", ["Queensryche"]], - [u"Québec", ["Quebec"]], - [u"Québécois", ["Quebecois"]], - [u"Ångström", ["Angstrom"]], - [u"ångström", ["angstrom"]], - [u"Škoda", ["Skoda"]], + ["Beyoncé", ["Beyonce"]], + ["Brontë", ["Bronte"]], + ["Brontë", ["Bronte"]], + ["Champs-Élysées", ["Champs-Elysees"]], + ["Citroën", ["Citroen"]], + ["Curaçao", ["Curacao"]], + ["Häagen-Dazs", ["Haagen-Dazs", "Haagen Dazs"]], + ["Löwenbräu", ["Lowenbrau"]], + ["Monégasque", ["Monegasque"]], + ["Mötley Crüe", ["Motley Crue"]], + ["Nescafé", ["Nescafe"]], + ["Queensrÿche", ["Queensryche"]], + ["Québec", ["Quebec"]], + ["Québécois", ["Quebecois"]], + ["Ångström", ["Angstrom"]], + ["ångström", ["angstrom"]], + ["Škoda", ["Skoda"]], ] return preferred_forms_check(text, list, err, msg) diff --git a/proselint/checks/typography/exclamation.py b/proselint/checks/typography/exclamation.py index d23396855..dc0948802 100644 --- a/proselint/checks/typography/exclamation.py +++ b/proselint/checks/typography/exclamation.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Too much yelling. --- @@ -22,7 +21,7 @@ def check_repeated_exclamations(text): """Check the text.""" err = "leonard.exclamation.multiple" - msg = u"Stop yelling. Keep your exclamation points under control." + msg = "Stop yelling. Keep your exclamation points under control." regex = r"[\!]\s*?[\!]{1,}" @@ -35,7 +34,7 @@ def check_repeated_exclamations(text): def check_exclamations_ppm(text): """Make sure that the exclamation ppm is under 30.""" err = "leonard.exclamation.30ppm" - msg = u"More than 30 ppm of exclamations. Keep them under control." + msg = "More than 30 ppm of exclamations. Keep them under control." regex = r"\w!" diff --git a/proselint/checks/typography/symbols.py b/proselint/checks/typography/symbols.py index 14c13b244..f2c7bbbbd 100644 --- a/proselint/checks/typography/symbols.py +++ b/proselint/checks/typography/symbols.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Use the right symbols. source: Butterick's Practical Typography @@ -12,7 +11,7 @@ def check_ellipsis(text): """Use an ellipsis instead of three dots.""" err = "typography.symbols.ellipsis" - msg = u"'...' is an approximation, use the ellipsis symbol '…'." + msg = "'...' is an approximation, use the ellipsis symbol '…'." regex = r"\.\.\." return existence_check(text, [regex], err, msg, max_errors=3, @@ -23,7 +22,7 @@ def check_ellipsis(text): def check_copyright_symbol(text): """Use the copyright symbol instead of (c).""" err = "typography.symbols.copyright" - msg = u"(c) is a goofy alphabetic approximation, use the symbol ©." + msg = "(c) is a goofy alphabetic approximation, use the symbol ©." regex = r"\([cC]\)" return existence_check( @@ -34,7 +33,7 @@ def check_copyright_symbol(text): def check_trademark_symbol(text): """Use the trademark symbol instead of (TM).""" err = "typography.symbols.trademark" - msg = u"(TM) is a goofy alphabetic approximation, use the symbol ™." + msg = "(TM) is a goofy alphabetic approximation, use the symbol ™." regex = r"\(TM\)" return existence_check( @@ -45,7 +44,7 @@ def check_trademark_symbol(text): def check_registered_trademark_symbol(text): """Use the registered trademark symbol instead of (R).""" err = "typography.symbols.trademark" - msg = u"(R) is a goofy alphabetic approximation, use the symbol ®." + msg = "(R) is a goofy alphabetic approximation, use the symbol ®." regex = r"\([rR]\)" return existence_check( @@ -56,7 +55,7 @@ def check_registered_trademark_symbol(text): def check_sentence_spacing(text): """Use no more than two spaces after a period.""" err = "typography.symbols.sentence_spacing" - msg = u"More than two spaces after the period; use 1 or 2." + msg = "More than two spaces after the period; use 1 or 2." regex = r"\. {3}" return existence_check( @@ -65,9 +64,9 @@ def check_sentence_spacing(text): @memoize def check_multiplication_symbol(text): - u"""Use the multiplication symbol ×, not the lowercase letter x.""" + """Use the multiplication symbol ×, not the lowercase letter x.""" err = "typography.symbols.multiplication_symbol" - msg = u"Use the multiplication symbol ×, not the letter x." + msg = "Use the multiplication symbol ×, not the letter x." regex = r"[0-9]+ ?x ?[0-9]+" return existence_check( @@ -76,9 +75,9 @@ def check_multiplication_symbol(text): @memoize def check_curly_quotes(text): - u"""Use curly quotes, not straight quotes.""" + """Use curly quotes, not straight quotes.""" err = "typography.symbols.curly_quotes" - msg = u'Use curly quotes “”, not straight quotes "".' + msg = 'Use curly quotes “”, not straight quotes "".' regex = r"\"[\w\s\d]+\"" return existence_check( diff --git a/proselint/checks/uncomparables/misc.py b/proselint/checks/uncomparables/misc.py index 3cd7e12e5..e85039f60 100644 --- a/proselint/checks/uncomparables/misc.py +++ b/proselint/checks/uncomparables/misc.py @@ -1,5 +1,4 @@ -# -*- coding: utf-8 -*- -u"""Comparing uncomparables. +"""Comparing uncomparables. --- layout: post diff --git a/proselint/checks/weasel_words/very.py b/proselint/checks/weasel_words/very.py index 8145dccdd..a9418ebdd 100644 --- a/proselint/checks/weasel_words/very.py +++ b/proselint/checks/weasel_words/very.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Very. --- diff --git a/proselint/command_line.py b/proselint/command_line.py index 81e6efc98..e4ff598f0 100644 --- a/proselint/command_line.py +++ b/proselint/command_line.py @@ -1,14 +1,10 @@ -# -*- coding: utf-8 -*- - """Command line utility for proselint.""" -from __future__ import absolute_import, print_function import os import shutil import subprocess import sys import traceback -from builtins import str import click diff --git a/proselint/score.py b/proselint/score.py index 3b2d0ee90..551d7bc74 100644 --- a/proselint/score.py +++ b/proselint/score.py @@ -1,13 +1,9 @@ -# -*- coding: utf-8 -*- - """Compute the lintscore on the corpus.""" -from __future__ import print_function import os import re import subprocess -from builtins import input, int proselint_path = os.path.dirname(os.path.realpath(__file__)) @@ -41,13 +37,13 @@ def score(check=None): fullpath = os.path.join(root, f) # Run the linter. - print("Linting {}".format(f)) + print(f"Linting {f}") out = subprocess.check_output(["proselint", fullpath]) # Determine the number of errors. regex = r".+?:(?P\d+):(?P\d+): (?P.+)" num_errors = len(tuple(re.finditer(regex, out))) - print("Found {} errors.".format(num_errors)) + print(f"Found {num_errors} errors.") # Open the document. subprocess.call(["open", fullpath]) @@ -66,7 +62,7 @@ def score(check=None): except ValueError: pass - print("Currently {} hits and {} false alarms\n---".format(tp, fp)) + print(f"Currently {tp} hits and {fp} false alarms\n---") if (tp + fp) > 0: return tp * (1.0 * tp / (tp + fp)) ** 2 diff --git a/proselint/tools.py b/proselint/tools.py index f49a09dea..f4ee7ad72 100644 --- a/proselint/tools.py +++ b/proselint/tools.py @@ -1,8 +1,5 @@ -# -*- coding: utf-8 -*- - """General-purpose tools shared across linting checks.""" -from __future__ import print_function, unicode_literals import copy import dbm @@ -269,7 +266,7 @@ def lint(input_file, debug=False, config_file_path=None): def assert_error(text, check, n=1): """Assert that text has n errors of type check.""" - assert_error.description = "No {} error for '{}'".format(check, text) + assert_error.description = f"No {check} error for '{text}'" assert(check in [error[0] for error in lint(text)]) @@ -387,7 +384,7 @@ def truncate_to_max(errors, max_errors): if len(errors) == (max_errors + 1): msg1 += " Found once elsewhere." else: - msg1 += " Found {} times elsewhere.".format(len(errors)) + msg1 += f" Found {len(errors)} times elsewhere." errors = errors[1:max_errors] errors = [(start1, end1, err1, msg1, replacements)] + errors