pylint: fix simplifiable-if-statement/expression

Change-Id: I9af66f886c47d3d2be61cba22b6c84460a178b8e
This commit is contained in:
Akihiro Motoki 2018-12-02 06:32:27 +09:00
parent 3143edef01
commit a8edb5059d
8 changed files with 8 additions and 20 deletions

View File

@ -70,8 +70,6 @@ disable=
no-else-return,
no-self-use,
redefined-argument-from-local,
simplifiable-if-expression,
simplifiable-if-statement,
too-many-ancestors,
too-many-arguments,
too-many-branches,

View File

@ -106,10 +106,7 @@ class JSONMessage(object):
def _is_path(path):
if os.path.exists(path) and os.path.isdir(path):
return True
else:
return False
return os.path.exists(path) and os.path.isdir(path)
def _get_processed_messages(messages_path):

View File

@ -264,10 +264,7 @@ class User(models.AbstractBaseUser, models.AnonymousUser):
@property
def is_authenticated(self):
"""Checks for a valid authentication."""
if (self.token is not None and utils.is_token_valid(self.token)):
return True
else:
return False
return self.token is not None and utils.is_token_valid(self.token)
@property
def is_anonymous(self):

View File

@ -630,10 +630,7 @@ class Namespace(BaseGlanceMetadefAPIResourceWrapper):
@property
def public(self):
if getattr(self._apiresource, 'visibility') == 'public':
return True
else:
return False
return getattr(self._apiresource, 'visibility') == 'public'
def filter_properties_target(namespaces_iter,

View File

@ -424,7 +424,7 @@ class Projects(generic.View):
filters = None
paginate = request.GET.get('paginate') == 'true'
admin = False if request.GET.get('admin') == 'false' else True
admin = request.GET.get('admin') != 'false'
result, has_more = api.keystone.tenant_list(
request,

View File

@ -118,8 +118,7 @@ class UpdateView(forms.ModalFormView):
def get_initial(self):
namespace = self._get_object()
visibility = \
True if namespace['visibility'] == 'public' else False
visibility = namespace['visibility'] == 'public'
return {'namespace_id': namespace['namespace'],
'public': visibility,
'protected': namespace['protected'],

View File

@ -64,7 +64,7 @@ class CreateSubnet(project_workflows.CreateSubnet):
request, data,
network=network,
tenant_id=network.tenant_id)
return True if subnet else False
return bool(subnet)
class UpdateSubnetInfoAction(project_workflows.UpdateSubnetInfoAction):

View File

@ -78,7 +78,7 @@ class CreateSubnet(network_workflows.CreateNetwork):
network = self.context_seed['network']
# network argument is required to show error message correctly.
subnet = self._create_subnet(request, data, network=network)
return True if subnet else False
return bool(subnet)
class UpdateSubnetInfoAction(CreateSubnetInfoAction):
@ -202,4 +202,4 @@ class UpdateSubnet(network_workflows.CreateNetwork):
def handle(self, request, data):
subnet = self._update_subnet(request, data)
return True if subnet else False
return bool(subnet)