mirror of
https://github.com/netbox-community/netbox.git
synced 2025-09-06 14:23:36 -06:00
Unblacken code
This commit is contained in:
parent
f48e1cb534
commit
cf4db67e0b
@ -34,7 +34,6 @@ class ExtrasRootView(APIRootView):
|
||||
"""
|
||||
Extras API root view
|
||||
"""
|
||||
|
||||
def get_view_name(self):
|
||||
return 'Extras'
|
||||
|
||||
@ -43,7 +42,6 @@ class ExtrasRootView(APIRootView):
|
||||
# EventRules
|
||||
#
|
||||
|
||||
|
||||
class EventRuleViewSet(NetBoxModelViewSet):
|
||||
metadata_class = ContentTypeMetadata
|
||||
queryset = EventRule.objects.all()
|
||||
@ -55,7 +53,6 @@ class EventRuleViewSet(NetBoxModelViewSet):
|
||||
# Webhooks
|
||||
#
|
||||
|
||||
|
||||
class WebhookViewSet(NetBoxModelViewSet):
|
||||
metadata_class = ContentTypeMetadata
|
||||
queryset = Webhook.objects.all()
|
||||
@ -67,7 +64,6 @@ class WebhookViewSet(NetBoxModelViewSet):
|
||||
# Custom fields
|
||||
#
|
||||
|
||||
|
||||
class CustomFieldViewSet(NetBoxModelViewSet):
|
||||
metadata_class = ContentTypeMetadata
|
||||
queryset = CustomField.objects.select_related('choice_set')
|
||||
@ -95,7 +91,9 @@ class CustomFieldChoiceSetViewSet(NetBoxModelViewSet):
|
||||
|
||||
# Paginate data
|
||||
if page := self.paginate_queryset(choices):
|
||||
data = [{'id': c[0], 'display': c[1]} for c in page]
|
||||
data = [
|
||||
{'id': c[0], 'display': c[1]} for c in page
|
||||
]
|
||||
else:
|
||||
data = []
|
||||
|
||||
@ -106,7 +104,6 @@ class CustomFieldChoiceSetViewSet(NetBoxModelViewSet):
|
||||
# Custom links
|
||||
#
|
||||
|
||||
|
||||
class CustomLinkViewSet(NetBoxModelViewSet):
|
||||
metadata_class = ContentTypeMetadata
|
||||
queryset = CustomLink.objects.all()
|
||||
@ -118,7 +115,6 @@ class CustomLinkViewSet(NetBoxModelViewSet):
|
||||
# Export templates
|
||||
#
|
||||
|
||||
|
||||
class ExportTemplateViewSet(SyncedDataMixin, NetBoxModelViewSet):
|
||||
metadata_class = ContentTypeMetadata
|
||||
queryset = ExportTemplate.objects.all()
|
||||
@ -130,7 +126,6 @@ class ExportTemplateViewSet(SyncedDataMixin, NetBoxModelViewSet):
|
||||
# Saved filters
|
||||
#
|
||||
|
||||
|
||||
class SavedFilterViewSet(NetBoxModelViewSet):
|
||||
metadata_class = ContentTypeMetadata
|
||||
queryset = SavedFilter.objects.all()
|
||||
@ -142,7 +137,6 @@ class SavedFilterViewSet(NetBoxModelViewSet):
|
||||
# Table Configs
|
||||
#
|
||||
|
||||
|
||||
class TableConfigViewSet(NetBoxModelViewSet):
|
||||
metadata_class = ContentTypeMetadata
|
||||
queryset = TableConfig.objects.all()
|
||||
@ -154,7 +148,6 @@ class TableConfigViewSet(NetBoxModelViewSet):
|
||||
# Bookmarks
|
||||
#
|
||||
|
||||
|
||||
class BookmarkViewSet(NetBoxModelViewSet):
|
||||
metadata_class = ContentTypeMetadata
|
||||
queryset = Bookmark.objects.all()
|
||||
@ -166,7 +159,6 @@ class BookmarkViewSet(NetBoxModelViewSet):
|
||||
# Notifications & subscriptions
|
||||
#
|
||||
|
||||
|
||||
class NotificationViewSet(NetBoxModelViewSet):
|
||||
metadata_class = ContentTypeMetadata
|
||||
queryset = Notification.objects.all()
|
||||
@ -188,7 +180,6 @@ class SubscriptionViewSet(NetBoxModelViewSet):
|
||||
# Tags
|
||||
#
|
||||
|
||||
|
||||
class TagViewSet(NetBoxModelViewSet):
|
||||
queryset = Tag.objects.all()
|
||||
serializer_class = serializers.TagSerializer
|
||||
@ -205,7 +196,6 @@ class TaggedItemViewSet(RetrieveModelMixin, ListModelMixin, BaseViewSet):
|
||||
# Image attachments
|
||||
#
|
||||
|
||||
|
||||
class ImageAttachmentViewSet(NetBoxModelViewSet):
|
||||
metadata_class = ContentTypeMetadata
|
||||
queryset = ImageAttachment.objects.all()
|
||||
@ -228,7 +218,6 @@ class ImageAttachmentViewSet(NetBoxModelViewSet):
|
||||
# Journal entries
|
||||
#
|
||||
|
||||
|
||||
class JournalEntryViewSet(NetBoxModelViewSet):
|
||||
metadata_class = ContentTypeMetadata
|
||||
queryset = JournalEntry.objects.all()
|
||||
@ -251,7 +240,6 @@ class ConfigContextViewSet(SyncedDataMixin, NetBoxModelViewSet):
|
||||
# Config templates
|
||||
#
|
||||
|
||||
|
||||
class ConfigTemplateViewSet(SyncedDataMixin, ConfigTemplateRenderMixin, NetBoxModelViewSet):
|
||||
queryset = ConfigTemplate.objects.all()
|
||||
serializer_class = serializers.ConfigTemplateSerializer
|
||||
@ -273,7 +261,6 @@ class ConfigTemplateViewSet(SyncedDataMixin, ConfigTemplateRenderMixin, NetBoxMo
|
||||
# Scripts
|
||||
#
|
||||
|
||||
|
||||
@extend_schema_view(
|
||||
update=extend_schema(request=serializers.ScriptInputSerializer),
|
||||
partial_update=extend_schema(request=serializers.ScriptInputSerializer),
|
||||
@ -314,7 +301,10 @@ class ScriptViewSet(ModelViewSet):
|
||||
raise PermissionDenied("This user does not have permission to run scripts.")
|
||||
|
||||
script = self._get_script(pk)
|
||||
input_serializer = serializers.ScriptInputSerializer(data=request.data, context={'script': script})
|
||||
input_serializer = serializers.ScriptInputSerializer(
|
||||
data=request.data,
|
||||
context={'script': script}
|
||||
)
|
||||
|
||||
# Check that at least one RQ worker is running
|
||||
if not Worker.count(get_connection('default')):
|
||||
@ -329,7 +319,7 @@ class ScriptViewSet(ModelViewSet):
|
||||
commit=input_serializer.data['commit'],
|
||||
job_timeout=script.python_class.job_timeout,
|
||||
schedule_at=input_serializer.validated_data.get('schedule_at'),
|
||||
interval=input_serializer.validated_data.get('interval'),
|
||||
interval=input_serializer.validated_data.get('interval')
|
||||
)
|
||||
serializer = serializers.ScriptDetailSerializer(script, context={'request': request})
|
||||
|
||||
@ -342,7 +332,6 @@ class ScriptViewSet(ModelViewSet):
|
||||
# Object types
|
||||
#
|
||||
|
||||
|
||||
class ObjectTypeViewSet(ReadOnlyModelViewSet):
|
||||
"""
|
||||
Read-only list of ObjectTypes.
|
||||
|
Loading…
Reference in New Issue
Block a user