2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-17 04:25:42 +00:00

Code style improvements (#4683)

* fix list comps

* mopre comp fixes

* reduce computing cost on any() calls

* add bugbear

* check for clean imports

* only allow limited relative imports

* fix notification method lookup

* fix notification method assigement

* rewrite assigment

* fix upstream changes to new style

* fix upstream change to new coding style
This commit is contained in:
Matthias Mair
2023-04-28 12:49:53 +02:00
committed by GitHub
parent 660a4f8e39
commit abee2cee88
44 changed files with 96 additions and 93 deletions

View File

@ -4,7 +4,7 @@ from django.contrib import admin
from import_export.admin import ImportExportModelAdmin
from import_export.fields import Field
import import_export.widgets as widgets
from import_export import widgets
from build.models import Build, BuildItem
from InvenTree.admin import InvenTreeResource

View File

@ -875,7 +875,7 @@ class Build(MPTTModel, InvenTree.models.InvenTreeBarcodeMixin, InvenTree.models.
# Filter by list of available parts
available_stock = available_stock.filter(
part__in=[p for p in available_parts],
part__in=list(available_parts),
)
# Filter out "serialized" stock items, these cannot be auto-allocated
@ -884,12 +884,12 @@ class Build(MPTTModel, InvenTree.models.InvenTreeBarcodeMixin, InvenTree.models.
if location:
# Filter only stock items located "below" the specified location
sublocations = location.get_descendants(include_self=True)
available_stock = available_stock.filter(location__in=[loc for loc in sublocations])
available_stock = available_stock.filter(location__in=list(sublocations))
if exclude_location:
# Exclude any stock items from the provided location
sublocations = exclude_location.get_descendants(include_self=True)
available_stock = available_stock.exclude(location__in=[loc for loc in sublocations])
available_stock = available_stock.exclude(location__in=list(sublocations))
"""
Next, we sort the available stock items with the following priority: