From af0f3486390125691fcbe5000ceabe49934f25c3 Mon Sep 17 00:00:00 2001 From: Dina Belova Date: Fri, 11 Jul 2014 15:56:17 +0400 Subject: [PATCH] Remove redundant parentheses Ceilometer code contained redundant parentheses usages, so they were removed. Change-Id: I00cbb255a598984e33faade2c59865d926000733 --- ceilometer/alarm/partition/coordination.py | 2 +- ceilometer/api/controllers/v2.py | 6 +++--- .../api/v2/test_compute_duration_by_resource_scenarios.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ceilometer/alarm/partition/coordination.py b/ceilometer/alarm/partition/coordination.py index e013ab616..c0bbeb06a 100644 --- a/ceilometer/alarm/partition/coordination.py +++ b/ceilometer/alarm/partition/coordination.py @@ -230,7 +230,7 @@ class PartitionCoordinator(object): created_alarms = list(set(alarms) - self.last_alarms) LOG.debug(_('newly created alarms %s') % created_alarms) sufficient_deletion = self._deletion_requires_rebalance(alarms) - if (assuming or sufficient_deletion or self.presence_changed): + if assuming or sufficient_deletion or self.presence_changed: still_ahead = self._distribute(alarms, rebalance=True) elif created_alarms: still_ahead = self._distribute(list(created_alarms), diff --git a/ceilometer/api/controllers/v2.py b/ceilometer/api/controllers/v2.py index db81ad131..b1301822b 100644 --- a/ceilometer/api/controllers/v2.py +++ b/ceilometer/api/controllers/v2.py @@ -372,7 +372,7 @@ def _validate_query(query, db_func, internal_keys=None, allow_timestamps) has_search_offset_query = _validate_timestamp_fields(query, 'search_offset', - ('eq'), + 'eq', allow_timestamps) if has_search_offset_query and not has_timestamp_query: @@ -388,7 +388,7 @@ def _validate_query(query, db_func, internal_keys=None, if i.field not in ('timestamp', 'search_offset'): key = translation.get(i.field, i.field) operator = i.op - if (key in valid_keys or _is_field_metadata(i.field)): + if key in valid_keys or _is_field_metadata(i.field): if operator == 'eq': if key == 'enabled': i._get_value_as_type('boolean') @@ -595,7 +595,7 @@ def _make_link(rel_name, url, type, type_arg, query=None): if query: query_str = '?q.field=%s&q.value=%s' % (query['field'], query['value']) - return Link(href=('%s/v2/%s/%s%s') % (url, type, type_arg, query_str), + return Link(href='%s/v2/%s/%s%s' % (url, type, type_arg, query_str), rel=rel_name) diff --git a/ceilometer/tests/api/v2/test_compute_duration_by_resource_scenarios.py b/ceilometer/tests/api/v2/test_compute_duration_by_resource_scenarios.py index e813378e7..dce587c3b 100644 --- a/ceilometer/tests/api/v2/test_compute_duration_by_resource_scenarios.py +++ b/ceilometer/tests/api/v2/test_compute_duration_by_resource_scenarios.py @@ -52,7 +52,7 @@ class TestComputeDurationByResource(v2.FunctionalTest, def get_interval(event_filter, period, groupby, aggregate): self.assertIsNotNone(event_filter.start) self.assertIsNotNone(event_filter.end) - if (event_filter.start > end or event_filter.end < start): + if event_filter.start > end or event_filter.end < start: return [] duration_start = max(event_filter.start, start) duration_end = min(event_filter.end, end)