Skip to content

Commit 04fcc5c

Browse files
committed
Remove unnecessary else after 'return'
1 parent 0fa64e1 commit 04fcc5c

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

sphinxcontrib_django/docstrings/field_utils.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,19 @@ def get_field_type(field, include_role=True):
3131
f":class:`~{type(field).__module__}.{type(field).__name__}` to"
3232
f" :class:`~{to.__module__}.{to.__name__}`"
3333
)
34-
elif isinstance(field, models.fields.reverse_related.ForeignObjectRel):
34+
if isinstance(field, models.fields.reverse_related.ForeignObjectRel):
3535
to = field.remote_field.model
3636
return (
3737
"Reverse"
3838
f" :class:`~{type(field.remote_field).__module__}.{type(field.remote_field).__name__}`"
3939
f" from :class:`~{to.__module__}.{to.__name__}`"
4040
)
41-
else:
42-
if include_role:
43-
# For the docstrings of attributes, the :class: role is required
44-
return f":class:`~{type(field).__module__}.{type(field).__name__}`"
45-
else:
46-
# For the :param: role in class docstrings, the :class: role is not required
47-
return f"~{type(field).__module__}.{type(field).__name__}"
41+
if include_role:
42+
# For the docstrings of attributes, the :class: role is required
43+
return f":class:`~{type(field).__module__}.{type(field).__name__}`"
44+
45+
# For the :param: role in class docstrings, the :class: role is not required
46+
return f"~{type(field).__module__}.{type(field).__name__}"
4847

4948

5049
def get_field_verbose_name(field):

0 commit comments

Comments
 (0)