2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-01 03:00:54 +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

@ -364,7 +364,7 @@ class StockFilter(rest_filters.FilterSet):
]
# Relationship filters
manufactuer = rest_filters.ModelChoiceFilter(label='Manufacturer', queryset=Company.objects.filter(is_manufacturer=True), field_name='manufacturer_part__manufacturer')
manufacturer = rest_filters.ModelChoiceFilter(label='Manufacturer', queryset=Company.objects.filter(is_manufacturer=True), field_name='manufacturer_part__manufacturer')
supplier = rest_filters.ModelChoiceFilter(label='Supplier', queryset=Company.objects.filter(is_supplier=True), field_name='supplier_part__supplier')
# Part name filters
@ -827,7 +827,7 @@ class StockList(APIDownloadMixin, ListCreateDestroyAPIView):
"""
Determine the response type based on the request.
a) For HTTP requests (e.g. via the browseable API) return a DRF response
a) For HTTP requests (e.g. via the browsable API) return a DRF response
b) For AJAX requests, simply return a JSON rendered response.
Note: b) is about 100x quicker than a), because the DRF framework adds a lot of cruft

View File

@ -25,8 +25,8 @@ def delete_scheduled(apps, schema_editor):
# Ensure any parent / child relationships are updated!
for item in items:
childs = StockItem.objects.filter(parent=item)
childs.update(parent=item.parent)
children = StockItem.objects.filter(parent=item)
children.update(parent=item.parent)
item.delete()

View File

@ -26,7 +26,7 @@ def update_stock_history(apps, schema_editor):
n = 0
for item in items:
# Find newest relevent history
# Find newest relevant history
history = StockItemTracking.objects.filter(
item=item,
tracking_type__in=[StockHistoryCode.SENT_TO_CUSTOMER, StockHistoryCode.SHIPPED_AGAINST_SALES_ORDER]

View File

@ -256,7 +256,7 @@ def generate_batch_code():
now = datetime.now()
# Pass context data through to the template randering.
# The folowing context variables are availble for custom batch code generation
# The following context variables are available for custom batch code generation
context = {
'date': now,
'year': now.year,
@ -624,7 +624,7 @@ class StockItem(InvenTreeBarcodeMixin, InvenTreeNotesMixin, MetadataMixin, commo
except PartModels.Part.DoesNotExist:
# This gets thrown if self.supplier_part is null
# TODO - Find a test than can be perfomed...
# TODO - Find a test than can be performed...
pass
# Ensure that the item cannot be assigned to itself
@ -2109,7 +2109,7 @@ class StockItemTracking(models.Model):
"""Stock tracking entry - used for tracking history of a particular StockItem.
Note: 2021-05-11
The legacy StockTrackingItem model contained very litle information about the "history" of the item.
The legacy StockTrackingItem model contained very little information about the "history" of the item.
In fact, only the "quantity" of the item was recorded at each interaction.
Also, the "title" was translated at time of generation, and thus was not really translateable.
The "new" system tracks all 'delta' changes to the model,

View File

@ -1241,7 +1241,7 @@ class StockTestResultTest(StockAPITestCase):
"""Tests for StockTestResult APIs."""
def get_url(self):
"""Helper funtion to get test-result api url."""
"""Helper function to get test-result api url."""
return reverse('api-stock-test-result-list')
def test_list(self):

View File

@ -97,16 +97,16 @@ class StockOwnershipTest(StockViewTestCase):
InvenTreeSetting.set_setting('STOCK_OWNERSHIP_CONTROL', True, self.user)
self.assertEqual(True, InvenTreeSetting.get_setting('STOCK_OWNERSHIP_CONTROL'))
def assert_ownership(self, assertio: bool = True, user=None):
def assert_ownership(self, assertion: bool = True, user=None):
"""Helper function to check ownership control."""
if user is None:
user = self.user
item = StockItem.objects.get(pk=self.test_item_id)
self.assertEqual(assertio, item.check_ownership(user))
self.assertEqual(assertion, item.check_ownership(user))
location = StockLocation.objects.get(pk=self.test_location_id)
self.assertEqual(assertio, location.check_ownership(user))
self.assertEqual(assertion, location.check_ownership(user))
def assert_api_change(self):
"""Helper function to get response to API change."""

View File

@ -51,7 +51,7 @@ class StockTestBase(InvenTreeTestCase):
class StockTest(StockTestBase):
"""Tests to ensure that the stock location tree functions correcly."""
"""Tests to ensure that the stock location tree functions correctly."""
def test_pathstring(self):
"""Check that pathstring updates occur as expected"""
@ -145,7 +145,7 @@ class StockTest(StockTestBase):
item.save()
item.full_clean()
# Check that valid URLs pass - and check custon schemes
# Check that valid URLs pass - and check custom schemes
for good_url in [
'https://test.com',
'https://digikey.com/datasheets?file=1010101010101.bin',
@ -309,12 +309,12 @@ class StockTest(StockTestBase):
self.assertFalse(self.drawer2.has_children)
childs = [item.pk for item in self.office.getUniqueChildren()]
children = [item.pk for item in self.office.getUniqueChildren()]
self.assertIn(self.drawer1.id, childs)
self.assertIn(self.drawer2.id, childs)
self.assertIn(self.drawer1.id, children)
self.assertIn(self.drawer2.id, children)
self.assertNotIn(self.bathroom.id, childs)
self.assertNotIn(self.bathroom.id, children)
def test_items(self):
"""Test has_items."""
@ -646,7 +646,7 @@ class StockTest(StockTestBase):
self.assertEqual(item.serial_int, 0)
# Next, test for incremenet / decrement functionality
# Next, test for increment / decrement functionality
item.serial = 100
item.save()
@ -754,7 +754,7 @@ class StockTest(StockTestBase):
"""Unit tests for stock location tree structure (MPTT).
Ensure that the MPTT structure is rebuilt correctly,
and the corrent ancestor tree is observed.
and the current ancestor tree is observed.
Ref: https://github.com/inventree/InvenTree/issues/2636
Ref: https://github.com/inventree/InvenTree/issues/2733
@ -1185,7 +1185,7 @@ class TestResultTest(StockTestBase):
tests = item.testResultMap(include_installed=False)
self.assertEqual(len(tests), 3)
# There are no "sub items" intalled at this stage
# There are no "sub items" installed at this stage
tests = item.testResultMap(include_installed=False)
self.assertEqual(len(tests), 3)