From 3b4a5b703e40cbb2ef806aacc2435898028b5923 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Thu, 18 Apr 2024 09:29:15 +0200 Subject: [PATCH] chore: apply codespell suggestions Once https://github.com/codespell-project/codespell/pull/2400 is releases we should annotate all remaining strings and include codespell in pre-commit. --- pyproject.toml | 3 ++- weblate/accounts/forms.py | 2 +- weblate/accounts/migrations/0001_squashed_weblate_5.py | 2 +- weblate/accounts/notifications.py | 2 +- weblate/auth/management/commands/createadmin.py | 2 +- weblate/checks/fluent/inner_html.py | 2 +- weblate/checks/tests/test_chars_checks.py | 8 ++++---- weblate/gitexport/views.py | 2 +- weblate/lang/models.py | 4 ++-- weblate/machinery/dummy.py | 4 ++-- weblate/screenshots/forms.py | 2 +- weblate/templates/machinery/list.html | 2 +- weblate/trans/models/change.py | 2 +- weblate/trans/models/component.py | 8 ++++---- weblate/trans/models/unit.py | 2 +- weblate/trans/tests/test_edit.py | 2 +- weblate/trans/tests/test_middleware.py | 2 +- weblate/trans/util.py | 2 +- weblate/trans/validators.py | 4 ++-- weblate/utils/db.py | 2 +- weblate/vcs/gpg.py | 2 +- 21 files changed, 31 insertions(+), 30 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 4fc89d4c2995..02c0c1ee1e9a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -196,7 +196,8 @@ Twitter = "https://twitter.com/WeblateOrg" target-version = ['py310'] [tool.codespell] -skip = '*.po,*.pot,*.json,*.tmx,*.tbx,yarn.lock,known_hosts' +count = true +skip = '*.po,*.pot,*.json,*.tmx,*.tbx,*.csv,yarn.lock,known_hosts,*/vendor/*' [tool.django-stubs] django_settings_module = "weblate.settings_example" diff --git a/weblate/accounts/forms.py b/weblate/accounts/forms.py index 4c03d0ef5632..39203703df81 100644 --- a/weblate/accounts/forms.py +++ b/weblate/accounts/forms.py @@ -181,7 +181,7 @@ class CommitForm(ProfileBaseForm): label=gettext_lazy("Commit e-mail"), choices=[("", gettext_lazy("Use account e-mail address"))], help_text=gettext_lazy( - "Used in version control commits. The address will stay in the repository forever once changes are commited by Weblate." + "Used in version control commits. The address will stay in the repository forever once changes are committed by Weblate." ), required=False, widget=forms.RadioSelect, diff --git a/weblate/accounts/migrations/0001_squashed_weblate_5.py b/weblate/accounts/migrations/0001_squashed_weblate_5.py index 46d41b65d12d..a03dba056c7e 100644 --- a/weblate/accounts/migrations/0001_squashed_weblate_5.py +++ b/weblate/accounts/migrations/0001_squashed_weblate_5.py @@ -425,7 +425,7 @@ class Migration(migrations.Migration): ), ("LockNotification", "Component was locked or unlocked"), ("LicenseNotification", "License was changed"), - ("ParseErrorNotification", "Parse error occured"), + ("ParseErrorNotification", "Parse error occurred"), ( "NewStringNotificaton", "New string is available for translation", diff --git a/weblate/accounts/notifications.py b/weblate/accounts/notifications.py index 8790787de234..886911eeac57 100644 --- a/weblate/accounts/notifications.py +++ b/weblate/accounts/notifications.py @@ -477,7 +477,7 @@ class LicenseNotification(Notification): @register_notification class ParseErrorNotification(Notification): actions = (Change.ACTION_PARSE_ERROR,) - verbose = pgettext_lazy("Notification name", "Parse error occured") + verbose = pgettext_lazy("Notification name", "Parse error occurred") template_name = "parse_error" def get_context( diff --git a/weblate/auth/management/commands/createadmin.py b/weblate/auth/management/commands/createadmin.py index f7a816fe6bb2..635266718b9f 100644 --- a/weblate/auth/management/commands/createadmin.py +++ b/weblate/auth/management/commands/createadmin.py @@ -66,7 +66,7 @@ def handle(self, *args, **options) -> None: else: for user in matching_users: self.stderr.write( - f"Found maching user: username={user.username} email={user.email}" + f"Found matching user: username={user.username} email={user.email}" ) raise CommandError("Multiple users matched given parameters!") diff --git a/weblate/checks/fluent/inner_html.py b/weblate/checks/fluent/inner_html.py index 70db6e194ede..2888670a6899 100644 --- a/weblate/checks/fluent/inner_html.py +++ b/weblate/checks/fluent/inner_html.py @@ -620,7 +620,7 @@ def _parse_end_tag( """Parse an end tag, starting after the " None: def test_arabic(self) -> None: self.assertTrue( self.check.check_target( - ["", "Lorem ipsum dolor sit amet."], + ["", "Lorem ipsum dolor sit amet."], ["zero", "one", "two", "few", "many", "other"], MockUnit(code="ar"), ) ) self.assertFalse( self.check.check_target( - ["", "Lorem ipsum dolor sit amet."], + ["", "Lorem ipsum dolor sit amet."], ["zero.", "one", "two.", "few.", "many.", "other."], MockUnit(code="ar"), ) @@ -114,14 +114,14 @@ def test_japanese(self) -> None: self.do_test(True, ("Text:", "Text", ""), "ja") self.assertTrue( self.check.check_target( - ["", "English."], + ["", "English."], ["Japanese…"], MockUnit(code="ja"), ) ) self.assertFalse( self.check.check_target( - ["", "English."], + ["", "English."], ["Japanese。"], MockUnit(code="ja"), ) diff --git a/weblate/gitexport/views.py b/weblate/gitexport/views.py index c256a181d254..9e8621cfdc18 100644 --- a/weblate/gitexport/views.py +++ b/weblate/gitexport/views.py @@ -226,7 +226,7 @@ def get_response(self): if "status" in message: return HttpResponse(status=int(message["status"].split()[0])) - # Send streaming content as reponse + # Send streaming content as response return StreamingHttpResponse( streaming_content=self.stream(), content_type=message["content-type"] ) diff --git a/weblate/lang/models.py b/weblate/lang/models.py index 99ce05e119ce..364ec5771fde 100644 --- a/weblate/lang/models.py +++ b/weblate/lang/models.py @@ -996,11 +996,11 @@ def map_units(self, units) -> None: def zip(self, sources, targets, unit): if len(sources) != self.source_plural.number: raise ValueError( - "length of `sources` does't match the number of source plurals" + "length of `sources` doesn't match the number of source plurals" ) if len(targets) != self.target_plural.number: raise ValueError( - "length of `targets` does't match the number of target plurals" + "length of `targets` doesn't match the number of target plurals" ) if self.same_plurals: return zip(sources, targets, strict=True) diff --git a/weblate/machinery/dummy.py b/weblate/machinery/dummy.py index e0b0f42dbe6a..3f1ab4282617 100644 --- a/weblate/machinery/dummy.py +++ b/weblate/machinery/dummy.py @@ -12,7 +12,7 @@ class DummyTranslation(MachineTranslation): def download_languages(self): """ - List supported languges. + List supported languages. Dummy translation supports just Czech language. """ @@ -28,7 +28,7 @@ def download_translations( threshold: int = 75, ) -> DownloadTranslations: """ - Donwload translations. + Download translations. Dummy translation supports just few phrases. """ diff --git a/weblate/screenshots/forms.py b/weblate/screenshots/forms.py index 3d6e41048a18..323331b78097 100644 --- a/weblate/screenshots/forms.py +++ b/weblate/screenshots/forms.py @@ -47,7 +47,7 @@ def __init__( pk__in=(initial["translation"].pk, component.source_translation.pk) ) self.fields["translation"].queryset = translations - # This is overriden from initial arg of the form + # This is overridden from initial arg of the form self.fields["translation"].initial = component.source_translation self.fields["translation"].empty_label = None diff --git a/weblate/templates/machinery/list.html b/weblate/templates/machinery/list.html index d190052eb855..0fb3ff2c6569 100644 --- a/weblate/templates/machinery/list.html +++ b/weblate/templates/machinery/list.html @@ -30,7 +30,7 @@ {% include 'machinery/detail.html' %} - {% if service.is_enabled or not serivce.is_available %} + {% if service.is_enabled or not service.is_available %}
{% csrf_token %}
{% else %}
{% csrf_token %}
diff --git a/weblate/trans/models/change.py b/weblate/trans/models/change.py index ae7a853ae149..133201632584 100644 --- a/weblate/trans/models/change.py +++ b/weblate/trans/models/change.py @@ -638,7 +638,7 @@ def save(self, *args, **kwargs) -> None: self.translation.stats.fetch_last_change() # Update stats at the end of transaction transaction.on_commit(self.update_cache_last_change) - # Make sure stats is updated at the end of trasaction + # Make sure stats is updated at the end of transaction self.translation.invalidate_cache() def get_absolute_url(self): diff --git a/weblate/trans/models/component.py b/weblate/trans/models/component.py index 30a6945b2abe..fc61c53afca7 100644 --- a/weblate/trans/models/component.py +++ b/weblate/trans/models/component.py @@ -182,7 +182,7 @@ def perform_on_link(func): - """Perfom operation on repository link.""" + """Perform operation on repository link.""" def on_link_wrapper(self, *args, **kwargs): linked = self.linked_component @@ -1909,10 +1909,10 @@ def get_repo_link_url(self): @cached_property def linked_childs(self): """Return list of components which links repository to us.""" - childs = self.component_set.prefetch() - for child in childs: + children = self.component_set.prefetch() + for child in children: child.linked_component = self - return childs + return children def get_linked_childs_for_template(self): return [ diff --git a/weblate/trans/models/unit.py b/weblate/trans/models/unit.py index 90e313906bef..770947888e58 100644 --- a/weblate/trans/models/unit.py +++ b/weblate/trans/models/unit.py @@ -394,7 +394,7 @@ class Unit(models.Model, LoggerMixin): labels = LabelsField("Label", verbose_name=gettext_lazy("Labels"), blank=True) # The type annotation hides that field can be None because - # save() updates it to non-None immediatelly. + # save() updates it to non-None immediately. source_unit: Unit = models.ForeignKey( "trans.Unit", on_delete=models.deletion.CASCADE, blank=True, null=True ) diff --git a/weblate/trans/tests/test_edit.py b/weblate/trans/tests/test_edit.py index bcd48a4967f7..71af7ec0e5fe 100644 --- a/weblate/trans/tests/test_edit.py +++ b/weblate/trans/tests/test_edit.py @@ -991,7 +991,7 @@ def test_edit_source_pending(self) -> None: # Edit source string self.edit_unit("Hello, world!\n", "Hello, beautiful world!\n", language="en") - # Force commiting source string change + # Force committing source string change self.component.commit_pending("test", None) # Translation revision should have been updated now diff --git a/weblate/trans/tests/test_middleware.py b/weblate/trans/tests/test_middleware.py index 78d7bb5271cb..4d30ead1fca3 100644 --- a/weblate/trans/tests/test_middleware.py +++ b/weblate/trans/tests/test_middleware.py @@ -73,7 +73,7 @@ def test_translation_redirect(self) -> None: self.assertIn("Hindi translation is currently not available", messages[0]) def test_redirect_category(self) -> None: - # Non existing category should be ommitted + # Non existing category should be omitted kwargs = { "path": [ self.project.slug, diff --git a/weblate/trans/util.py b/weblate/trans/util.py index 800bc0f93a94..b14a8c68c745 100644 --- a/weblate/trans/util.py +++ b/weblate/trans/util.py @@ -256,7 +256,7 @@ def render( def path_separator(path: str) -> str: """ - Consolidate path separtor. + Consolidate path separator. Always use / as path separator for consistency. """ diff --git a/weblate/trans/validators.py b/weblate/trans/validators.py index 430e29f277db..b1cc13f12388 100644 --- a/weblate/trans/validators.py +++ b/weblate/trans/validators.py @@ -24,11 +24,11 @@ def validate_filemask(val) -> None: def validate_autoaccept(val) -> None: - """Validate correct value for automatical acceptance.""" + """Validate correct value for automatic acceptance.""" if val == 1: raise ValidationError( gettext( - "A value of 1 is not allowed for automatical acceptance as " + "A value of 1 is not allowed for automatic acceptance as " "it would permit users to vote on their own suggestions." ) ) diff --git a/weblate/utils/db.py b/weblate/utils/db.py index 51a60d8463bf..83241d18f450 100644 --- a/weblate/utils/db.py +++ b/weblate/utils/db.py @@ -78,7 +78,7 @@ class PostgreSQLFallbackLookupMixin: Mixin to block PostgreSQL from using trigram index. It is ineffective for very short strings as these produce a lot of matches - which need to be rechecked and full table scan is more effecive in that + which need to be rechecked and full table scan is more effective in that case. It is performed by concatenating empty string which will prevent index usage. diff --git a/weblate/vcs/gpg.py b/weblate/vcs/gpg.py index 1e373b0eb7ff..9864608c21e3 100644 --- a/weblate/vcs/gpg.py +++ b/weblate/vcs/gpg.py @@ -71,7 +71,7 @@ def get_gpg_key(silent=False) -> str | None: gpg_error("GPG key listing", error, silent) return None for line in result.stdout.splitlines(): - if not line.startswith("fpr:"): + if not line.startswith("fpr:"): # codespell:ignore fpr continue return line.split(":")[9] return None