2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-02 11:40:58 +00:00

Fix common spelling mistakes (#4956)

* add codespell

* first fixes

* doc fixes

* fix docstrings and comments

* functional changes

* docstrings again

* and docs again

* rename args

* add ignore

* use pre-commit for filtering instead

* ups

* fix typo in filter
This commit is contained in:
Matthias Mair
2023-06-03 16:04:52 +02:00
committed by GitHub
parent 5e2bfaa43a
commit 21ed4b2081
161 changed files with 344 additions and 334 deletions

View File

@ -45,7 +45,7 @@ class WebhookView(CsrfExemptMixin, APIView):
run_async = False
def post(self, request, endpoint, *args, **kwargs):
"""Process incomming webhook."""
"""Process incoming webhook."""
# get webhook definition
self._get_webhook(endpoint, request, *args, **kwargs)
@ -164,7 +164,7 @@ class CurrencyRefreshView(APIView):
class SettingsList(ListAPI):
"""Generic ListView for settings.
This is inheritted by all list views for settings.
This is inherited by all list views for settings.
"""
filter_backends = SEARCH_ORDER_FILTER

View File

@ -84,7 +84,7 @@ class FileManager:
self.HEADERS = self.REQUIRED_HEADERS + self.ITEM_MATCH_HEADERS + self.OPTIONAL_MATCH_HEADERS + self.OPTIONAL_HEADERS
def setup(self):
"""Setup headers should be overriden in usage to set the Different Headers."""
"""Setup headers should be overridden in usage to set the Different Headers."""
if not self.name:
return

View File

@ -46,7 +46,7 @@ class MatchFieldForm(forms.Form):
"""Step 2 of FileManagementFormView."""
def __init__(self, *args, **kwargs):
"""Setup filemanager and check columsn."""
"""Setup filemanager and check columns."""
# Get FileManager
file_manager = None
if 'file_manager' in kwargs:
@ -106,7 +106,7 @@ class MatchItemForm(forms.Form):
# Set field name
field_name = col_guess.lower() + '-' + str(row['index'])
# check if field def was overriden
# check if field def was overridden
overriden_field = self.get_special_field(col_guess, row, file_manager)
if overriden_field:
self.fields[field_name] = overriden_field
@ -174,5 +174,5 @@ class MatchItemForm(forms.Form):
)
def get_special_field(self, col_guess, row, file_manager):
"""Function to be overriden in inherited forms to add specific form settings."""
"""Function to be overridden in inherited forms to add specific form settings."""
return None

View File

@ -2395,7 +2395,7 @@ class WebhookEndpoint(models.Model):
self.verify = self.VERIFICATION_METHOD
def process_webhook(self):
"""Process the webhook incomming.
"""Process the webhook incoming.
This does not deal with the data itself - that happens in process_payload.
Do not touch or pickle data here - it was not verified to be safe.
@ -2532,7 +2532,7 @@ class WebhookMessage(models.Model):
class NotificationEntry(MetaMixin):
"""A NotificationEntry records the last time a particular notifaction was sent out.
"""A NotificationEntry records the last time a particular notification was sent out.
It is recorded to ensure that notifications are not sent out "too often" to users.

View File

@ -62,11 +62,11 @@ class NotificationMethod:
def check_context(self, context):
"""Check that all values defined in the methods CONTEXT were provided in the current context."""
def check(ref, obj):
# the obj is not accesible so we are on the end
# the obj is not accessible so we are on the end
if not isinstance(obj, (list, dict, tuple, )):
return ref
# check if the ref exsists
# check if the ref exists
if isinstance(ref, str):
if not obj.get(ref):
return ref
@ -150,16 +150,16 @@ class SingleNotificationMethod(NotificationMethod):
"""NotificationMethod that sends notifications one by one."""
def send(self, target):
"""This function must be overriden."""
raise NotImplementedError('The `send` method must be overriden!')
"""This function must be overridden."""
raise NotImplementedError('The `send` method must be overridden!')
class BulkNotificationMethod(NotificationMethod):
"""NotificationMethod that sends all notifications in bulk."""
def send_bulk(self):
"""This function must be overriden."""
raise NotImplementedError('The `send` method must be overriden!')
"""This function must be overridden."""
raise NotImplementedError('The `send` method must be overridden!')
# endregion
@ -268,7 +268,7 @@ class NotificationBody:
message (str): Notification message as text. Should not be longer than 120 chars.
template (str): Reference to the html template for the notification.
The strings support f-string sytle fomratting with context variables parsed at runtime.
The strings support f-string style formatting with context variables parsed at runtime.
Context variables:
instance: Text representing the instance

View File

@ -57,7 +57,7 @@ def update_news_feed():
# Iterate over entries
for entry in d.entries:
# Check if id already exsists
# Check if id already exists
if entry.id in id_list:
continue

View File

@ -47,7 +47,7 @@ class BaseNotificationTests(BaseNotificationIntegrationTest):
with self.assertRaises(NotImplementedError):
NoNameNotificationMethod('', '', '', '', )
# a not existant context check
# a not existent context check
with self.assertRaises(NotImplementedError):
WrongContextNotificationMethod('', '', '', '', )
@ -149,7 +149,7 @@ class NotificationUserSettingTests(BaseNotificationIntegrationTest):
def send_bulk(self):
return True
# run thorugh notification
# run through notification
self._notification_run(SampleImplementation)
# make sure the array fits
array = storage.get_usersettings(self.user)

View File

@ -272,7 +272,7 @@ class GlobalSettingsApiTest(InvenTreeAPITestCase):
self.assertEqual(len(response.data), len(InvenTreeSetting.SETTINGS.keys()))
def test_company_name(self):
"""Test a settings object lifecyle e2e."""
"""Test a settings object lifecycle e2e."""
setting = InvenTreeSetting.get_setting_object('INVENTREE_COMPANY_NAME')
# Check default value
@ -781,7 +781,7 @@ class NotificationTest(InvenTreeAPITestCase):
for _ii in range(10):
Error.objects.create()
# Check that messsages have been created
# Check that messages have been created
messages = NotificationMessage.objects.all()
# As there are three staff users (including the 'test' user) we expect 30 notifications
@ -860,7 +860,7 @@ class CommonTest(InvenTreeAPITestCase):
self.user.is_superuser = True
self.user.save()
# Successfull checks
# Successful checks
data = [
self.get(reverse('api-config-list'), expected_code=200).data[0], # list endpoint
self.get(reverse('api-config-detail', kwargs={'key': 'INVENTREE_DEBUG'}), expected_code=200).data, # detail endpoint