mirror of
https://github.com/netbox-community/netbox.git
synced 2026-03-31 22:53:21 +02:00
chore(ruff): Enable RET rules and add explicit fallbacks
Adopt Ruff `RET` to improve return-flow consistency across the codebase. Simplify control flow by removing redundant `else` blocks after `return`, and add explicit `return None` (or equivalent) fallbacks where appropriate to preserve existing behavior. Fixes #21411
This commit is contained in:
committed by
Jeremy Stretch
parent
b22e490847
commit
ef52ac4203
@@ -32,8 +32,7 @@ class ScriptSerializer(ValidatedModelSerializer):
|
||||
return {
|
||||
k: v.__class__.__name__ for k, v in obj.python_class()._get_vars().items()
|
||||
}
|
||||
else:
|
||||
return {}
|
||||
return {}
|
||||
|
||||
@extend_schema_field(serializers.CharField())
|
||||
def get_display(self, obj):
|
||||
@@ -43,8 +42,7 @@ class ScriptSerializer(ValidatedModelSerializer):
|
||||
def get_description(self, obj):
|
||||
if obj.python_class:
|
||||
return obj.python_class().description
|
||||
else:
|
||||
return None
|
||||
return None
|
||||
|
||||
|
||||
class ScriptDetailSerializer(ScriptSerializer):
|
||||
|
||||
Reference in New Issue
Block a user