mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-01-24 08:14:16 +03:00
Changes ternary conditionals to be PEP308 compliant (#5827)
This commit is contained in:
parent
7d0d22ffaa
commit
d82b332a09
|
@ -33,8 +33,8 @@ And now we can add a `.save()` method to our model class:
|
||||||
representation of the code snippet.
|
representation of the code snippet.
|
||||||
"""
|
"""
|
||||||
lexer = get_lexer_by_name(self.language)
|
lexer = get_lexer_by_name(self.language)
|
||||||
linenos = self.linenos and 'table' or False
|
linenos = 'table' if self.linenos else False
|
||||||
options = self.title and {'title': self.title} or {}
|
options = {'title': self.title} if self.title else {}
|
||||||
formatter = HtmlFormatter(style=self.style, linenos=linenos,
|
formatter = HtmlFormatter(style=self.style, linenos=linenos,
|
||||||
full=True, **options)
|
full=True, **options)
|
||||||
self.highlighted = highlight(self.code, lexer, formatter)
|
self.highlighted = highlight(self.code, lexer, formatter)
|
||||||
|
|
|
@ -148,7 +148,7 @@ class SimpleRouter(BaseRouter):
|
||||||
]
|
]
|
||||||
|
|
||||||
def __init__(self, trailing_slash=True):
|
def __init__(self, trailing_slash=True):
|
||||||
self.trailing_slash = trailing_slash and '/' or ''
|
self.trailing_slash = '/' if trailing_slash else ''
|
||||||
super(SimpleRouter, self).__init__()
|
super(SimpleRouter, self).__init__()
|
||||||
|
|
||||||
def get_default_base_name(self, viewset):
|
def get_default_base_name(self, viewset):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user