Skip to content

Commit 2118cc5

Browse files
author
Ann Paul
committed
Return conditional without using if/else to return boolean values
In this case, since both methods in the conditional strictly returns boolean values, it is defintely safe and more pythonic to return the conditional
1 parent 246a7a8 commit 2118cc5

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

rest_framework_docs/api_docs.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ def get_all_view_names(self, urlpatterns, parent_pattern=None):
2424

2525
def _is_drf_view(self, pattern):
2626
# Should check whether a pattern inherits from DRF's APIView
27-
if (hasattr(pattern.callback, 'cls') and issubclass(pattern.callback.cls, APIView)):
28-
return True
29-
return False
27+
return hasattr(pattern.callback, 'cls') and issubclass(pattern.callback.cls, APIView)
3028

3129
def get_endpoints(self):
3230
return self.endpoints

0 commit comments

Comments
 (0)