From 068232eefb2673063d188caaf0f4659d43b9cacf Mon Sep 17 00:00:00 2001 From: Dina Belova Date: Wed, 20 Aug 2014 17:00:02 +0400 Subject: [PATCH] Remove redundant parentheses Change-Id: I3b0917e6941e5e86301728361ab9afe5e9ecf012 --- ceilometer/compute/virt/inspector.py | 2 +- ceilometer/data_processing/notifications.py | 6 +++--- ceilometer/hardware/inspector/snmp.py | 2 +- ceilometer/identity/notifications.py | 12 ++++++------ ceilometer/network/notifications.py | 6 +++--- ceilometer/network/statistics/opencontrail/driver.py | 8 ++++---- ceilometer/network/statistics/opendaylight/driver.py | 10 +++++----- ceilometer/orchestration/notifications.py | 10 +++++----- ceilometer/storage/impl_sqlalchemy.py | 2 +- .../tests/alarm/partition/test_coordination.py | 2 +- ceilometer/tests/hardware/inspector/test_snmp.py | 4 ++-- ceilometer/tests/test_bin.py | 2 +- ceilometer/transformer/conversions.py | 2 +- 13 files changed, 34 insertions(+), 34 deletions(-) diff --git a/ceilometer/compute/virt/inspector.py b/ceilometer/compute/virt/inspector.py index 6736e36c9..455a15521 100644 --- a/ceilometer/compute/virt/inspector.py +++ b/ceilometer/compute/virt/inspector.py @@ -227,5 +227,5 @@ def get_hypervisor_inspector(): invoke_on_load=True) return mgr.driver except ImportError as e: - LOG.error(_("Unable to load the hypervisor inspector: %s") % (e)) + LOG.error(_("Unable to load the hypervisor inspector: %s") % e) return Inspector() diff --git a/ceilometer/data_processing/notifications.py b/ceilometer/data_processing/notifications.py index d4e8a9545..06010700a 100644 --- a/ceilometer/data_processing/notifications.py +++ b/ceilometer/data_processing/notifications.py @@ -38,9 +38,9 @@ class DataProcessing(plugin.NotificationBase): @property def event_types(self): return [ - '%s.create' % (self.resource_name), - '%s.update' % (self.resource_name), - '%s.delete' % (self.resource_name), + '%s.create' % self.resource_name, + '%s.update' % self.resource_name, + '%s.delete' % self.resource_name, ] @staticmethod diff --git a/ceilometer/hardware/inspector/snmp.py b/ceilometer/hardware/inspector/snmp.py index 6152f5aa4..44ecc31c2 100644 --- a/ceilometer/hardware/inspector/snmp.py +++ b/ceilometer/hardware/inspector/snmp.py @@ -51,7 +51,7 @@ def parse_snmp_return(ret, is_bulk=False): else: err = False data = varBinds - return (err, data) + return err, data EXACT = 'type_exact' diff --git a/ceilometer/identity/notifications.py b/ceilometer/identity/notifications.py index b84b425b9..4cd460847 100644 --- a/ceilometer/identity/notifications.py +++ b/ceilometer/identity/notifications.py @@ -67,7 +67,7 @@ class User(IdentityCRUD): @property def event_types(self): - return ['%s.*' % (self.resource_name)] + return ['%s.*' % self.resource_name] class Group(IdentityCRUD): @@ -77,7 +77,7 @@ class Group(IdentityCRUD): @property def event_types(self): - return ['%s.*' % (self.resource_name)] + return ['%s.*' % self.resource_name] class Project(IdentityCRUD): @@ -87,7 +87,7 @@ class Project(IdentityCRUD): @property def event_types(self): - return ['%s.*' % (self.resource_name)] + return ['%s.*' % self.resource_name] class Role(IdentityCRUD): @@ -97,7 +97,7 @@ class Role(IdentityCRUD): @property def event_types(self): - return ['%s.*' % (self.resource_name)] + return ['%s.*' % self.resource_name] class Trust(IdentityCRUD): @@ -108,8 +108,8 @@ class Trust(IdentityCRUD): @property def event_types(self): return [ - '%s.created' % (self.resource_name), - '%s.deleted' % (self.resource_name) + '%s.created' % self.resource_name, + '%s.deleted' % self.resource_name, ] diff --git a/ceilometer/network/notifications.py b/ceilometer/network/notifications.py index 37ecc932d..9405877fd 100644 --- a/ceilometer/network/notifications.py +++ b/ceilometer/network/notifications.py @@ -50,9 +50,9 @@ class NetworkNotificationBase(plugin.NotificationBase): # there is no resource id assigned by Neutron yet. So we ignore # the *.create.start notification for now and only listen the # *.create.end to make sure the resource id is existed. - '%s.create.end' % (self.resource_name), - '%s.update.*' % (self.resource_name), - '%s.exists' % (self.resource_name), + '%s.create.end' % self.resource_name, + '%s.update.*' % self.resource_name, + '%s.exists' % self.resource_name, # FIXME(dhellmann): Neutron delete notifications do # not include the same metadata as the other messages, # so we ignore them for now. This isn't ideal, since diff --git a/ceilometer/network/statistics/opencontrail/driver.py b/ceilometer/network/statistics/opencontrail/driver.py index 56552f917..dafe8ebad 100644 --- a/ceilometer/network/statistics/opencontrail/driver.py +++ b/ceilometer/network/statistics/opencontrail/driver.py @@ -137,16 +137,16 @@ class OpencontrailDriver(driver.Driver): @staticmethod def _switch_port_receive_packets(statistic, resource_id, resource_meta): - return (int(statistic['in_pkts']), resource_id, resource_meta) + return int(statistic['in_pkts']), resource_id, resource_meta @staticmethod def _switch_port_transmit_packets(statistic, resource_id, resource_meta): - return (int(statistic['out_pkts']), resource_id, resource_meta) + return int(statistic['out_pkts']), resource_id, resource_meta @staticmethod def _switch_port_receive_bytes(statistic, resource_id, resource_meta): - return (int(statistic['in_bytes']), resource_id, resource_meta) + return int(statistic['in_bytes']), resource_id, resource_meta @staticmethod def _switch_port_transmit_bytes(statistic, resource_id, resource_meta): - return (int(statistic['out_bytes']), resource_id, resource_meta) + return int(statistic['out_bytes']), resource_id, resource_meta diff --git a/ceilometer/network/statistics/opendaylight/driver.py b/ceilometer/network/statistics/opendaylight/driver.py index 999c385c4..246782dac 100644 --- a/ceilometer/network/statistics/opendaylight/driver.py +++ b/ceilometer/network/statistics/opendaylight/driver.py @@ -43,7 +43,7 @@ def _get_properties(properties, prefix='properties'): def _get_int_sample(key, statistic, resource_id, resource_meta): if key not in statistic: return None - return (int(statistic[key]), resource_id, resource_meta) + return int(statistic[key]), resource_id, resource_meta class OpenDayLightDriver(driver.Driver): @@ -235,7 +235,7 @@ class OpenDayLightDriver(driver.Driver): resource_meta.update(_get_properties(statistic.get('properties'))) - return (1, resource_id, resource_meta) + return 1, resource_id, resource_meta @staticmethod def _iter_port(extractor, data): @@ -308,7 +308,7 @@ class OpenDayLightDriver(driver.Driver): break - return (1, resource_id, resource_meta) + return 1, resource_id, resource_meta @staticmethod def _switch_port_receive_packets(statistic, resource_id, @@ -393,7 +393,7 @@ class OpenDayLightDriver(driver.Driver): @staticmethod def _switch_table(statistic, resource_id, resource_meta): - return (1, resource_id, resource_meta) + return 1, resource_id, resource_meta @staticmethod def _switch_table_active_entries(statistic, resource_id, @@ -428,7 +428,7 @@ class OpenDayLightDriver(driver.Driver): @staticmethod def _switch_flow(statistic, resource_id, resource_meta): - return (1, resource_id, resource_meta) + return 1, resource_id, resource_meta @staticmethod def _switch_flow_duration_seconds(statistic, resource_id, diff --git a/ceilometer/orchestration/notifications.py b/ceilometer/orchestration/notifications.py index 94f978c56..77603400d 100644 --- a/ceilometer/orchestration/notifications.py +++ b/ceilometer/orchestration/notifications.py @@ -39,11 +39,11 @@ class StackCRUD(plugin.NotificationBase): @property def event_types(self): return [ - '%s.create.end' % (self.resource_name), - '%s.update.end' % (self.resource_name), - '%s.delete.end' % (self.resource_name), - '%s.resume.end' % (self.resource_name), - '%s.suspend.end' % (self.resource_name), + '%s.create.end' % self.resource_name, + '%s.update.end' % self.resource_name, + '%s.delete.end' % self.resource_name, + '%s.resume.end' % self.resource_name, + '%s.suspend.end' % self.resource_name, ] @staticmethod diff --git a/ceilometer/storage/impl_sqlalchemy.py b/ceilometer/storage/impl_sqlalchemy.py index 94feb5ffa..3907d5806 100644 --- a/ceilometer/storage/impl_sqlalchemy.py +++ b/ceilometer/storage/impl_sqlalchemy.py @@ -692,7 +692,7 @@ class Connection(base.Connection): # Note: we don't flush here, explicitly (unless a new trait or event # does it). Otherwise, just wait until all the Events are staged. - return (event, new_traits) + return event, new_traits def record_events(self, event_models): """Write the events to SQL database via sqlalchemy. diff --git a/ceilometer/tests/alarm/partition/test_coordination.py b/ceilometer/tests/alarm/partition/test_coordination.py index 242855a7d..b787cc6cd 100644 --- a/ceilometer/tests/alarm/partition/test_coordination.py +++ b/ceilometer/tests/alarm/partition/test_coordination.py @@ -151,7 +151,7 @@ class TestCoordinate(tests_base.BaseTestCase): younger = self._younger_by(offset) pid = uuid.uuid4() self.partition_coordinator.presence(pid, younger) - return (pid, younger) + return pid, younger def _check_assignments(self, others, alarm_ids, per_worker, expect_uneffected=None): diff --git a/ceilometer/tests/hardware/inspector/test_snmp.py b/ceilometer/tests/hardware/inspector/test_snmp.py index 1d2b052e1..b1afe07bc 100644 --- a/ceilometer/tests/hardware/inspector/test_snmp.py +++ b/ceilometer/tests/hardware/inspector/test_snmp.py @@ -202,14 +202,14 @@ def faux_getCmd(authData, transportTarget, oid): try: return GETCMD_MAP[oid] except KeyError: - return ("faux_getCmd Error", None, 0, []) + return "faux_getCmd Error", None, 0, [] def faux_nextCmd(authData, transportTarget, oid): try: return NEXTCMD_MAP[oid] except KeyError: - return ("faux_nextCmd Error", None, 0, []) + return "faux_nextCmd Error", None, 0, [] def faux_getCmd_new(authData, transportTarget, *oids, **kwargs): diff --git a/ceilometer/tests/test_bin.py b/ceilometer/tests/test_bin.py index 61f67a604..211ee5fcb 100644 --- a/ceilometer/tests/test_bin.py +++ b/ceilometer/tests/test_bin.py @@ -156,7 +156,7 @@ class BinApiTestCase(base.BaseTestCase): self.assertIsNone(self.subp.poll()) else: return r, c - return (None, None) + return None, None def test_v2(self): response, content = self.get_response('v2/meters') diff --git a/ceilometer/transformer/conversions.py b/ceilometer/transformer/conversions.py index 0d4c185df..6633e0c6f 100644 --- a/ceilometer/transformer/conversions.py +++ b/ceilometer/transformer/conversions.py @@ -92,7 +92,7 @@ class ScalingTransformer(transformer.TransformerBase): def handle_sample(self, context, s): """Handle a sample, converting if necessary.""" LOG.debug(_('handling sample %s'), (s,)) - if (self.source.get('unit', s.unit) == s.unit): + if self.source.get('unit', s.unit) == s.unit: s = self._convert(s) LOG.debug(_('converted to: %s'), (s,)) return s