Merge "pylint: fix some refactor recommendations"
This commit is contained in:
commit
60dd57655b
@ -48,9 +48,6 @@ disable=
|
|||||||
unused-variable,
|
unused-variable,
|
||||||
wrong-import-order, # TODO
|
wrong-import-order, # TODO
|
||||||
# "R" Refactor recommendations
|
# "R" Refactor recommendations
|
||||||
chained-comparison,
|
|
||||||
comparison-with-itself,
|
|
||||||
consider-using-in,
|
|
||||||
cyclic-import, # TODO
|
cyclic-import, # TODO
|
||||||
duplicate-code,
|
duplicate-code,
|
||||||
inconsistent-return-statements, # TODO
|
inconsistent-return-statements, # TODO
|
||||||
|
@ -27,6 +27,7 @@ register = template.Library()
|
|||||||
|
|
||||||
@register.filter("truncate")
|
@register.filter("truncate")
|
||||||
def truncate(value, size):
|
def truncate(value, size):
|
||||||
|
# pylint: disable=chained-comparison
|
||||||
if len(value) > size and size > 3:
|
if len(value) > size and size > 3:
|
||||||
return value[0:(size - 3)] + '...'
|
return value[0:(size - 3)] + '...'
|
||||||
else:
|
else:
|
||||||
|
@ -901,7 +901,7 @@ def get_default_role(request):
|
|||||||
roles = []
|
roles = []
|
||||||
exceptions.handle(request)
|
exceptions.handle(request)
|
||||||
for role in roles:
|
for role in roles:
|
||||||
if role.id == default or role.name == default:
|
if default in (role.id, role.name):
|
||||||
DEFAULT_ROLE = role
|
DEFAULT_ROLE = role
|
||||||
break
|
break
|
||||||
return DEFAULT_ROLE
|
return DEFAULT_ROLE
|
||||||
|
@ -58,6 +58,9 @@ class NaNJSONEncoder(json.JSONEncoder):
|
|||||||
# and/or platform-specific, so do tests which don't depend on the
|
# and/or platform-specific, so do tests which don't depend on the
|
||||||
# internals.
|
# internals.
|
||||||
|
|
||||||
|
# NOTE: In Python, NaN == NaN returns False and it can be used
|
||||||
|
# to detect NaN.
|
||||||
|
# pylint: disable=comparison-with-itself
|
||||||
if o != o:
|
if o != o:
|
||||||
text = self.nan_str
|
text = self.nan_str
|
||||||
elif o == _inf:
|
elif o == _inf:
|
||||||
|
@ -390,7 +390,7 @@ class AddRule(forms.SelfHandlingForm):
|
|||||||
rule_menu = cleaned_data.get('rule_menu')
|
rule_menu = cleaned_data.get('rule_menu')
|
||||||
if rule_menu == 'icmp':
|
if rule_menu == 'icmp':
|
||||||
self._clean_rule_icmp(cleaned_data, rule_menu)
|
self._clean_rule_icmp(cleaned_data, rule_menu)
|
||||||
elif rule_menu == 'tcp' or rule_menu == 'udp':
|
elif rule_menu in ('tcp', 'udp'):
|
||||||
self._clean_rule_tcp_udp(cleaned_data, rule_menu)
|
self._clean_rule_tcp_udp(cleaned_data, rule_menu)
|
||||||
elif rule_menu == 'custom':
|
elif rule_menu == 'custom':
|
||||||
self._clean_rule_custom(cleaned_data, rule_menu)
|
self._clean_rule_custom(cleaned_data, rule_menu)
|
||||||
|
Loading…
Reference in New Issue
Block a user