mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-16 03:55:41 +00:00
chore: bump pre commit (#8904)
* bump pre-commit * auto-fixes * ignore error * fix a few more issues * fix pattern
This commit is contained in:
@ -11,6 +11,7 @@ from decimal import Decimal, InvalidOperation
|
||||
from pathlib import Path
|
||||
from typing import Optional, TypeVar, Union
|
||||
from wsgiref.util import FileWrapper
|
||||
from zoneinfo import ZoneInfo, ZoneInfoNotFoundError
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.staticfiles.storage import StaticFilesStorage
|
||||
@ -25,7 +26,6 @@ import structlog
|
||||
from bleach import clean
|
||||
from djmoney.money import Money
|
||||
from PIL import Image
|
||||
from zoneinfo import ZoneInfo, ZoneInfoNotFoundError
|
||||
|
||||
from common.currency import currency_code_default
|
||||
|
||||
|
@ -762,8 +762,7 @@ class InvenTreeTree(MetadataMixin, PluginValidationMixin, MPTTModel):
|
||||
pathstring = self.construct_pathstring()
|
||||
|
||||
if pathstring != self.pathstring:
|
||||
if 'force_insert' in kwargs:
|
||||
del kwargs['force_insert']
|
||||
kwargs.pop('force_insert', None)
|
||||
|
||||
kwargs['force_update'] = True
|
||||
|
||||
|
@ -13,6 +13,7 @@ import logging
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from zoneinfo import ZoneInfo, ZoneInfoNotFoundError
|
||||
|
||||
import django.conf.locale
|
||||
import django.core.exceptions
|
||||
@ -21,7 +22,6 @@ from django.http import Http404
|
||||
|
||||
import structlog
|
||||
from dotenv import load_dotenv
|
||||
from zoneinfo import ZoneInfo, ZoneInfoNotFoundError
|
||||
|
||||
from InvenTree.cache import get_cache_config, is_global_cache_enabled
|
||||
from InvenTree.config import get_boolean_setting, get_custom_file, get_setting
|
||||
|
@ -5,6 +5,7 @@ import time
|
||||
from datetime import datetime, timedelta
|
||||
from decimal import Decimal
|
||||
from unittest import mock
|
||||
from zoneinfo import ZoneInfo
|
||||
|
||||
import django.core.exceptions as django_exceptions
|
||||
from django.conf import settings
|
||||
@ -21,7 +22,6 @@ from djmoney.contrib.exchange.models import Rate, convert_money
|
||||
from djmoney.money import Money
|
||||
from maintenance_mode.core import get_maintenance_mode, set_maintenance_mode
|
||||
from sesame.utils import get_user
|
||||
from zoneinfo import ZoneInfo
|
||||
|
||||
import InvenTree.conversion
|
||||
import InvenTree.format
|
||||
|
@ -1,7 +1,6 @@
|
||||
"""Provides a JSON API for common components."""
|
||||
|
||||
import json
|
||||
from typing import Type
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
@ -557,7 +556,7 @@ class AllUnitList(ListAPI):
|
||||
"""Parse a unit from the registry."""
|
||||
if not hasattr(reg, k):
|
||||
return None
|
||||
unit: Type[UnitLike] = getattr(reg, k)
|
||||
unit: type[UnitLike] = getattr(reg, k)
|
||||
return {
|
||||
'name': k,
|
||||
'is_alias': reg.get_name(k) == k,
|
||||
|
@ -29,8 +29,8 @@ def validate_part_name_format(value):
|
||||
# Make sure that the field_name exists in Part model
|
||||
from part.models import Part
|
||||
|
||||
jinja_template_regex = re.compile('{{.*?}}')
|
||||
field_name_regex = re.compile('(?<=part\\.)[A-z]+')
|
||||
jinja_template_regex = re.compile(r'{{.*?}}')
|
||||
field_name_regex = re.compile(r'(?<=part\.)[A-z]+')
|
||||
|
||||
for jinja_template in jinja_template_regex.findall(str(value)):
|
||||
# make sure at least one and only one field is present inside the parser
|
||||
|
@ -1,6 +1,7 @@
|
||||
"""Custom model/serializer fields for InvenTree models that support custom states."""
|
||||
|
||||
from typing import Any, Iterable, Optional
|
||||
from collections.abc import Iterable
|
||||
from typing import Any, Optional
|
||||
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.db import models
|
||||
|
@ -59,7 +59,7 @@ class LabelPrinterBaseDriver(BaseDriver):
|
||||
label: LabelTemplate,
|
||||
items: QuerySet[models.Model],
|
||||
**kwargs,
|
||||
) -> Union[None, JsonResponse]:
|
||||
) -> Union[JsonResponse, None]:
|
||||
"""Print one or more labels with the provided template and items.
|
||||
|
||||
Arguments:
|
||||
|
@ -1,6 +1,6 @@
|
||||
"""Helper functions for barcode generation."""
|
||||
|
||||
from typing import Type, cast
|
||||
from typing import cast
|
||||
|
||||
import structlog
|
||||
|
||||
@ -44,7 +44,7 @@ def generate_barcode(model_instance: InvenTreeBarcodeMixin):
|
||||
|
||||
|
||||
@cache
|
||||
def get_supported_barcode_models() -> list[Type[InvenTreeBarcodeMixin]]:
|
||||
def get_supported_barcode_models() -> list[type[InvenTreeBarcodeMixin]]:
|
||||
"""Returns a list of database models which support barcode functionality."""
|
||||
return InvenTree.helpers_model.getModelsWithMixin(InvenTreeBarcodeMixin)
|
||||
|
||||
|
@ -426,10 +426,10 @@ def render_html_text(text: str, **kwargs):
|
||||
"""
|
||||
tags = []
|
||||
|
||||
if kwargs.get('bold', False):
|
||||
if kwargs.get('bold'):
|
||||
tags.append('strong')
|
||||
|
||||
if kwargs.get('italic', False):
|
||||
if kwargs.get('italic'):
|
||||
tags.append('em')
|
||||
|
||||
if heading := kwargs.get('heading', ''):
|
||||
|
@ -1,6 +1,7 @@
|
||||
"""Unit testing for the various report models."""
|
||||
|
||||
from io import StringIO
|
||||
from zoneinfo import ZoneInfo
|
||||
|
||||
from django.apps import apps
|
||||
from django.conf import settings
|
||||
@ -11,7 +12,6 @@ from django.utils import timezone
|
||||
from django.utils.safestring import SafeString
|
||||
|
||||
from PIL import Image
|
||||
from zoneinfo import ZoneInfo
|
||||
|
||||
import report.models as report_models
|
||||
from build.models import Build
|
||||
|
@ -472,7 +472,7 @@ class StockItem(
|
||||
Returns:
|
||||
QuerySet: The created StockItem objects
|
||||
|
||||
raises:
|
||||
Raises:
|
||||
ValidationError: If any of the provided serial numbers are invalid
|
||||
|
||||
This method uses bulk_create to create multiple StockItem objects in a single query,
|
||||
|
Reference in New Issue
Block a user