mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-03 13:58:47 +00:00
Flake fixes
This commit is contained in:
parent
07be08d0f3
commit
beccbe8583
@ -1,7 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import hashlib
|
|
||||||
|
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.conf.urls import url
|
from django.conf.urls import url
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
@ -11,13 +9,10 @@ from rest_framework import permissions
|
|||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework.views import APIView
|
from rest_framework.views import APIView
|
||||||
|
|
||||||
import InvenTree.plugins as InvenTreePlugins
|
|
||||||
|
|
||||||
from stock.models import StockItem
|
from stock.models import StockItem
|
||||||
from stock.serializers import StockItemSerializer
|
from stock.serializers import StockItemSerializer
|
||||||
|
|
||||||
import barcode.plugins as BarcodePlugins
|
from barcode.barcode import load_barcode_plugins, hash_barcode
|
||||||
from barcode.barcode import BarcodePlugin, load_barcode_plugins, hash_barcode
|
|
||||||
|
|
||||||
|
|
||||||
class BarcodeScan(APIView):
|
class BarcodeScan(APIView):
|
||||||
@ -233,7 +228,6 @@ class BarcodeAssign(APIView):
|
|||||||
serializer = StockItemSerializer(item, part_detail=True, location_detail=True, supplier_part_detail=True)
|
serializer = StockItemSerializer(item, part_detail=True, location_detail=True, supplier_part_detail=True)
|
||||||
response['stockitem'] = serializer.data
|
response['stockitem'] = serializer.data
|
||||||
|
|
||||||
|
|
||||||
return Response(response)
|
return Response(response)
|
||||||
|
|
||||||
|
|
||||||
@ -243,4 +237,4 @@ barcode_api_urls = [
|
|||||||
|
|
||||||
# Catch-all performs barcode 'scan'
|
# Catch-all performs barcode 'scan'
|
||||||
url(r'^.*$', BarcodeScan.as_view(), name='api-barcode-scan'),
|
url(r'^.*$', BarcodeScan.as_view(), name='api-barcode-scan'),
|
||||||
]
|
]
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import hashlib
|
import hashlib
|
||||||
import json
|
|
||||||
|
|
||||||
from InvenTree import plugins as InvenTreePlugins
|
from InvenTree import plugins as InvenTreePlugins
|
||||||
from barcode import plugins as BarcodePlugins
|
from barcode import plugins as BarcodePlugins
|
||||||
|
|
||||||
|
from stock.models import StockItem
|
||||||
from stock.serializers import StockItemSerializer, LocationSerializer
|
from stock.serializers import StockItemSerializer, LocationSerializer
|
||||||
from part.serializers import PartSerializer
|
from part.serializers import PartSerializer
|
||||||
|
|
||||||
@ -70,7 +70,6 @@ class BarcodePlugin:
|
|||||||
serializer = StockItemSerializer(item, part_detail=True, location_detail=True, supplier_part_detail=True)
|
serializer = StockItemSerializer(item, part_detail=True, location_detail=True, supplier_part_detail=True)
|
||||||
return serializer.data
|
return serializer.data
|
||||||
|
|
||||||
|
|
||||||
def getStockLocation(self):
|
def getStockLocation(self):
|
||||||
"""
|
"""
|
||||||
Attempt to retrieve a StockLocation associated with this barcode.
|
Attempt to retrieve a StockLocation associated with this barcode.
|
||||||
@ -93,7 +92,7 @@ class BarcodePlugin:
|
|||||||
Default implementation returns None
|
Default implementation returns None
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def renderPart(self, part):
|
def renderPart(self, part):
|
||||||
"""
|
"""
|
||||||
@ -145,4 +144,4 @@ def load_barcode_plugins(debug=False):
|
|||||||
else:
|
else:
|
||||||
print("No barcode plugins found")
|
print("No barcode plugins found")
|
||||||
|
|
||||||
return plugins
|
return plugins
|
||||||
|
@ -16,4 +16,4 @@ class DigikeyBarcodePlugin(BarcodePlugin):
|
|||||||
TODO: Validation of Digikey barcodes.
|
TODO: Validation of Digikey barcodes.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
@ -84,7 +84,7 @@ class BarcodeAPITest(APITestCase):
|
|||||||
|
|
||||||
response = self.client.post(
|
response = self.client.post(
|
||||||
self.assign_url, format='json',
|
self.assign_url, format='json',
|
||||||
data = {
|
data={
|
||||||
'barcode': barcode_data,
|
'barcode': barcode_data,
|
||||||
'stockitem': item.pk
|
'stockitem': item.pk
|
||||||
}
|
}
|
||||||
@ -106,7 +106,7 @@ class BarcodeAPITest(APITestCase):
|
|||||||
# Ensure that the same UID cannot be assigned to a different stock item!
|
# Ensure that the same UID cannot be assigned to a different stock item!
|
||||||
response = self.client.post(
|
response = self.client.post(
|
||||||
self.assign_url, format='json',
|
self.assign_url, format='json',
|
||||||
data = {
|
data={
|
||||||
'barcode': barcode_data,
|
'barcode': barcode_data,
|
||||||
'stockitem': 521
|
'stockitem': 521
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,6 @@ def get_plugins(pkg, baseclass):
|
|||||||
return plugins
|
return plugins
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def load_action_plugins():
|
def load_action_plugins():
|
||||||
"""
|
"""
|
||||||
Return a list of all registered action plugins
|
Return a list of all registered action plugins
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
ignore =
|
ignore =
|
||||||
# - W293 - blank lines contain whitespace
|
# - W293 - blank lines contain whitespace
|
||||||
W293,
|
W293,
|
||||||
|
W605,
|
||||||
# - E501 - line too long (82 characters)
|
# - E501 - line too long (82 characters)
|
||||||
E501, E722,
|
E501, E722,
|
||||||
# - C901 - function is too complex
|
# - C901 - function is too complex
|
||||||
|
Loading…
x
Reference in New Issue
Block a user