2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-02 11:40:58 +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

@ -181,7 +181,7 @@ class FileManager:
for i in range(self.row_count()):
data = [item for item in self.get_row_data(i)]
data = list(self.get_row_data(i))
# Is the row completely empty? Skip!
empty = True

View File

@ -2411,7 +2411,7 @@ class WebhookEndpoint(models.Model):
"""
return WebhookMessage.objects.create(
host=request.get_host(),
header=json.dumps({key: val for key, val in headers.items()}),
header=json.dumps(dict(headers.items())),
body=payload,
endpoint=self,
)

View File

@ -231,10 +231,7 @@ class MethodStorageClass:
return methods
IGNORED_NOTIFICATION_CLS = set([
SingleNotificationMethod,
BulkNotificationMethod,
])
IGNORED_NOTIFICATION_CLS = {SingleNotificationMethod, BulkNotificationMethod, }
storage = MethodStorageClass()
@ -424,7 +421,7 @@ def trigger_superuser_notification(plugin: PluginConfig, msg: str):
'message': msg,
},
targets=users,
delivery_methods=set([UIMessageNotification]),
delivery_methods={UIMessageNotification, },
)

View File

@ -30,7 +30,7 @@ def currency_code_mappings():
def currency_codes():
"""Returns the current currency codes."""
return [a for a in settings.CURRENCIES]
return list(settings.CURRENCIES)
def stock_expiry_enabled():