From 97f28e8062691ddd29903c548b485d85c432e033 Mon Sep 17 00:00:00 2001 From: Nytelife26 Date: Wed, 17 Jul 2024 05:14:43 +0100 Subject: [PATCH] refactor: register_with -> static __register__ export --- proselint/checks/__init__.py | 2 +- proselint/checks/airlinese/__init__.py | 4 +- proselint/checks/airlinese/misc.py | 7 +- proselint/checks/annotations/__init__.py | 4 +- proselint/checks/annotations/misc.py | 7 +- proselint/checks/archaism/__init__.py | 4 +- proselint/checks/archaism/misc.py | 7 +- proselint/checks/cliches/__init__.py | 11 +- proselint/checks/cliches/hell.py | 9 +- proselint/checks/cliches/misc.py | 25 ++-- proselint/checks/consistency/__init__.py | 11 +- proselint/checks/consistency/spacing.py | 7 +- proselint/checks/consistency/spelling.py | 7 +- proselint/checks/corporate_speak/__init__.py | 4 +- proselint/checks/corporate_speak/misc.py | 7 +- proselint/checks/cursing/__init__.py | 18 ++- proselint/checks/cursing/filth.py | 7 +- proselint/checks/cursing/nfl.py | 19 ++- proselint/checks/cursing/nword.py | 7 +- proselint/checks/dates_times/__init__.py | 14 +- proselint/checks/dates_times/am_pm.py | 17 +-- proselint/checks/dates_times/dates.py | 19 ++- proselint/checks/hedging/__init__.py | 4 +- proselint/checks/hedging/misc.py | 7 +- proselint/checks/hyperbole/__init__.py | 4 +- proselint/checks/hyperbole/misc.py | 7 +- proselint/checks/jargon/__init__.py | 4 +- proselint/checks/jargon/misc.py | 7 +- .../checks/lexical_illusions/__init__.py | 4 +- proselint/checks/lexical_illusions/misc.py | 7 +- proselint/checks/lgbtq/__init__.py | 14 +- proselint/checks/lgbtq/offensive_terms.py | 7 +- proselint/checks/lgbtq/terms.py | 7 +- proselint/checks/links/__init__.py | 4 +- proselint/checks/links/broken.py | 7 +- proselint/checks/malapropisms/__init__.py | 4 +- proselint/checks/malapropisms/misc.py | 7 +- proselint/checks/misc/__init__.py | 134 +++++++++--------- proselint/checks/misc/apologizing.py | 7 +- proselint/checks/misc/back_formations.py | 7 +- proselint/checks/misc/braces.py | 7 +- proselint/checks/misc/bureaucratese.py | 7 +- proselint/checks/misc/but.py | 7 +- proselint/checks/misc/capitalization.py | 20 ++- proselint/checks/misc/chatspeak.py | 7 +- proselint/checks/misc/commercialese.py | 11 +- proselint/checks/misc/composition.py | 11 +- proselint/checks/misc/currency.py | 7 +- proselint/checks/misc/debased.py | 7 +- proselint/checks/misc/greylist.py | 6 +- proselint/checks/misc/illogic.py | 14 +- proselint/checks/misc/inferior_superior.py | 7 +- proselint/checks/misc/institution_name.py | 7 +- proselint/checks/misc/latin.py | 7 +- proselint/checks/misc/many_a.py | 7 +- proselint/checks/misc/metadiscourse.py | 7 +- proselint/checks/misc/monotonic.py | 2 + proselint/checks/misc/narcissism.py | 7 +- proselint/checks/misc/not_guilty.py | 7 +- proselint/checks/misc/numbers.py | 15 +- proselint/checks/misc/phrasal_adjectives.py | 14 +- proselint/checks/misc/plurals.py | 12 +- proselint/checks/misc/preferred_forms.py | 7 +- proselint/checks/misc/pretension.py | 6 +- proselint/checks/misc/professions.py | 7 +- proselint/checks/misc/scare_quotes.py | 7 +- proselint/checks/misc/suddenly.py | 6 +- proselint/checks/misc/tense_present.py | 13 +- proselint/checks/misc/waxed.py | 6 +- proselint/checks/misc/whence.py | 7 +- proselint/checks/mixed_metaphors/__init__.py | 4 +- proselint/checks/mixed_metaphors/misc.py | 14 +- proselint/checks/mondegreens/__init__.py | 4 +- proselint/checks/mondegreens/misc.py | 7 +- .../checks/needless_variants/__init__.py | 4 +- proselint/checks/needless_variants/misc.py | 13 +- proselint/checks/nonwords/__init__.py | 4 +- proselint/checks/nonwords/misc.py | 7 +- proselint/checks/oxymorons/__init__.py | 4 +- proselint/checks/oxymorons/misc.py | 7 +- proselint/checks/psychology/__init__.py | 4 +- proselint/checks/psychology/misc.py | 14 +- proselint/checks/punctuation/__init__.py | 14 +- proselint/checks/punctuation/misc.py | 14 +- proselint/checks/punctuation/spacing.py | 17 +-- proselint/checks/redundancy/__init__.py | 14 +- proselint/checks/redundancy/misc.py | 24 ++-- proselint/checks/redundancy/ras_syndrome.py | 7 +- proselint/checks/restricted/__init__.py | 14 +- proselint/checks/restricted/elementary.py | 7 +- proselint/checks/restricted/top1000.py | 7 +- proselint/checks/scientific/__init__.py | 4 +- proselint/checks/scientific/misc.py | 28 ++-- proselint/checks/security/__init__.py | 14 +- proselint/checks/security/credit_card.py | 7 +- proselint/checks/security/password.py | 7 +- proselint/checks/sexism/__init__.py | 4 +- proselint/checks/sexism/misc.py | 13 +- proselint/checks/skunked_terms/__init__.py | 4 +- proselint/checks/skunked_terms/misc.py | 7 +- proselint/checks/spelling/__init__.py | 50 ++++--- proselint/checks/spelling/able_atable.py | 7 +- proselint/checks/spelling/able_ible.py | 7 +- proselint/checks/spelling/ally_ly.py | 7 +- proselint/checks/spelling/ance_ence.py | 7 +- proselint/checks/spelling/athletes.py | 12 +- proselint/checks/spelling/ely_ly.py | 7 +- proselint/checks/spelling/em_im_en_in.py | 7 +- proselint/checks/spelling/er_or.py | 7 +- proselint/checks/spelling/in_un.py | 7 +- proselint/checks/spelling/misc.py | 9 +- proselint/checks/spelling/ve_of.py | 7 +- proselint/checks/terms/__init__.py | 22 ++- proselint/checks/terms/animal_adjectives.py | 7 +- proselint/checks/terms/denizen_labels.py | 13 +- .../checks/terms/eponymous_adjectives.py | 7 +- proselint/checks/terms/venery.py | 6 +- proselint/checks/typography/__init__.py | 18 ++- .../checks/typography/diacritical_marks.py | 7 +- proselint/checks/typography/exclamation.py | 12 +- proselint/checks/typography/symbols.py | 24 ++-- proselint/checks/uncomparables/__init__.py | 4 +- proselint/checks/uncomparables/misc.py | 13 +- proselint/checks/weasel_words/__init__.py | 14 +- proselint/checks/weasel_words/misc.py | 7 +- proselint/checks/weasel_words/very.py | 6 +- 126 files changed, 492 insertions(+), 808 deletions(-) diff --git a/proselint/checks/__init__.py b/proselint/checks/__init__.py index 357832d89..483220f40 100644 --- a/proselint/checks/__init__.py +++ b/proselint/checks/__init__.py @@ -263,7 +263,7 @@ def discover(self) -> None: continue try: module = importlib.import_module(info.name, "proselint.checks") - module.register_with(self) + self.register_many(module.__register__) log.debug( "Registered from module %s at %.3fms", module.__name__, diff --git a/proselint/checks/airlinese/__init__.py b/proselint/checks/airlinese/__init__.py index da9d54c91..d4375109c 100644 --- a/proselint/checks/airlinese/__init__.py +++ b/proselint/checks/airlinese/__init__.py @@ -1,5 +1,5 @@ """Airlinese.""" -from proselint.checks.airlinese.misc import register_with +from proselint.checks.airlinese.misc import __register__ -__all__ = ["register_with"] +__all__ = ["__register__"] diff --git a/proselint/checks/airlinese/misc.py b/proselint/checks/airlinese/misc.py index ea7edf3da..0346a9dbb 100644 --- a/proselint/checks/airlinese/misc.py +++ b/proselint/checks/airlinese/misc.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, Existence +from proselint.checks import CheckSpec, Existence examples_pass = [ "Smoke phrase with nothing flagged.", @@ -37,7 +37,4 @@ "'{}' is airlinese.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/annotations/__init__.py b/proselint/checks/annotations/__init__.py index 776bd1a51..f5ce765f3 100644 --- a/proselint/checks/annotations/__init__.py +++ b/proselint/checks/annotations/__init__.py @@ -1,5 +1,5 @@ """Annotations.""" -from proselint.checks.annotations.misc import register_with +from proselint.checks.annotations.misc import __register__ -__all__ = ["register_with"] +__all__ = ["__register__"] diff --git a/proselint/checks/annotations/misc.py b/proselint/checks/annotations/misc.py index a116df9aa..ba16c2ace 100644 --- a/proselint/checks/annotations/misc.py +++ b/proselint/checks/annotations/misc.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, Existence +from proselint.checks import CheckSpec, Existence examples_pass = [ "Smoke phrase with nothing flagged.", @@ -38,7 +38,4 @@ "Annotation left in text.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/archaism/__init__.py b/proselint/checks/archaism/__init__.py index d1110700f..4872d9a66 100644 --- a/proselint/checks/archaism/__init__.py +++ b/proselint/checks/archaism/__init__.py @@ -1,5 +1,5 @@ """Archaism.""" -from proselint.checks.archaism.misc import register_with +from proselint.checks.archaism.misc import __register__ -__all__ = ["register_with"] +__all__ = ["__register__"] diff --git a/proselint/checks/archaism/misc.py b/proselint/checks/archaism/misc.py index 432c2762e..0d49a5bba 100644 --- a/proselint/checks/archaism/misc.py +++ b/proselint/checks/archaism/misc.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, Existence +from proselint.checks import CheckSpec, Existence examples_pass = [ "Smoke phrase with nothing flagged.", @@ -86,7 +86,4 @@ "'{}' is archaic.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/cliches/__init__.py b/proselint/checks/cliches/__init__.py index 96c8d1780..6ea6c83b5 100644 --- a/proselint/checks/cliches/__init__.py +++ b/proselint/checks/cliches/__init__.py @@ -1,11 +1,6 @@ """Avoid cliches.""" -from proselint.checks import CheckRegistry -from proselint.checks.cliches.hell import register_with as register_hell -from proselint.checks.cliches.misc import register_with as register_misc +from proselint.checks.cliches.hell import __register__ as register_hell +from proselint.checks.cliches.misc import __register__ as register_misc - -def register_with(registry: CheckRegistry) -> None: - """Register the checks.""" - register_hell(registry) - register_misc(registry) +__register__ = (*register_hell, *register_misc) diff --git a/proselint/checks/cliches/hell.py b/proselint/checks/cliches/hell.py index 3efffc1c2..9bf21e8fd 100644 --- a/proselint/checks/cliches/hell.py +++ b/proselint/checks/cliches/hell.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckFlags, CheckRegistry, CheckSpec, Existence +from proselint.checks import CheckFlags, CheckSpec, Existence examples_pass = [ "Smoke phrase with nothing flagged.", @@ -30,10 +30,7 @@ Existence(["all hell broke loose"]), "cliches.hell", "Never use the words 'all hell broke loose'.", - flags=CheckFlags(limit_results=3) + flags=CheckFlags(limit_results=3), ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/cliches/misc.py b/proselint/checks/cliches/misc.py index 31684665f..bc89414a1 100644 --- a/proselint/checks/cliches/misc.py +++ b/proselint/checks/cliches/misc.py @@ -2,7 +2,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, Existence +from proselint.checks import CheckSpec, Existence examples_pass = [ "Smoke phrase with nothing flagged.", @@ -1073,16 +1073,13 @@ msg, ) - -def register_with(registry: CheckRegistry) -> None: - """Register the checks.""" - registry.register_many(( - check_cliches_garner, - check_cliches_write_good_a_to_c, - check_cliches_write_good_d_to_j, - check_cliches_write_good_k_to_o, - check_cliches_write_good_p_to_s, - check_cliches_write_good_t_to_z, - check_cliches_gnu_diction, - check_cliches_nigel, - )) +__register__ = ( + check_cliches_garner, + check_cliches_write_good_a_to_c, + check_cliches_write_good_d_to_j, + check_cliches_write_good_k_to_o, + check_cliches_write_good_p_to_s, + check_cliches_write_good_t_to_z, + check_cliches_gnu_diction, + check_cliches_nigel, +) diff --git a/proselint/checks/consistency/__init__.py b/proselint/checks/consistency/__init__.py index 97d3f296b..53206d38f 100644 --- a/proselint/checks/consistency/__init__.py +++ b/proselint/checks/consistency/__init__.py @@ -1,15 +1,10 @@ """Various consistency checks.""" -from proselint.checks import CheckRegistry from proselint.checks.consistency.spacing import ( - register_with as register_spacing, + __register__ as register_spacing, ) from proselint.checks.consistency.spelling import ( - register_with as register_spelling, + __register__ as register_spelling, ) - -def register_with(registry: CheckRegistry) -> None: - """Register the checks.""" - register_spacing(registry) - register_spelling(registry) +__register__ = (*register_spacing, *register_spelling) diff --git a/proselint/checks/consistency/spacing.py b/proselint/checks/consistency/spacing.py index dbbe5e75c..93a4784fc 100644 --- a/proselint/checks/consistency/spacing.py +++ b/proselint/checks/consistency/spacing.py @@ -17,7 +17,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, Consistency +from proselint.checks import CheckSpec, Consistency examples_pass = [ "Smoke phrase with nothing flagged.", @@ -33,7 +33,4 @@ ignore_case=False, ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/consistency/spelling.py b/proselint/checks/consistency/spelling.py index 1ae72b013..2cc006682 100644 --- a/proselint/checks/consistency/spelling.py +++ b/proselint/checks/consistency/spelling.py @@ -23,7 +23,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, Consistency +from proselint.checks import CheckSpec, Consistency examples_pass = [ "Smoke phrase with nothing flagged.", @@ -56,7 +56,4 @@ "Inconsistent spelling of '{}' (vs. '{}').", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/corporate_speak/__init__.py b/proselint/checks/corporate_speak/__init__.py index 6d1cc5e32..6c5d912ff 100644 --- a/proselint/checks/corporate_speak/__init__.py +++ b/proselint/checks/corporate_speak/__init__.py @@ -1,5 +1,5 @@ """Corporate-speak.""" -from proselint.checks.corporate_speak.misc import register_with +from proselint.checks.corporate_speak.misc import __register__ -__all__ = ["register_with"] +__all__ = ["__register__"] diff --git a/proselint/checks/corporate_speak/misc.py b/proselint/checks/corporate_speak/misc.py index f9c4a3bbc..b1e074e46 100644 --- a/proselint/checks/corporate_speak/misc.py +++ b/proselint/checks/corporate_speak/misc.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, Existence +from proselint.checks import CheckSpec, Existence examples_pass = [ "Smoke phrase with nothing flagged.", @@ -59,7 +59,4 @@ "Minimize your use of corporate catchphrases like this one.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/cursing/__init__.py b/proselint/checks/cursing/__init__.py index e3a12dfc4..006d9cfaf 100644 --- a/proselint/checks/cursing/__init__.py +++ b/proselint/checks/cursing/__init__.py @@ -1,13 +1,11 @@ """Cursing.""" -from proselint.checks import CheckRegistry -from proselint.checks.cursing.filth import register_with as register_filth -from proselint.checks.cursing.nfl import register_with as register_nfl -from proselint.checks.cursing.nword import register_with as register_nword +from proselint.checks.cursing.filth import __register__ as register_filth +from proselint.checks.cursing.nfl import __register__ as register_nfl +from proselint.checks.cursing.nword import __register__ as register_nword - -def register_with(registry: CheckRegistry) -> None: - """Register the checks.""" - register_filth(registry) - register_nfl(registry) - register_nword(registry) +__register__ = ( + *register_filth, + *register_nfl, + *register_nword, +) diff --git a/proselint/checks/cursing/filth.py b/proselint/checks/cursing/filth.py index d48c1b5dc..4b77a02a9 100644 --- a/proselint/checks/cursing/filth.py +++ b/proselint/checks/cursing/filth.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, Existence +from proselint.checks import CheckSpec, Existence examples_pass = [ "Smoke phrase with nothing flagged.", @@ -44,7 +44,4 @@ ), ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/cursing/nfl.py b/proselint/checks/cursing/nfl.py index c817c694e..496a0e9d9 100644 --- a/proselint/checks/cursing/nfl.py +++ b/proselint/checks/cursing/nfl.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, Existence, Pd +from proselint.checks import CheckSpec, Existence, Pd examples_pass = [ "Smoke phrase with nothing flagged.", @@ -1228,13 +1228,10 @@ msg, ) - -def register_with(registry: CheckRegistry) -> None: - """Register the checks.""" - registry.register_many(( - check_a_to_e, - check_f_to_h, - check_i_to_p, - check_q_to_z, - check_abb, - )) +__register__ = ( + check_a_to_e, + check_f_to_h, + check_i_to_p, + check_q_to_z, + check_abb, +) diff --git a/proselint/checks/cursing/nword.py b/proselint/checks/cursing/nword.py index 2a6c7d475..3a9606953 100644 --- a/proselint/checks/cursing/nword.py +++ b/proselint/checks/cursing/nword.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, Existence +from proselint.checks import CheckSpec, Existence examples_pass = [ "Smoke phrase with nothing flagged.", @@ -32,7 +32,4 @@ "Take responsibility for the shitty words you want to say.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/dates_times/__init__.py b/proselint/checks/dates_times/__init__.py index 3f6ec7cf5..e96fc9928 100644 --- a/proselint/checks/dates_times/__init__.py +++ b/proselint/checks/dates_times/__init__.py @@ -1,11 +1,9 @@ """Dates and times.""" -from proselint.checks import CheckRegistry -from proselint.checks.dates_times.am_pm import register_with as register_am_pm -from proselint.checks.dates_times.am_pm import register_with as register_dates +from proselint.checks.dates_times.am_pm import __register__ as register_am_pm +from proselint.checks.dates_times.am_pm import __register__ as register_dates - -def register_with(registry: CheckRegistry) -> None: - """Register the checks.""" - register_am_pm(registry) - register_dates(registry) +__register__ = ( + *register_am_pm, + *register_dates, +) diff --git a/proselint/checks/dates_times/am_pm.py b/proselint/checks/dates_times/am_pm.py index 4ffc9ea82..72c35cd53 100644 --- a/proselint/checks/dates_times/am_pm.py +++ b/proselint/checks/dates_times/am_pm.py @@ -14,7 +14,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, Existence, Pd +from proselint.checks import CheckSpec, Existence, Pd examples_pass = [ "Smoke phrase with nothing flagged.", @@ -72,12 +72,9 @@ "'a.m.' is always morning; 'p.m.' is always night.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the checks.""" - registry.register_many(( - check_lowercase_periods, - check_spacing, - check_midnight_noon, - check_redundancy, - )) +__register__ = ( + check_lowercase_periods, + check_spacing, + check_midnight_noon, + check_redundancy, +) diff --git a/proselint/checks/dates_times/dates.py b/proselint/checks/dates_times/dates.py index f02b1b4a5..2c92f48d2 100644 --- a/proselint/checks/dates_times/dates.py +++ b/proselint/checks/dates_times/dates.py @@ -18,7 +18,7 @@ import calendar -from proselint.checks import CheckRegistry, CheckSpec, Existence, Pd +from proselint.checks import CheckSpec, Existence, Pd examples_pass = [ "Smoke phrase with nothing flagged.", @@ -79,13 +79,10 @@ "When specifying a month and year, 'of' is unnecessary.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the checks.""" - registry.register_many(( - check_decade_apostrophes_short, - check_decade_apostrophes_long, - check_dash_and_from, - check_month_year_comma, - check_month_of_year, - )) +__register__ = ( + check_decade_apostrophes_short, + check_decade_apostrophes_long, + check_dash_and_from, + check_month_year_comma, + check_month_of_year, +) diff --git a/proselint/checks/hedging/__init__.py b/proselint/checks/hedging/__init__.py index b80b42dfc..16c1952b0 100644 --- a/proselint/checks/hedging/__init__.py +++ b/proselint/checks/hedging/__init__.py @@ -1,5 +1,5 @@ """Hedging.""" -from proselint.checks.hedging.misc import register_with +from proselint.checks.hedging.misc import __register__ -__all__ = ["register_with"] +__all__ = ["__register__"] diff --git a/proselint/checks/hedging/misc.py b/proselint/checks/hedging/misc.py index db9e43979..6db225049 100644 --- a/proselint/checks/hedging/misc.py +++ b/proselint/checks/hedging/misc.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, Existence +from proselint.checks import CheckSpec, Existence examples_pass = [ "Smoke phrase with nothing flagged.", @@ -37,7 +37,4 @@ "Hedging. Just say it.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/hyperbole/__init__.py b/proselint/checks/hyperbole/__init__.py index a82f93e5f..b61f79273 100644 --- a/proselint/checks/hyperbole/__init__.py +++ b/proselint/checks/hyperbole/__init__.py @@ -1,5 +1,5 @@ """Hyperbole.""" -from proselint.checks.hyperbole.misc import register_with +from proselint.checks.hyperbole.misc import __register__ -__all__ = ["register_with"] +__all__ = ["__register__"] diff --git a/proselint/checks/hyperbole/misc.py b/proselint/checks/hyperbole/misc.py index f11a995e5..8cdbccb7d 100644 --- a/proselint/checks/hyperbole/misc.py +++ b/proselint/checks/hyperbole/misc.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, Existence, Pd +from proselint.checks import CheckSpec, Existence, Pd examples_pass = [ "Smoke phrase with nothing flagged.", @@ -36,7 +36,4 @@ "'{}' is hyperbolic.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/jargon/__init__.py b/proselint/checks/jargon/__init__.py index 7a11518ae..d75e8d6d2 100644 --- a/proselint/checks/jargon/__init__.py +++ b/proselint/checks/jargon/__init__.py @@ -1,5 +1,5 @@ """Jargon.""" -from proselint.checks.jargon.misc import register_with +from proselint.checks.jargon.misc import __register__ -__all__ = ["register_with"] +__all__ = ["__register__"] diff --git a/proselint/checks/jargon/misc.py b/proselint/checks/jargon/misc.py index 78a93727b..047651136 100644 --- a/proselint/checks/jargon/misc.py +++ b/proselint/checks/jargon/misc.py @@ -15,7 +15,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, Existence +from proselint.checks import CheckSpec, Existence examples_pass = [ "Smoke phrase with nothing flagged.", @@ -38,7 +38,4 @@ "'{}' is jargon. Can you replace it with something more standard?", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/lexical_illusions/__init__.py b/proselint/checks/lexical_illusions/__init__.py index 39b23784f..760f51499 100644 --- a/proselint/checks/lexical_illusions/__init__.py +++ b/proselint/checks/lexical_illusions/__init__.py @@ -1,5 +1,5 @@ """Lexical illusions.""" -from proselint.checks.lexical_illusions.misc import register_with +from proselint.checks.lexical_illusions.misc import __register__ -__all__ = ["register_with"] +__all__ = ["__register__"] diff --git a/proselint/checks/lexical_illusions/misc.py b/proselint/checks/lexical_illusions/misc.py index 4fe910087..88ffa5275 100644 --- a/proselint/checks/lexical_illusions/misc.py +++ b/proselint/checks/lexical_illusions/misc.py @@ -17,7 +17,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, ExistenceSimple +from proselint.checks import CheckSpec, ExistenceSimple examples_pass = [ "Smoke phrase with nothing flagged.", @@ -53,7 +53,4 @@ "There's a lexical illusion in '{}' - one or more words are repeated.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check_repetitions) +__register__ = (check_repetitions,) diff --git a/proselint/checks/lgbtq/__init__.py b/proselint/checks/lgbtq/__init__.py index a8d1be20b..c387f0724 100644 --- a/proselint/checks/lgbtq/__init__.py +++ b/proselint/checks/lgbtq/__init__.py @@ -1,13 +1,11 @@ """GLAAD.""" -from proselint.checks import CheckRegistry from proselint.checks.lgbtq.offensive_terms import ( - register_with as register_offensive_terms, + __register__ as register_offensive_terms, ) -from proselint.checks.lgbtq.terms import register_with as register_terms +from proselint.checks.lgbtq.terms import __register__ as register_terms - -def register_with(registry: CheckRegistry) -> None: - """Register the checks.""" - register_offensive_terms(registry) - register_terms(registry) +__register__ = ( + *register_offensive_terms, + *register_terms, +) diff --git a/proselint/checks/lgbtq/offensive_terms.py b/proselint/checks/lgbtq/offensive_terms.py index a854ed9eb..370347e4b 100644 --- a/proselint/checks/lgbtq/offensive_terms.py +++ b/proselint/checks/lgbtq/offensive_terms.py @@ -18,7 +18,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, Existence +from proselint.checks import CheckSpec, Existence examples_pass = [ "Smoke phrase with nothing flagged.", @@ -50,7 +50,4 @@ ignore_case=False, ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/lgbtq/terms.py b/proselint/checks/lgbtq/terms.py index 0c42e3e8d..5d9fbf026 100644 --- a/proselint/checks/lgbtq/terms.py +++ b/proselint/checks/lgbtq/terms.py @@ -18,7 +18,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, PreferredFormsSimple +from proselint.checks import CheckSpec, PreferredFormsSimple examples_pass = [ "Smoke phrase with nothing flagged.", @@ -51,7 +51,4 @@ ignore_case=False, ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/links/__init__.py b/proselint/checks/links/__init__.py index 53db29dc3..21a4eaedf 100644 --- a/proselint/checks/links/__init__.py +++ b/proselint/checks/links/__init__.py @@ -1,5 +1,5 @@ """Broken links.""" -from proselint.checks.links.broken import register_with +from proselint.checks.links.broken import __register__ -__all__ = ["register_with"] +__all__ = ["__register__"] diff --git a/proselint/checks/links/broken.py b/proselint/checks/links/broken.py index f246da1ad..13c123f01 100644 --- a/proselint/checks/links/broken.py +++ b/proselint/checks/links/broken.py @@ -21,7 +21,7 @@ from urllib.error import URLError from urllib.request import Request, urlopen -from proselint.checks import CheckRegistry, CheckResult, CheckSpec +from proselint.checks import CheckResult, CheckSpec examples_pass = [ "Smoke phrase with nothing flagged.", @@ -92,7 +92,4 @@ def is_broken_link(url: str) -> bool: "Broken link: {}", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/malapropisms/__init__.py b/proselint/checks/malapropisms/__init__.py index 1be75137a..d3675288e 100644 --- a/proselint/checks/malapropisms/__init__.py +++ b/proselint/checks/malapropisms/__init__.py @@ -1,5 +1,5 @@ """Malaproprisms.""" -from proselint.checks.malapropisms.misc import register_with +from proselint.checks.malapropisms.misc import __register__ -__all__ = ["register_with"] +__all__ = ["__register__"] diff --git a/proselint/checks/malapropisms/misc.py b/proselint/checks/malapropisms/misc.py index 42bae9f22..5ebaef0cf 100644 --- a/proselint/checks/malapropisms/misc.py +++ b/proselint/checks/malapropisms/misc.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, Existence +from proselint.checks import CheckSpec, Existence examples_pass = [ "Smoke phrase with nothing flagged.", @@ -36,7 +36,4 @@ "'{}' is a malapropism.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/misc/__init__.py b/proselint/checks/misc/__init__.py index fdcdca1bb..16799cf3f 100644 --- a/proselint/checks/misc/__init__.py +++ b/proselint/checks/misc/__init__.py @@ -1,106 +1,104 @@ """Miscellaneous advice not otherwise categorized.""" # TODO: why are these not in _root of check-dir? -from proselint.checks import CheckRegistry from proselint.checks.misc.apologizing import ( - register_with as register_apologizing, + __register__ as register_apologizing, ) from proselint.checks.misc.back_formations import ( - register_with as register_back_formations, + __register__ as register_back_formations, ) -from proselint.checks.misc.braces import register_with as register_braces +from proselint.checks.misc.braces import __register__ as register_braces from proselint.checks.misc.bureaucratese import ( - register_with as register_bureaucratese, + __register__ as register_bureaucratese, ) -from proselint.checks.misc.but import register_with as register_but +from proselint.checks.misc.but import __register__ as register_but from proselint.checks.misc.capitalization import ( - register_with as register_capitalization, + __register__ as register_capitalization, ) -from proselint.checks.misc.chatspeak import register_with as register_chatspeak +from proselint.checks.misc.chatspeak import __register__ as register_chatspeak from proselint.checks.misc.commercialese import ( - register_with as register_commercialese, + __register__ as register_commercialese, ) from proselint.checks.misc.composition import ( - register_with as register_composition, + __register__ as register_composition, ) -from proselint.checks.misc.currency import register_with as register_currency -from proselint.checks.misc.debased import register_with as register_debased -from proselint.checks.misc.greylist import register_with as register_greylist -from proselint.checks.misc.illogic import register_with as register_illogic +from proselint.checks.misc.currency import __register__ as register_currency +from proselint.checks.misc.debased import __register__ as register_debased +from proselint.checks.misc.greylist import __register__ as register_greylist +from proselint.checks.misc.illogic import __register__ as register_illogic from proselint.checks.misc.inferior_superior import ( - register_with as register_inferior_superior, + __register__ as register_inferior_superior, ) from proselint.checks.misc.institution_name import ( - register_with as register_institution_name, + __register__ as register_institution_name, ) -from proselint.checks.misc.latin import register_with as register_latin -from proselint.checks.misc.many_a import register_with as register_many_a +from proselint.checks.misc.latin import __register__ as register_latin +from proselint.checks.misc.many_a import __register__ as register_many_a from proselint.checks.misc.metadiscourse import ( - register_with as register_metadiscourse, + __register__ as register_metadiscourse, ) -from proselint.checks.misc.monotonic import register_with as register_monotonic +from proselint.checks.misc.monotonic import __register__ as register_monotonic from proselint.checks.misc.narcissism import ( - register_with as register_narcissism, + __register__ as register_narcissism, ) from proselint.checks.misc.not_guilty import ( - register_with as register_not_guilty, + __register__ as register_not_guilty, ) -from proselint.checks.misc.numbers import register_with as register_numbers +from proselint.checks.misc.numbers import __register__ as register_numbers from proselint.checks.misc.phrasal_adjectives import ( - register_with as register_phrasal_adjectives, + __register__ as register_phrasal_adjectives, ) -from proselint.checks.misc.plurals import register_with as register_plurals +from proselint.checks.misc.plurals import __register__ as register_plurals from proselint.checks.misc.preferred_forms import ( - register_with as register_preferred_forms, + __register__ as register_preferred_forms, ) from proselint.checks.misc.pretension import ( - register_with as register_pretension, + __register__ as register_pretension, ) from proselint.checks.misc.professions import ( - register_with as register_professions, + __register__ as register_professions, ) from proselint.checks.misc.scare_quotes import ( - register_with as register_scare_quotes, + __register__ as register_scare_quotes, ) -from proselint.checks.misc.suddenly import register_with as register_suddenly +from proselint.checks.misc.suddenly import __register__ as register_suddenly from proselint.checks.misc.tense_present import ( - register_with as register_tense_present, + __register__ as register_tense_present, ) -from proselint.checks.misc.waxed import register_with as register_waxed -from proselint.checks.misc.whence import register_with as register_whence +from proselint.checks.misc.waxed import __register__ as register_waxed +from proselint.checks.misc.whence import __register__ as register_whence - -def register_with(registry: CheckRegistry) -> None: - """Register the checks.""" - register_apologizing(registry) - register_back_formations(registry) - register_braces(registry) - register_bureaucratese(registry) - register_but(registry) - register_capitalization(registry) - register_chatspeak(registry) - register_commercialese(registry) - register_composition(registry) - register_currency(registry) - register_debased(registry) - register_greylist(registry) - register_illogic(registry) - register_inferior_superior(registry) - register_institution_name(registry) - register_latin(registry) - register_many_a(registry) - register_metadiscourse(registry) - register_monotonic(registry) - register_narcissism(registry) - register_not_guilty(registry) - register_numbers(registry) - register_phrasal_adjectives(registry) - register_plurals(registry) - register_preferred_forms(registry) - register_pretension(registry) - register_professions(registry) - register_scare_quotes(registry) - register_suddenly(registry) - register_tense_present(registry) - register_waxed(registry) - register_whence(registry) +__register__ = ( + *register_apologizing, + *register_back_formations, + *register_braces, + *register_bureaucratese, + *register_but, + *register_capitalization, + *register_chatspeak, + *register_commercialese, + *register_composition, + *register_currency, + *register_debased, + *register_greylist, + *register_illogic, + *register_inferior_superior, + *register_institution_name, + *register_latin, + *register_many_a, + *register_metadiscourse, + *register_monotonic, + *register_narcissism, + *register_not_guilty, + *register_numbers, + *register_phrasal_adjectives, + *register_plurals, + *register_preferred_forms, + *register_pretension, + *register_professions, + *register_scare_quotes, + *register_suddenly, + *register_tense_present, + *register_waxed, + *register_whence, +) diff --git a/proselint/checks/misc/apologizing.py b/proselint/checks/misc/apologizing.py index e76fb8698..8900a9272 100644 --- a/proselint/checks/misc/apologizing.py +++ b/proselint/checks/misc/apologizing.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, Existence +from proselint.checks import CheckSpec, Existence examples_pass = [ "Smoke phrase with nothing flagged.", @@ -32,7 +32,4 @@ "Excessive apologizing.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/misc/back_formations.py b/proselint/checks/misc/back_formations.py index cdc22b84a..98c414c32 100644 --- a/proselint/checks/misc/back_formations.py +++ b/proselint/checks/misc/back_formations.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, PreferredFormsSimple +from proselint.checks import CheckSpec, PreferredFormsSimple examples_pass = [ "Smoke phrase with nothing flagged.", @@ -32,7 +32,4 @@ "Back-formation. '{}' is the preferred form.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/misc/braces.py b/proselint/checks/misc/braces.py index 099c685b6..738cfea94 100644 --- a/proselint/checks/misc/braces.py +++ b/proselint/checks/misc/braces.py @@ -17,7 +17,7 @@ import re from typing import Optional -from proselint.checks import CheckRegistry, CheckResult, CheckSpec +from proselint.checks import CheckResult, CheckSpec examples_pass = [ "Smoke phrase with nothing flagged.", @@ -103,7 +103,4 @@ def _check_unmatched(text: str) -> list[CheckResult]: "Don't fail to match / close unopened braces.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check_unmatched) +__register__ = (check_unmatched,) diff --git a/proselint/checks/misc/bureaucratese.py b/proselint/checks/misc/bureaucratese.py index 97d3fcb6a..ca8e07313 100644 --- a/proselint/checks/misc/bureaucratese.py +++ b/proselint/checks/misc/bureaucratese.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, Existence +from proselint.checks import CheckSpec, Existence examples_pass = [ "Smoke phrase with nothing flagged.", @@ -36,7 +36,4 @@ "'{}' is bureaucratese.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/misc/but.py b/proselint/checks/misc/but.py index e6e368c91..1a97da191 100644 --- a/proselint/checks/misc/but.py +++ b/proselint/checks/misc/but.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, Existence, Pd +from proselint.checks import CheckSpec, Existence, Pd examples_pass = [ "Smoke phrase with nothing flagged.", @@ -44,7 +44,4 @@ ignore_case=False, ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/misc/capitalization.py b/proselint/checks/misc/capitalization.py index 2007ee969..13fd5555b 100644 --- a/proselint/checks/misc/capitalization.py +++ b/proselint/checks/misc/capitalization.py @@ -17,7 +17,6 @@ from __future__ import annotations from proselint.checks import ( - CheckRegistry, CheckResult, CheckSpec, ExistenceSimple, @@ -144,14 +143,11 @@ def _check_roman_numerals(text: str) -> list[CheckResult]: "Capitalize the roman numeral abbreviation '{}'.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the checks.""" - registry.register_many(( - check_terms, - check_seasons, - check_months, - check_days, - check_roman_war, - check_roman_numerals, - )) +__register__ = ( + check_terms, + check_seasons, + check_months, + check_days, + check_roman_war, + check_roman_numerals, +) diff --git a/proselint/checks/misc/chatspeak.py b/proselint/checks/misc/chatspeak.py index 468329a06..b612e28b1 100644 --- a/proselint/checks/misc/chatspeak.py +++ b/proselint/checks/misc/chatspeak.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, Existence +from proselint.checks import CheckSpec, Existence examples_pass = [ "Smoke phrase with nothing flagged.", @@ -56,7 +56,4 @@ "'{}' is chatspeak. Write it out.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/misc/commercialese.py b/proselint/checks/misc/commercialese.py index 4937cc050..81a7357e7 100644 --- a/proselint/checks/misc/commercialese.py +++ b/proselint/checks/misc/commercialese.py @@ -17,7 +17,6 @@ from __future__ import annotations from proselint.checks import ( - CheckRegistry, CheckSpec, Existence, Pd, @@ -80,9 +79,7 @@ ) -def register_with(registry: CheckRegistry) -> None: - """Register the checks.""" - registry.register_many(( - check, - check_abbrev, - )) +__register__ = ( + check, + check_abbrev, +) diff --git a/proselint/checks/misc/composition.py b/proselint/checks/misc/composition.py index cace508bc..bd7ef157c 100644 --- a/proselint/checks/misc/composition.py +++ b/proselint/checks/misc/composition.py @@ -50,7 +50,6 @@ from __future__ import annotations from proselint.checks import ( - CheckRegistry, CheckSpec, PreferredForms, PreferredFormsSimple, @@ -107,9 +106,7 @@ ) -def register_with(registry: CheckRegistry) -> None: - """Register the checks.""" - registry.register_many(( - check, - check_regex, - )) +__register__ = ( + check, + check_regex, +) diff --git a/proselint/checks/misc/currency.py b/proselint/checks/misc/currency.py index 5a23f904e..69456a127 100644 --- a/proselint/checks/misc/currency.py +++ b/proselint/checks/misc/currency.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, Existence, Pd +from proselint.checks import CheckSpec, Existence, Pd examples_pass = [ "Smoke phrase with nothing flagged.", @@ -35,7 +35,4 @@ "Incorrect use of symbols in {}.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/misc/debased.py b/proselint/checks/misc/debased.py index 0b8e963a4..55e0da0b2 100644 --- a/proselint/checks/misc/debased.py +++ b/proselint/checks/misc/debased.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, Existence +from proselint.checks import CheckSpec, Existence examples_pass = [ "Smoke phrase with nothing flagged.", @@ -37,7 +37,4 @@ "Debased language is a continuous temptation.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/misc/greylist.py b/proselint/checks/misc/greylist.py index 03edfaded..0d5a47ab3 100644 --- a/proselint/checks/misc/greylist.py +++ b/proselint/checks/misc/greylist.py @@ -37,7 +37,6 @@ from __future__ import annotations from proselint.checks import ( - CheckRegistry, CheckResult, CheckSpec, existence_check, @@ -84,7 +83,4 @@ def _check(text: str) -> list[CheckResult]: "Use of '{}'. {}", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/misc/illogic.py b/proselint/checks/misc/illogic.py index 713296d2c..50950cd10 100644 --- a/proselint/checks/misc/illogic.py +++ b/proselint/checks/misc/illogic.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, Existence +from proselint.checks import CheckSpec, Existence examples_pass = [ "Smoke phrase with nothing flagged.", @@ -58,10 +58,8 @@ ) -def register_with(registry: CheckRegistry) -> None: - """Register the checks.""" - registry.register_many(( - check, - check_coin_a_phrase_from, - check_without_your_collusion, - )) +__register__ = ( + check, + check_coin_a_phrase_from, + check_without_your_collusion, +) diff --git a/proselint/checks/misc/inferior_superior.py b/proselint/checks/misc/inferior_superior.py index b6d80d2b8..888a2a440 100644 --- a/proselint/checks/misc/inferior_superior.py +++ b/proselint/checks/misc/inferior_superior.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, PreferredFormsSimple +from proselint.checks import CheckSpec, PreferredFormsSimple examples_pass = [ "Smoke phrase with nothing flagged.", @@ -35,7 +35,4 @@ "'Inferior' and 'superior' are not true comparatives. Use '{}'.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/misc/institution_name.py b/proselint/checks/misc/institution_name.py index ec2c34655..43fccd8b5 100644 --- a/proselint/checks/misc/institution_name.py +++ b/proselint/checks/misc/institution_name.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, PreferredFormsSimple +from proselint.checks import CheckSpec, PreferredFormsSimple examples_pass = [ "Smoke phrase with nothing flagged.", @@ -35,7 +35,4 @@ "Incorrect name. Use '{}' instead of '{}'.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check_vtech) +__register__ = (check_vtech,) diff --git a/proselint/checks/misc/latin.py b/proselint/checks/misc/latin.py index c74390bfd..a8683bfcb 100644 --- a/proselint/checks/misc/latin.py +++ b/proselint/checks/misc/latin.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, PreferredFormsSimple +from proselint.checks import CheckSpec, PreferredFormsSimple examples_pass = [ "Smoke phrase with nothing flagged.", @@ -37,7 +37,4 @@ "Use English. '{}' is the preferred form.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/misc/many_a.py b/proselint/checks/misc/many_a.py index d93378ffa..4af466b74 100644 --- a/proselint/checks/misc/many_a.py +++ b/proselint/checks/misc/many_a.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, PreferredFormsSimple +from proselint.checks import CheckSpec, PreferredFormsSimple examples_pass = [ "Smoke phrase with nothing flagged.", @@ -36,7 +36,4 @@ "'many a' requires a singular verb, as in '{}'.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/misc/metadiscourse.py b/proselint/checks/misc/metadiscourse.py index 5d0e8bfc8..b9fb6e89a 100644 --- a/proselint/checks/misc/metadiscourse.py +++ b/proselint/checks/misc/metadiscourse.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, Existence +from proselint.checks import CheckSpec, Existence examples_pass = [ "Smoke phrase with nothing flagged.", @@ -38,7 +38,4 @@ "Excessive metadiscourse.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/misc/monotonic.py b/proselint/checks/misc/monotonic.py index 55c570f49..07c4949e8 100644 --- a/proselint/checks/misc/monotonic.py +++ b/proselint/checks/misc/monotonic.py @@ -43,6 +43,8 @@ # TODO: check same line/section-beginning +__register__ = (check_sentence,) + def register_with(registry: CheckRegistry) -> None: """Register the check.""" diff --git a/proselint/checks/misc/narcissism.py b/proselint/checks/misc/narcissism.py index bad5109fc..37d78388f 100644 --- a/proselint/checks/misc/narcissism.py +++ b/proselint/checks/misc/narcissism.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, Existence +from proselint.checks import CheckSpec, Existence examples_pass = [ "Smoke phrase with nothing flagged.", @@ -35,7 +35,4 @@ "Professional narcissism. Talk about the subject, not its study.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/misc/not_guilty.py b/proselint/checks/misc/not_guilty.py index 066ce74a3..32d93d268 100644 --- a/proselint/checks/misc/not_guilty.py +++ b/proselint/checks/misc/not_guilty.py @@ -24,7 +24,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, Existence +from proselint.checks import CheckSpec, Existence examples_pass = [ "Smoke phrase with nothing flagged.", @@ -40,7 +40,4 @@ "'not guilty beyond a reasonable doubt' is an ambiguous phrasing.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/misc/numbers.py b/proselint/checks/misc/numbers.py index 2acc3cfee..7df0ad4e2 100644 --- a/proselint/checks/misc/numbers.py +++ b/proselint/checks/misc/numbers.py @@ -15,7 +15,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, ExistenceSimple +from proselint.checks import CheckSpec, ExistenceSimple examples_pass = [ "Smoke phrase with nothing flagged.", @@ -90,11 +90,8 @@ "part of a name.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the checks.""" - registry.register_many(( - check_section, - check_section, - check_single_digit, - )) +__register__ = ( + check_section, + check_section, + check_single_digit, +) diff --git a/proselint/checks/misc/phrasal_adjectives.py b/proselint/checks/misc/phrasal_adjectives.py index e23d93bbf..ed6e05d12 100644 --- a/proselint/checks/misc/phrasal_adjectives.py +++ b/proselint/checks/misc/phrasal_adjectives.py @@ -17,7 +17,6 @@ from __future__ import annotations from proselint.checks import ( - CheckRegistry, CheckSpec, Existence, Pd, @@ -161,11 +160,8 @@ "Hyphenate '{1}', a phrasal adjective, as '{0}'.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the checks.""" - registry.register_many(( - check_ly, - check, - check_regex, - )) +__register__ = ( + check_ly, + check, + check_regex, +) diff --git a/proselint/checks/misc/plurals.py b/proselint/checks/misc/plurals.py index d4ae9ed5a..376db99bb 100644 --- a/proselint/checks/misc/plurals.py +++ b/proselint/checks/misc/plurals.py @@ -17,7 +17,6 @@ from __future__ import annotations from proselint.checks import ( - CheckRegistry, CheckSpec, Existence, PreferredFormsSimple, @@ -47,10 +46,7 @@ "Kudos is singular.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the checks.""" - registry.register_many(( - check, - check_kudos, - )) +__register__ = ( + check, + check_kudos, +) diff --git a/proselint/checks/misc/preferred_forms.py b/proselint/checks/misc/preferred_forms.py index ec081db7d..f52cf9292 100644 --- a/proselint/checks/misc/preferred_forms.py +++ b/proselint/checks/misc/preferred_forms.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, PreferredFormsSimple +from proselint.checks import CheckSpec, PreferredFormsSimple examples_pass = [ "Smoke phrase with nothing flagged.", @@ -184,7 +184,4 @@ "'{}' is the preferred form.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/misc/pretension.py b/proselint/checks/misc/pretension.py index 15d4f96b7..03e8787d0 100644 --- a/proselint/checks/misc/pretension.py +++ b/proselint/checks/misc/pretension.py @@ -18,7 +18,6 @@ from proselint.checks import ( CheckFlags, - CheckRegistry, CheckSpec, Existence, ) @@ -43,7 +42,4 @@ flags=CheckFlags(limit_results=1), ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/misc/professions.py b/proselint/checks/misc/professions.py index 5dc5bd870..8115a38e4 100644 --- a/proselint/checks/misc/professions.py +++ b/proselint/checks/misc/professions.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, PreferredFormsSimple +from proselint.checks import CheckSpec, PreferredFormsSimple examples_pass = [ "Smoke phrase with nothing flagged.", @@ -35,7 +35,4 @@ "'{}' is the name of that job, not '{}'.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/misc/scare_quotes.py b/proselint/checks/misc/scare_quotes.py index 5bb268628..0f357327b 100644 --- a/proselint/checks/misc/scare_quotes.py +++ b/proselint/checks/misc/scare_quotes.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, Existence, Pd +from proselint.checks import CheckSpec, Existence, Pd examples_pass = [ "Smoke phrase with nothing flagged.", @@ -35,7 +35,4 @@ "Misuse of 'scare quotes'. Delete them.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/misc/suddenly.py b/proselint/checks/misc/suddenly.py index 3ad16966f..8c811ea3d 100644 --- a/proselint/checks/misc/suddenly.py +++ b/proselint/checks/misc/suddenly.py @@ -30,7 +30,6 @@ from proselint.checks import ( CheckFlags, - CheckRegistry, CheckSpec, Existence, Pd, @@ -55,7 +54,4 @@ ignore_case=False, ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/misc/tense_present.py b/proselint/checks/misc/tense_present.py index 499f8bc39..fc5c54a90 100644 --- a/proselint/checks/misc/tense_present.py +++ b/proselint/checks/misc/tense_present.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, Existence, Pd +from proselint.checks import CheckSpec, Existence, Pd examples_pass = [ "Smoke phrase with nothing flagged.", @@ -67,10 +67,7 @@ ignore_case=True, ) - -def register_with(registry: CheckRegistry) -> None: - """Register the checks.""" - registry.register_many(( - check, - check_2, - )) +__register__ = ( + check, + check_2, +) diff --git a/proselint/checks/misc/waxed.py b/proselint/checks/misc/waxed.py index 7150639e8..c33059839 100644 --- a/proselint/checks/misc/waxed.py +++ b/proselint/checks/misc/waxed.py @@ -22,7 +22,6 @@ import re from proselint.checks import ( - CheckRegistry, CheckResult, CheckSpec, preferred_forms_check_opti, @@ -87,7 +86,4 @@ def _check(text: str) -> list[CheckResult]: "The modifier following 'waxed' must be an adjective: '{}' is correct.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/misc/whence.py b/proselint/checks/misc/whence.py index 4d36b7b67..234e9f8b6 100644 --- a/proselint/checks/misc/whence.py +++ b/proselint/checks/misc/whence.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, Existence +from proselint.checks import CheckSpec, Existence examples_pass = [ "Smoke phrase with nothing flagged.", @@ -32,7 +32,4 @@ "The 'from' in 'from whence' is redundant.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/mixed_metaphors/__init__.py b/proselint/checks/mixed_metaphors/__init__.py index 5b6a895c5..a6e288255 100644 --- a/proselint/checks/mixed_metaphors/__init__.py +++ b/proselint/checks/mixed_metaphors/__init__.py @@ -1,5 +1,5 @@ """Mixed metaphors.""" -from proselint.checks.mixed_metaphors.misc import register_with +from proselint.checks.mixed_metaphors.misc import __register__ -__all__ = ["register_with"] +__all__ = ["__register__"] diff --git a/proselint/checks/mixed_metaphors/misc.py b/proselint/checks/mixed_metaphors/misc.py index 6b105603f..aae4423bb 100644 --- a/proselint/checks/mixed_metaphors/misc.py +++ b/proselint/checks/mixed_metaphors/misc.py @@ -4,7 +4,6 @@ from proselint.checks import ( CheckFlags, - CheckRegistry, CheckSpec, Existence, PreferredForms, @@ -64,11 +63,8 @@ misc_msg, ) - -def register_with(registry: CheckRegistry) -> None: - """Register the checks.""" - registry.register_many(( - check_bottleneck, - check_misc, - check_misc_2, - )) +__register__ = ( + check_bottleneck, + check_misc, + check_misc_2, +) diff --git a/proselint/checks/mondegreens/__init__.py b/proselint/checks/mondegreens/__init__.py index dcd78f966..9f24856bd 100644 --- a/proselint/checks/mondegreens/__init__.py +++ b/proselint/checks/mondegreens/__init__.py @@ -1,5 +1,5 @@ """Mondegreens.""" -from proselint.checks.mondegreens.misc import register_with +from proselint.checks.mondegreens.misc import __register__ -__all__ = ["register_with"] +__all__ = ["__register__"] diff --git a/proselint/checks/mondegreens/misc.py b/proselint/checks/mondegreens/misc.py index 3610e5eef..50f40be4e 100644 --- a/proselint/checks/mondegreens/misc.py +++ b/proselint/checks/mondegreens/misc.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, PreferredFormsSimple +from proselint.checks import CheckSpec, PreferredFormsSimple examples_pass = [ "Smoke phrase with nothing flagged.", @@ -42,7 +42,4 @@ "'{}' is the preferred form.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/needless_variants/__init__.py b/proselint/checks/needless_variants/__init__.py index 1a1b52585..4b3030fdd 100644 --- a/proselint/checks/needless_variants/__init__.py +++ b/proselint/checks/needless_variants/__init__.py @@ -1,5 +1,5 @@ """Needless variants.""" -from proselint.checks.needless_variants.misc import register_with +from proselint.checks.needless_variants.misc import __register__ -__all__ = ["register_with"] +__all__ = ["__register__"] diff --git a/proselint/checks/needless_variants/misc.py b/proselint/checks/needless_variants/misc.py index d789af86e..efb1557f0 100644 --- a/proselint/checks/needless_variants/misc.py +++ b/proselint/checks/needless_variants/misc.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, PreferredFormsSimple +from proselint.checks import CheckSpec, PreferredFormsSimple examples_pass = [ "Smoke phrase with nothing flagged.", @@ -405,10 +405,7 @@ msg, ) - -def register_with(registry: CheckRegistry) -> None: - """Register the checks.""" - registry.register_many(( - check_1, - check_2, - )) +__register__ = ( + check_1, + check_2, +) diff --git a/proselint/checks/nonwords/__init__.py b/proselint/checks/nonwords/__init__.py index bd111d9ab..df60446b8 100644 --- a/proselint/checks/nonwords/__init__.py +++ b/proselint/checks/nonwords/__init__.py @@ -1,5 +1,5 @@ """Nonwords.""" -from proselint.checks.nonwords.misc import register_with +from proselint.checks.nonwords.misc import __register__ -__all__ = ["register_with"] +__all__ = ["__register__"] diff --git a/proselint/checks/nonwords/misc.py b/proselint/checks/nonwords/misc.py index 70f6c6e4a..e84f2bb50 100644 --- a/proselint/checks/nonwords/misc.py +++ b/proselint/checks/nonwords/misc.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, PreferredFormsSimple +from proselint.checks import CheckSpec, PreferredFormsSimple examples_pass = [ "Smoke phrase with nothing flagged.", @@ -67,7 +67,4 @@ "Nonword, try '{}'.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/oxymorons/__init__.py b/proselint/checks/oxymorons/__init__.py index 8a1d6b108..bedb13f8b 100644 --- a/proselint/checks/oxymorons/__init__.py +++ b/proselint/checks/oxymorons/__init__.py @@ -1,5 +1,5 @@ """Oxymorons.""" -from proselint.checks.oxymorons.misc import register_with +from proselint.checks.oxymorons.misc import __register__ -__all__ = ["register_with"] +__all__ = ["__register__"] diff --git a/proselint/checks/oxymorons/misc.py b/proselint/checks/oxymorons/misc.py index 1a0b09566..f859c0bec 100644 --- a/proselint/checks/oxymorons/misc.py +++ b/proselint/checks/oxymorons/misc.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, Existence +from proselint.checks import CheckSpec, Existence examples_pass = [ "Smoke phrase with nothing flagged.", @@ -54,7 +54,4 @@ "'{}' is an oxymoron.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/psychology/__init__.py b/proselint/checks/psychology/__init__.py index 8f59ea3b2..8d82bf3aa 100644 --- a/proselint/checks/psychology/__init__.py +++ b/proselint/checks/psychology/__init__.py @@ -1,5 +1,5 @@ """Advice on science.""" -from proselint.checks.psychology.misc import register_with +from proselint.checks.psychology.misc import __register__ -__all__ = ["register_with"] +__all__ = ["__register__"] diff --git a/proselint/checks/psychology/misc.py b/proselint/checks/psychology/misc.py index 5d41c4c57..330539243 100644 --- a/proselint/checks/psychology/misc.py +++ b/proselint/checks/psychology/misc.py @@ -17,7 +17,6 @@ from __future__ import annotations from proselint.checks import ( - CheckRegistry, CheckSpec, Existence, PreferredFormsSimple, @@ -58,11 +57,8 @@ "This is redundant because all purported telepathy is mental.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the checks.""" - registry.register_many(( - check_lie_detector_test, - check_p_equals_zero, - check_mental_telepathy, - )) +__register__ = ( + check_lie_detector_test, + check_p_equals_zero, + check_mental_telepathy, +) diff --git a/proselint/checks/punctuation/__init__.py b/proselint/checks/punctuation/__init__.py index 213f47bf6..9e0fc0a26 100644 --- a/proselint/checks/punctuation/__init__.py +++ b/proselint/checks/punctuation/__init__.py @@ -1,13 +1,11 @@ """check for puntuation spacing.""" -from proselint.checks import CheckRegistry -from proselint.checks.punctuation.misc import register_with as register_misc +from proselint.checks.punctuation.misc import __register__ as register_misc from proselint.checks.punctuation.spacing import ( - register_with as register_spacing, + __register__ as register_spacing, ) - -def register_with(registry: CheckRegistry) -> None: - """Register the checks.""" - register_misc(registry) - register_spacing(registry) +__register__ = ( + *register_misc, + *register_spacing, +) diff --git a/proselint/checks/punctuation/misc.py b/proselint/checks/punctuation/misc.py index 9cbf6d334..1ddcd014c 100644 --- a/proselint/checks/punctuation/misc.py +++ b/proselint/checks/punctuation/misc.py @@ -17,7 +17,6 @@ from __future__ import annotations from proselint.checks import ( - CheckRegistry, CheckSpec, Existence, ExistenceSimple, @@ -81,11 +80,8 @@ "In English ',' is used as a decimal separator.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the checks.""" - registry.register_many(( - check_garner, - check_lower_case_after_punctuation, - check_comma_digits, - )) +__register__ = ( + check_garner, + check_lower_case_after_punctuation, + check_comma_digits, +) diff --git a/proselint/checks/punctuation/spacing.py b/proselint/checks/punctuation/spacing.py index 6a775a404..1922e16e7 100644 --- a/proselint/checks/punctuation/spacing.py +++ b/proselint/checks/punctuation/spacing.py @@ -17,7 +17,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, ExistenceSimple, Pd +from proselint.checks import CheckSpec, ExistenceSimple, Pd examples_pass = [ "Smoke phrase with nothing flagged.", @@ -71,12 +71,9 @@ "Multiple spaces, that would be ugly in Word or LibreOffice.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the checks.""" - registry.register_many(( - check_end_punctuation_spacing, - check_general_spacing, - check_whitespace_before, - check_whitespace_inbetween, - )) +__register__ = ( + check_end_punctuation_spacing, + check_general_spacing, + check_whitespace_before, + check_whitespace_inbetween, +) diff --git a/proselint/checks/redundancy/__init__.py b/proselint/checks/redundancy/__init__.py index a302d9b2f..5bdcb6001 100644 --- a/proselint/checks/redundancy/__init__.py +++ b/proselint/checks/redundancy/__init__.py @@ -1,13 +1,11 @@ """Redundancy.""" -from proselint.checks import CheckRegistry -from proselint.checks.redundancy.misc import register_with as register_misc +from proselint.checks.redundancy.misc import __register__ as register_misc from proselint.checks.redundancy.ras_syndrome import ( - register_with as register_ras_syndrome, + __register__ as register_ras_syndrome, ) - -def register_with(registry: CheckRegistry) -> None: - """Register the checks.""" - register_misc(registry) - register_ras_syndrome(registry) +__register__ = ( + *register_misc, + *register_ras_syndrome, +) diff --git a/proselint/checks/redundancy/misc.py b/proselint/checks/redundancy/misc.py index 4efe46c68..aefb21708 100644 --- a/proselint/checks/redundancy/misc.py +++ b/proselint/checks/redundancy/misc.py @@ -3,7 +3,6 @@ from __future__ import annotations from proselint.checks import ( - CheckRegistry, CheckSpec, Pd, PreferredForms, @@ -565,16 +564,13 @@ msg, ) - -def register_with(registry: CheckRegistry) -> None: - """Register the checks.""" - registry.register_many(( - check_wallace, - check_garner_regex, - check_garner, - check_nordquist, - check_nordquist_regex, - check_atd_1, - check_atd_2, - check_atd_2_regex, - )) +__register__ = ( + check_wallace, + check_garner_regex, + check_garner, + check_nordquist, + check_nordquist_regex, + check_atd_1, + check_atd_2, + check_atd_2_regex, +) diff --git a/proselint/checks/redundancy/ras_syndrome.py b/proselint/checks/redundancy/ras_syndrome.py index 880dbcad4..fa9df2402 100644 --- a/proselint/checks/redundancy/ras_syndrome.py +++ b/proselint/checks/redundancy/ras_syndrome.py @@ -2,7 +2,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, PreferredFormsSimple +from proselint.checks import CheckSpec, PreferredFormsSimple examples_pass = [ "Smoke phrase with nothing flagged.", @@ -40,7 +40,4 @@ "RAS syndrome. Use '{}' instead of '{}'.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/restricted/__init__.py b/proselint/checks/restricted/__init__.py index 56974992f..77faa292a 100644 --- a/proselint/checks/restricted/__init__.py +++ b/proselint/checks/restricted/__init__.py @@ -1,15 +1,13 @@ """Restricted word lists.""" -from proselint.checks import CheckRegistry from proselint.checks.restricted.elementary import ( - register_with as register_elementary, + __register__ as register_elementary, ) from proselint.checks.restricted.top1000 import ( - register_with as register_top1000, + __register__ as register_top1000, ) - -def register_with(registry: CheckRegistry) -> None: - """Register the checks.""" - register_elementary(registry) - register_top1000(registry) +__register__ = ( + *register_elementary, + *register_top1000, +) diff --git a/proselint/checks/restricted/elementary.py b/proselint/checks/restricted/elementary.py index 2e9df3aa0..d703aa15d 100644 --- a/proselint/checks/restricted/elementary.py +++ b/proselint/checks/restricted/elementary.py @@ -22,7 +22,7 @@ from importlib_resources import files import proselint -from proselint.checks import CheckRegistry, CheckSpec, ReverseExistence +from proselint.checks import CheckSpec, ReverseExistence examples_pass = [ "A boy and his goat went to a farm.", @@ -46,7 +46,4 @@ "'{}' is not a word kids learn in elementary school.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check_elementary) +__register__ = (check_elementary,) diff --git a/proselint/checks/restricted/top1000.py b/proselint/checks/restricted/top1000.py index 81778900c..caa92923f 100644 --- a/proselint/checks/restricted/top1000.py +++ b/proselint/checks/restricted/top1000.py @@ -22,7 +22,7 @@ from importlib_resources import files import proselint -from proselint.checks import CheckRegistry, CheckSpec, ReverseExistence +from proselint.checks import CheckSpec, ReverseExistence examples_pass = [ "I am blonde.", @@ -47,7 +47,4 @@ "'{}' is not in the top 1000 most common words.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check_top1000) +__register__ = (check_top1000,) diff --git a/proselint/checks/scientific/__init__.py b/proselint/checks/scientific/__init__.py index 11119c390..862905d00 100644 --- a/proselint/checks/scientific/__init__.py +++ b/proselint/checks/scientific/__init__.py @@ -1,5 +1,5 @@ """Scientific writing.""" -from proselint.checks.scientific.misc import register_with +from proselint.checks.scientific.misc import __register__ -__all__ = ["register_with"] +__all__ = ["__register__"] diff --git a/proselint/checks/scientific/misc.py b/proselint/checks/scientific/misc.py index d67dbb923..943500817 100644 --- a/proselint/checks/scientific/misc.py +++ b/proselint/checks/scientific/misc.py @@ -19,7 +19,6 @@ import re from proselint.checks import ( - CheckRegistry, CheckResult, CheckSpec, Consistency, @@ -236,18 +235,15 @@ def _check_this_vs_those(text: str) -> list[CheckResult]: # - L812 this vs those # - deg C or deg K is old, deg not used anymore - -def register_with(registry: CheckRegistry) -> None: - """Register the checks.""" - registry.register_many(( - check_num_unit, - check_emotion, - check_weasel, - check_conversation, - check_wrong, - check_avoid_misc, - check_preferred, - check_preferred_regex, - check_this_vs_those, - check_we_or_i, - )) +__register__ = ( + check_num_unit, + check_emotion, + check_weasel, + check_conversation, + check_wrong, + check_avoid_misc, + check_preferred, + check_preferred_regex, + check_this_vs_those, + check_we_or_i, +) diff --git a/proselint/checks/security/__init__.py b/proselint/checks/security/__init__.py index a6edf69f4..1b5d0324a 100644 --- a/proselint/checks/security/__init__.py +++ b/proselint/checks/security/__init__.py @@ -1,15 +1,13 @@ """Security.""" -from proselint.checks import CheckRegistry from proselint.checks.security.credit_card import ( - register_with as register_credit_card, + __register__ as register_credit_card, ) from proselint.checks.security.password import ( - register_with as register_password, + __register__ as register_password, ) - -def register_with(registry: CheckRegistry) -> None: - """Register the checks.""" - register_credit_card(registry) - register_password(registry) +__register__ = ( + *register_credit_card, + *register_password, +) diff --git a/proselint/checks/security/credit_card.py b/proselint/checks/security/credit_card.py index 2654cbe14..cc8c15a87 100644 --- a/proselint/checks/security/credit_card.py +++ b/proselint/checks/security/credit_card.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, Existence +from proselint.checks import CheckSpec, Existence examples_pass = [ "Smoke phrase with nothing flagged.", @@ -38,7 +38,4 @@ "Don't put credit card numbers in plain text.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/security/password.py b/proselint/checks/security/password.py index b77d0d3be..d62437575 100644 --- a/proselint/checks/security/password.py +++ b/proselint/checks/security/password.py @@ -15,7 +15,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, Existence, Pd +from proselint.checks import CheckSpec, Existence, Pd examples_pass = [ "Smoke phrase with nothing flagged.", @@ -43,7 +43,4 @@ "Don't put passwords in plain text.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/sexism/__init__.py b/proselint/checks/sexism/__init__.py index d648e2158..bf871379a 100644 --- a/proselint/checks/sexism/__init__.py +++ b/proselint/checks/sexism/__init__.py @@ -1,5 +1,5 @@ """Sexism.""" -from proselint.checks.sexism.misc import register_with +from proselint.checks.sexism.misc import __register__ -__all__ = ["register_with"] +__all__ = ["__register__"] diff --git a/proselint/checks/sexism/misc.py b/proselint/checks/sexism/misc.py index 46fa3d9ac..691248cb3 100644 --- a/proselint/checks/sexism/misc.py +++ b/proselint/checks/sexism/misc.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, PreferredFormsSimple +from proselint.checks import CheckSpec, PreferredFormsSimple examples_pass = [ "Smoke phrase with nothing flagged.", @@ -93,10 +93,7 @@ "Not a preferred form. Use '{}' instead of '{}'.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the checks.""" - registry.register_many(( - check_sexism, - check_preferred_form, - )) +__register__ = ( + check_sexism, + check_preferred_form, +) diff --git a/proselint/checks/skunked_terms/__init__.py b/proselint/checks/skunked_terms/__init__.py index e80b94e3b..28028cb6f 100644 --- a/proselint/checks/skunked_terms/__init__.py +++ b/proselint/checks/skunked_terms/__init__.py @@ -1,5 +1,5 @@ """Avoid skunked terms.""" -from proselint.checks.skunked_terms.misc import register_with +from proselint.checks.skunked_terms.misc import __register__ -__all__ = ["register_with"] +__all__ = ["__register__"] diff --git a/proselint/checks/skunked_terms/misc.py b/proselint/checks/skunked_terms/misc.py index 74ac33b37..5eb91f0a8 100644 --- a/proselint/checks/skunked_terms/misc.py +++ b/proselint/checks/skunked_terms/misc.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, Existence, Pd +from proselint.checks import CheckSpec, Existence, Pd examples_pass = [ "Smoke phrase with nothing flagged.", @@ -46,7 +46,4 @@ "Find another way to say it.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/spelling/__init__.py b/proselint/checks/spelling/__init__.py index 875783a31..df710f5cf 100644 --- a/proselint/checks/spelling/__init__.py +++ b/proselint/checks/spelling/__init__.py @@ -1,39 +1,37 @@ """Spelling.""" -from proselint.checks import CheckRegistry from proselint.checks.spelling.able_atable import ( - register_with as register_able_atable, + __register__ as register_able_atable, ) from proselint.checks.spelling.able_ible import ( - register_with as register_able_ible, + __register__ as register_able_ible, ) -from proselint.checks.spelling.ally_ly import register_with as register_ally_ly +from proselint.checks.spelling.ally_ly import __register__ as register_ally_ly from proselint.checks.spelling.ance_ence import ( - register_with as register_ance_ence, + __register__ as register_ance_ence, ) from proselint.checks.spelling.athletes import ( - register_with as register_athletes, + __register__ as register_athletes, ) -from proselint.checks.spelling.ely_ly import register_with as register_ely_ly +from proselint.checks.spelling.ely_ly import __register__ as register_ely_ly from proselint.checks.spelling.em_im_en_in import ( - register_with as register_em_im_en_in, + __register__ as register_em_im_en_in, ) -from proselint.checks.spelling.er_or import register_with as register_er_or -from proselint.checks.spelling.in_un import register_with as register_in_un -from proselint.checks.spelling.misc import register_with as register_misc -from proselint.checks.spelling.ve_of import register_with as register_ve_of +from proselint.checks.spelling.er_or import __register__ as register_er_or +from proselint.checks.spelling.in_un import __register__ as register_in_un +from proselint.checks.spelling.misc import __register__ as register_misc +from proselint.checks.spelling.ve_of import __register__ as register_ve_of - -def register_with(registry: CheckRegistry) -> None: - """Register the checks.""" - register_able_atable(registry) - register_able_ible(registry) - register_ally_ly(registry) - register_ance_ence(registry) - register_athletes(registry) - register_ely_ly(registry) - register_em_im_en_in(registry) - register_er_or(registry) - register_in_un(registry) - register_misc(registry) - register_ve_of(registry) +__register__ = ( + *register_able_atable, + *register_able_ible, + *register_ally_ly, + *register_ance_ence, + *register_athletes, + *register_ely_ly, + *register_em_im_en_in, + *register_er_or, + *register_in_un, + *register_misc, + *register_ve_of, +) diff --git a/proselint/checks/spelling/able_atable.py b/proselint/checks/spelling/able_atable.py index cbd2a1cfc..956927ed3 100644 --- a/proselint/checks/spelling/able_atable.py +++ b/proselint/checks/spelling/able_atable.py @@ -2,7 +2,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, PreferredFormsSimple +from proselint.checks import CheckSpec, PreferredFormsSimple examples_pass = [ "Smoke phrase with nothing flagged.", @@ -87,7 +87,4 @@ "-able vs. -atable. '{}' is the preferred spelling.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/spelling/able_ible.py b/proselint/checks/spelling/able_ible.py index 1759ef6c0..c1380aa62 100644 --- a/proselint/checks/spelling/able_ible.py +++ b/proselint/checks/spelling/able_ible.py @@ -2,7 +2,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, PreferredFormsSimple +from proselint.checks import CheckSpec, PreferredFormsSimple examples_pass = [ "Smoke phrase with nothing flagged.", @@ -175,7 +175,4 @@ "-able vs. -ible. '{}' is the preferred spelling.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/spelling/ally_ly.py b/proselint/checks/spelling/ally_ly.py index 8fae34a5f..6ac22e141 100644 --- a/proselint/checks/spelling/ally_ly.py +++ b/proselint/checks/spelling/ally_ly.py @@ -2,7 +2,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, PreferredFormsSimple +from proselint.checks import CheckSpec, PreferredFormsSimple examples_pass = [ "Smoke phrase with nothing flagged.", @@ -27,7 +27,4 @@ "-ally vs. -ly. '{}' is the correct spelling.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/spelling/ance_ence.py b/proselint/checks/spelling/ance_ence.py index 86ec4a8e1..96dd2edf2 100644 --- a/proselint/checks/spelling/ance_ence.py +++ b/proselint/checks/spelling/ance_ence.py @@ -2,7 +2,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, PreferredFormsSimple +from proselint.checks import CheckSpec, PreferredFormsSimple examples_pass = [ "Smoke phrase with nothing flagged.", @@ -22,7 +22,4 @@ "-ance vs. -ence. '{}' is the correct spelling.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/spelling/athletes.py b/proselint/checks/spelling/athletes.py index bd8f76e84..31bb591a6 100644 --- a/proselint/checks/spelling/athletes.py +++ b/proselint/checks/spelling/athletes.py @@ -17,7 +17,6 @@ from __future__ import annotations from proselint.checks import ( - CheckRegistry, CheckSpec, PreferredForms, PreferredFormsSimple, @@ -65,10 +64,7 @@ msg, ) - -def register_with(registry: CheckRegistry) -> None: - """Register the checks.""" - registry.register_many(( - check, - check_regex, - )) +__register__ = ( + check, + check_regex, +) diff --git a/proselint/checks/spelling/ely_ly.py b/proselint/checks/spelling/ely_ly.py index 0085d752a..261d757d7 100644 --- a/proselint/checks/spelling/ely_ly.py +++ b/proselint/checks/spelling/ely_ly.py @@ -2,7 +2,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, PreferredFormsSimple +from proselint.checks import CheckSpec, PreferredFormsSimple examples_pass = [ "Smoke phrase with nothing flagged.", @@ -22,7 +22,4 @@ "-ely vs. -ly. '{}' is the correct spelling.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/spelling/em_im_en_in.py b/proselint/checks/spelling/em_im_en_in.py index 4bdbfe727..39a03f2d7 100644 --- a/proselint/checks/spelling/em_im_en_in.py +++ b/proselint/checks/spelling/em_im_en_in.py @@ -2,7 +2,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, PreferredFormsSimple +from proselint.checks import CheckSpec, PreferredFormsSimple examples_pass = [ "Smoke phrase with nothing flagged.", @@ -68,7 +68,4 @@ "em-, im-, en-, and in-. '{}' is the preferred spelling.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/spelling/er_or.py b/proselint/checks/spelling/er_or.py index 6f94dcadb..5e80e60e9 100644 --- a/proselint/checks/spelling/er_or.py +++ b/proselint/checks/spelling/er_or.py @@ -2,7 +2,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, PreferredFormsSimple +from proselint.checks import CheckSpec, PreferredFormsSimple examples_pass = [ "Smoke phrase with nothing flagged.", @@ -43,7 +43,4 @@ "-er vs. -or. '{}' is the preferred spelling.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/spelling/in_un.py b/proselint/checks/spelling/in_un.py index 57df4f27d..6cbd38bf0 100644 --- a/proselint/checks/spelling/in_un.py +++ b/proselint/checks/spelling/in_un.py @@ -2,7 +2,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, PreferredFormsSimple +from proselint.checks import CheckSpec, PreferredFormsSimple examples_pass = [ "Smoke phrase with nothing flagged.", @@ -24,7 +24,4 @@ "in- vs. un-. '{}' is the preferred spelling.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/spelling/misc.py b/proselint/checks/spelling/misc.py index dd8442bde..219c2dd41 100644 --- a/proselint/checks/spelling/misc.py +++ b/proselint/checks/spelling/misc.py @@ -17,7 +17,6 @@ from __future__ import annotations from proselint.checks import ( - CheckRegistry, CheckSpec, Pd, PreferredFormsSimple, @@ -180,7 +179,7 @@ "Misspelling. '{}' is the preferred spelling.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the checks.""" - registry.register_many((check, check_special)) +__register__ = ( + check, + check_special, +) diff --git a/proselint/checks/spelling/ve_of.py b/proselint/checks/spelling/ve_of.py index c7809b9bd..9500be84e 100644 --- a/proselint/checks/spelling/ve_of.py +++ b/proselint/checks/spelling/ve_of.py @@ -2,7 +2,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, PreferredFormsSimple +from proselint.checks import CheckSpec, PreferredFormsSimple examples_pass = [ "Smoke phrase with nothing flagged.", @@ -22,7 +22,4 @@ "-ve vs. -of. '{}' is the preferred spelling.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/terms/__init__.py b/proselint/checks/terms/__init__.py index 69d468f8a..0a10a1c11 100644 --- a/proselint/checks/terms/__init__.py +++ b/proselint/checks/terms/__init__.py @@ -1,21 +1,19 @@ """Terms.""" -from proselint.checks import CheckRegistry from proselint.checks.terms.animal_adjectives import ( - register_with as register_animal_adjectives, + __register__ as register_animal_adjectives, ) from proselint.checks.terms.denizen_labels import ( - register_with as register_denizen_labels, + __register__ as register_denizen_labels, ) from proselint.checks.terms.eponymous_adjectives import ( - register_with as register_eponymous_adjectives, + __register__ as register_eponymous_adjectives, ) -from proselint.checks.terms.venery import register_with as register_venery +from proselint.checks.terms.venery import __register__ as register_venery - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - register_animal_adjectives(registry) - register_denizen_labels(registry) - register_eponymous_adjectives(registry) - register_venery(registry) +__register__ = ( + *register_animal_adjectives, + *register_denizen_labels, + *register_eponymous_adjectives, + *register_venery, +) diff --git a/proselint/checks/terms/animal_adjectives.py b/proselint/checks/terms/animal_adjectives.py index 96817f482..b72d5cf15 100644 --- a/proselint/checks/terms/animal_adjectives.py +++ b/proselint/checks/terms/animal_adjectives.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, PreferredFormsSimple +from proselint.checks import CheckSpec, PreferredFormsSimple examples_pass = [ "Smoke phrase with nothing flagged.", @@ -79,7 +79,4 @@ "There's a word for this: '{}'.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/terms/denizen_labels.py b/proselint/checks/terms/denizen_labels.py index f1437fa59..a706a8748 100644 --- a/proselint/checks/terms/denizen_labels.py +++ b/proselint/checks/terms/denizen_labels.py @@ -2,7 +2,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, PreferredFormsSimple +from proselint.checks import CheckSpec, PreferredFormsSimple examples_pass = [ "Smoke phrase with nothing flagged.", @@ -94,10 +94,7 @@ "Would you like '{}'?", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the checks.""" - registry.register_many(( - check, - check_denizen_labels_norris, - )) +__register__ = ( + check, + check_denizen_labels_norris, +) diff --git a/proselint/checks/terms/eponymous_adjectives.py b/proselint/checks/terms/eponymous_adjectives.py index 5940a53c1..db1cebdef 100644 --- a/proselint/checks/terms/eponymous_adjectives.py +++ b/proselint/checks/terms/eponymous_adjectives.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, PreferredFormsSimple +from proselint.checks import CheckSpec, PreferredFormsSimple examples_pass = [ "Smoke phrase with nothing flagged.", @@ -35,7 +35,4 @@ "'{}' is the preferred eponymous adjective.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/terms/venery.py b/proselint/checks/terms/venery.py index 6faef6857..9b706c11d 100644 --- a/proselint/checks/terms/venery.py +++ b/proselint/checks/terms/venery.py @@ -19,7 +19,6 @@ import re from proselint.checks import ( - CheckRegistry, CheckResult, CheckSpec, preferred_forms_check_opti, @@ -119,7 +118,4 @@ def _check(text: str) -> list[CheckResult]: "The venery term is '{}'.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/typography/__init__.py b/proselint/checks/typography/__init__.py index 8d336771b..3e016f80e 100644 --- a/proselint/checks/typography/__init__.py +++ b/proselint/checks/typography/__init__.py @@ -1,19 +1,17 @@ """Advice on typography.""" -from proselint.checks import CheckRegistry from proselint.checks.typography.diacritical_marks import ( - register_with as register_diacritical_marks, + __register__ as register_diacritical_marks, ) from proselint.checks.typography.exclamation import ( - register_with as register_exclamation, + __register__ as register_exclamation, ) from proselint.checks.typography.symbols import ( - register_with as register_symbols, + __register__ as register_symbols, ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - register_diacritical_marks(registry) - register_exclamation(registry) - register_symbols(registry) +__register__ = ( + *register_diacritical_marks, + *register_exclamation, + *register_symbols, +) diff --git a/proselint/checks/typography/diacritical_marks.py b/proselint/checks/typography/diacritical_marks.py index de1291556..ed6fe09b8 100644 --- a/proselint/checks/typography/diacritical_marks.py +++ b/proselint/checks/typography/diacritical_marks.py @@ -6,7 +6,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, PreferredFormsSimple +from proselint.checks import CheckSpec, PreferredFormsSimple examples_pass = [ "Smoke phrase with nothing flagged.", @@ -116,7 +116,4 @@ "Use diacritical marks in '{}'.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/typography/exclamation.py b/proselint/checks/typography/exclamation.py index f06e591f4..10c42733f 100644 --- a/proselint/checks/typography/exclamation.py +++ b/proselint/checks/typography/exclamation.py @@ -18,7 +18,6 @@ from proselint.checks import ( CheckFlags, - CheckRegistry, CheckSpec, Existence, Pd, @@ -57,10 +56,7 @@ flags=CheckFlags(ppm_threshold=30), ) - -def register_with(registry: CheckRegistry) -> None: - """Register the checks.""" - registry.register_many(( - check_repeated_exclamations, - check_exclamations_ppm, - )) +__register__ = ( + check_repeated_exclamations, + check_exclamations_ppm, +) diff --git a/proselint/checks/typography/symbols.py b/proselint/checks/typography/symbols.py index 1ed01828e..f051e2217 100644 --- a/proselint/checks/typography/symbols.py +++ b/proselint/checks/typography/symbols.py @@ -9,7 +9,6 @@ from proselint.checks import ( CheckFlags, - CheckRegistry, CheckResult, CheckSpec, Existence, @@ -153,16 +152,13 @@ def _check_apostrophes(text: str) -> list[CheckResult]: "Use the correct apostrophe - 's is preferred - ´s is ok", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the checks.""" - registry.register_many(( - check_ellipsis, - check_copyright_symbol, - check_trademark_symbol, - check_registered_trademark_symbol, - check_sentence_spacing, - check_multiplication_symbol, - check_curly_quotes, - check_apostrophes, - )) +__register__ = ( + check_ellipsis, + check_copyright_symbol, + check_trademark_symbol, + check_registered_trademark_symbol, + check_sentence_spacing, + check_multiplication_symbol, + check_curly_quotes, + check_apostrophes, +) diff --git a/proselint/checks/uncomparables/__init__.py b/proselint/checks/uncomparables/__init__.py index 48abb238b..034dc757f 100644 --- a/proselint/checks/uncomparables/__init__.py +++ b/proselint/checks/uncomparables/__init__.py @@ -1,5 +1,5 @@ """Comparing an uncomparable.""" -from proselint.checks.uncomparables.misc import register_with +from proselint.checks.uncomparables.misc import __register__ -__all__ = ["register_with"] +__all__ = ["__register__"] diff --git a/proselint/checks/uncomparables/misc.py b/proselint/checks/uncomparables/misc.py index d7bee22df..9a3a675d9 100644 --- a/proselint/checks/uncomparables/misc.py +++ b/proselint/checks/uncomparables/misc.py @@ -49,7 +49,7 @@ import itertools -from proselint.checks import CheckRegistry, CheckSpec, Existence +from proselint.checks import CheckSpec, Existence examples_pass = [ "Smoke phrase with nothing flagged.", @@ -150,10 +150,7 @@ def compile_uncomparables() -> list[str]: msg, ) - -def register_with(registry: CheckRegistry) -> None: - """Register the checks.""" - registry.register_many(( - check_1, - check_2, - )) +__register__ = ( + check_1, + check_2, +) diff --git a/proselint/checks/weasel_words/__init__.py b/proselint/checks/weasel_words/__init__.py index d420673a8..399742ef7 100644 --- a/proselint/checks/weasel_words/__init__.py +++ b/proselint/checks/weasel_words/__init__.py @@ -1,11 +1,9 @@ """Weasel words.""" -from proselint.checks import CheckRegistry -from proselint.checks.weasel_words.misc import register_with as register_misc -from proselint.checks.weasel_words.very import register_with as register_very +from proselint.checks.weasel_words.misc import __register__ as register_misc +from proselint.checks.weasel_words.very import __register__ as register_very - -def register_with(registry: CheckRegistry) -> None: - """Register the checks.""" - register_misc(registry) - register_very(registry) +__register__ = ( + *register_misc, + *register_very, +) diff --git a/proselint/checks/weasel_words/misc.py b/proselint/checks/weasel_words/misc.py index 2545ce89f..802b5acd5 100644 --- a/proselint/checks/weasel_words/misc.py +++ b/proselint/checks/weasel_words/misc.py @@ -16,7 +16,7 @@ from __future__ import annotations -from proselint.checks import CheckRegistry, CheckSpec, Existence +from proselint.checks import CheckSpec, Existence examples_pass = [ "Smoke phrase with nothing flagged.", @@ -47,7 +47,4 @@ "Weasel words, AKA anonymous authority, present in '{}'.", ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,) diff --git a/proselint/checks/weasel_words/very.py b/proselint/checks/weasel_words/very.py index 9fffdcce3..b771f6085 100644 --- a/proselint/checks/weasel_words/very.py +++ b/proselint/checks/weasel_words/very.py @@ -19,7 +19,6 @@ from proselint.checks import ( CheckFlags, - CheckRegistry, CheckSpec, Existence, ) @@ -42,7 +41,4 @@ flags=CheckFlags(limit_results=1), ) - -def register_with(registry: CheckRegistry) -> None: - """Register the check.""" - registry.register(check) +__register__ = (check,)