mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-17 20:45:44 +00:00
CI updates (#6167)
* replaced flake8 with ruff mostly for speed improvements * fix codespell error * move config section * added isort again * move djlint config to pyproject * moved ruff section * remove flake8 from code base * remove flake8 from code base * fix djlint syntax * fix removed sections * fix requirements file * fix getattr useage * auto fixed docstring * adapted ruff settings to better fit code base * reorder order of operations * adjust checks * disable autofix/format * fixed reqs * remove flake8 section from setup.cfg * moved isort config * added missing toml req * fixed req * fixed source path
This commit is contained in:
@ -336,9 +336,9 @@ def trigger_notification(obj, category=None, obj_ref='pk', **kwargs):
|
||||
|
||||
# Try with some defaults
|
||||
if not obj_ref_value:
|
||||
obj_ref_value = getattr(obj, 'pk')
|
||||
obj_ref_value = getattr(obj, 'pk', None)
|
||||
if not obj_ref_value:
|
||||
obj_ref_value = getattr(obj, 'id')
|
||||
obj_ref_value = getattr(obj, 'id', None)
|
||||
if not obj_ref_value:
|
||||
raise KeyError(f"Could not resolve an object reference for '{str(obj)}' with {obj_ref}, pk, id")
|
||||
|
||||
|
@ -24,7 +24,7 @@ logger = logging.getLogger('inventree')
|
||||
def perform_stocktake(target: part.models.Part, user: User, note: str = '', commit=True, **kwargs):
|
||||
"""Perform stocktake action on a single part.
|
||||
|
||||
arguments:
|
||||
Arguments:
|
||||
target: A single Part model instance
|
||||
commit: If True (default) save the result to the database
|
||||
user: User who requested this stocktake
|
||||
|
@ -80,7 +80,7 @@ class PartCategoryAPITest(InvenTreeAPITestCase):
|
||||
({'parent': 1, 'cascade': False, 'depth': 1}, 3, 'Dont cascade even with depth=1 specified with parent'),
|
||||
({'parent': 1, 'cascade': True, 'depth': 1}, 5, 'Cascade with depth=1 with parent'),
|
||||
({'parent': 1, 'cascade': True, 'depth': 'abcdefg'}, 5, 'Cascade with invalid depth and parent'),
|
||||
({'parent': 42}, 8, 'Should return everything if parent_pk is not vaild'),
|
||||
({'parent': 42}, 8, 'Should return everything if parent_pk is not valid'),
|
||||
({'parent': 'null', 'exclude_tree': 1, 'cascade': True}, 2, 'Should return everything from except tree with pk=1'),
|
||||
({'parent': 'null', 'exclude_tree': 42, 'cascade': True}, 8, 'Should return everything because exclude_tree=42 is no valid pk'),
|
||||
({'parent': 1, 'starred': True, 'cascade': True}, 2, 'Should return the starred categories for the current user within the pk=1 tree'),
|
||||
|
@ -93,7 +93,7 @@ class APICallMixin:
|
||||
Check the mixin class docstring for a full example.
|
||||
"""
|
||||
headers = {'Content-Type': 'application/json'}
|
||||
if getattr(self, 'API_TOKEN_SETTING'):
|
||||
if getattr(self, 'API_TOKEN_SETTING', None):
|
||||
token = self.get_setting(self.API_TOKEN_SETTING)
|
||||
|
||||
if token:
|
||||
|
@ -82,7 +82,7 @@ class LabelPrintingMixin:
|
||||
items: The list of database items to print (e.g. StockItem instances)
|
||||
request: The HTTP request object which triggered this print job
|
||||
|
||||
Keyword arguments:
|
||||
Keyword Arguments:
|
||||
printing_options: The printing options set for this print job defined in the PrintingOptionsSerializer
|
||||
|
||||
Returns:
|
||||
|
@ -189,7 +189,7 @@ class PluginSetting(common.models.BaseInvenTreeSetting):
|
||||
plugin = kwargs.pop('plugin', None)
|
||||
|
||||
if plugin:
|
||||
mixin_settings = getattr(registry, 'mixins_settings')
|
||||
mixin_settings = getattr(registry, 'mixins_settings', None)
|
||||
if mixin_settings:
|
||||
kwargs['settings'] = mixin_settings.get(plugin.key, {})
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
"""
|
||||
Directory for custom plugin development.
|
||||
"""Directory for custom plugin development.
|
||||
|
||||
Please read the docs for more information https://docs.inventree.org/en/latest/extend/plugins/#local-directory
|
||||
"""
|
||||
|
@ -77,7 +77,7 @@ class StockLocationTest(StockAPITestCase):
|
||||
({'parent': 1, 'cascade': False, 'depth': 1}, 2, 'Dont cascade even with depth=1 specified with parent'),
|
||||
({'parent': 1, 'cascade': True, 'depth': 1}, 2, 'Cascade with depth=1 with parent'),
|
||||
({'parent': 1, 'cascade': True, 'depth': 'abcdefg'}, 2, 'Cascade with invalid depth and parent'),
|
||||
({'parent': 42}, 8, 'Should return everything if parent_pk is not vaild'),
|
||||
({'parent': 42}, 8, 'Should return everything if parent_pk is not valid'),
|
||||
({'parent': 'null', 'exclude_tree': 1, 'cascade': True}, 5, 'Should return everything except tree with pk=1'),
|
||||
({'parent': 'null', 'exclude_tree': 42, 'cascade': True}, 8, 'Should return everything because exclude_tree=42 is no valid pk'),
|
||||
]
|
||||
|
Reference in New Issue
Block a user