Merge "Remove redundant parentheses"
This commit is contained in:
commit
881cad5b78
@ -227,5 +227,5 @@ def get_hypervisor_inspector():
|
|||||||
invoke_on_load=True)
|
invoke_on_load=True)
|
||||||
return mgr.driver
|
return mgr.driver
|
||||||
except ImportError as e:
|
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()
|
return Inspector()
|
||||||
|
@ -38,9 +38,9 @@ class DataProcessing(plugin.NotificationBase):
|
|||||||
@property
|
@property
|
||||||
def event_types(self):
|
def event_types(self):
|
||||||
return [
|
return [
|
||||||
'%s.create' % (self.resource_name),
|
'%s.create' % self.resource_name,
|
||||||
'%s.update' % (self.resource_name),
|
'%s.update' % self.resource_name,
|
||||||
'%s.delete' % (self.resource_name),
|
'%s.delete' % self.resource_name,
|
||||||
]
|
]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -51,7 +51,7 @@ def parse_snmp_return(ret, is_bulk=False):
|
|||||||
else:
|
else:
|
||||||
err = False
|
err = False
|
||||||
data = varBinds
|
data = varBinds
|
||||||
return (err, data)
|
return err, data
|
||||||
|
|
||||||
|
|
||||||
EXACT = 'type_exact'
|
EXACT = 'type_exact'
|
||||||
|
@ -67,7 +67,7 @@ class User(IdentityCRUD):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def event_types(self):
|
def event_types(self):
|
||||||
return ['%s.*' % (self.resource_name)]
|
return ['%s.*' % self.resource_name]
|
||||||
|
|
||||||
|
|
||||||
class Group(IdentityCRUD):
|
class Group(IdentityCRUD):
|
||||||
@ -77,7 +77,7 @@ class Group(IdentityCRUD):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def event_types(self):
|
def event_types(self):
|
||||||
return ['%s.*' % (self.resource_name)]
|
return ['%s.*' % self.resource_name]
|
||||||
|
|
||||||
|
|
||||||
class Project(IdentityCRUD):
|
class Project(IdentityCRUD):
|
||||||
@ -87,7 +87,7 @@ class Project(IdentityCRUD):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def event_types(self):
|
def event_types(self):
|
||||||
return ['%s.*' % (self.resource_name)]
|
return ['%s.*' % self.resource_name]
|
||||||
|
|
||||||
|
|
||||||
class Role(IdentityCRUD):
|
class Role(IdentityCRUD):
|
||||||
@ -97,7 +97,7 @@ class Role(IdentityCRUD):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def event_types(self):
|
def event_types(self):
|
||||||
return ['%s.*' % (self.resource_name)]
|
return ['%s.*' % self.resource_name]
|
||||||
|
|
||||||
|
|
||||||
class Trust(IdentityCRUD):
|
class Trust(IdentityCRUD):
|
||||||
@ -108,8 +108,8 @@ class Trust(IdentityCRUD):
|
|||||||
@property
|
@property
|
||||||
def event_types(self):
|
def event_types(self):
|
||||||
return [
|
return [
|
||||||
'%s.created' % (self.resource_name),
|
'%s.created' % self.resource_name,
|
||||||
'%s.deleted' % (self.resource_name)
|
'%s.deleted' % self.resource_name,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,9 +50,9 @@ class NetworkNotificationBase(plugin.NotificationBase):
|
|||||||
# there is no resource id assigned by Neutron yet. So we ignore
|
# there is no resource id assigned by Neutron yet. So we ignore
|
||||||
# the *.create.start notification for now and only listen the
|
# the *.create.start notification for now and only listen the
|
||||||
# *.create.end to make sure the resource id is existed.
|
# *.create.end to make sure the resource id is existed.
|
||||||
'%s.create.end' % (self.resource_name),
|
'%s.create.end' % self.resource_name,
|
||||||
'%s.update.*' % (self.resource_name),
|
'%s.update.*' % self.resource_name,
|
||||||
'%s.exists' % (self.resource_name),
|
'%s.exists' % self.resource_name,
|
||||||
# FIXME(dhellmann): Neutron delete notifications do
|
# FIXME(dhellmann): Neutron delete notifications do
|
||||||
# not include the same metadata as the other messages,
|
# not include the same metadata as the other messages,
|
||||||
# so we ignore them for now. This isn't ideal, since
|
# so we ignore them for now. This isn't ideal, since
|
||||||
|
@ -136,16 +136,16 @@ class OpencontrailDriver(driver.Driver):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _switch_port_receive_packets(statistic, resource_id, resource_meta):
|
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
|
@staticmethod
|
||||||
def _switch_port_transmit_packets(statistic, resource_id, resource_meta):
|
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
|
@staticmethod
|
||||||
def _switch_port_receive_bytes(statistic, resource_id, resource_meta):
|
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
|
@staticmethod
|
||||||
def _switch_port_transmit_bytes(statistic, resource_id, resource_meta):
|
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
|
||||||
|
@ -42,7 +42,7 @@ def _get_properties(properties, prefix='properties'):
|
|||||||
def _get_int_sample(key, statistic, resource_id, resource_meta):
|
def _get_int_sample(key, statistic, resource_id, resource_meta):
|
||||||
if key not in statistic:
|
if key not in statistic:
|
||||||
return None
|
return None
|
||||||
return (int(statistic[key]), resource_id, resource_meta)
|
return int(statistic[key]), resource_id, resource_meta
|
||||||
|
|
||||||
|
|
||||||
class OpenDayLightDriver(driver.Driver):
|
class OpenDayLightDriver(driver.Driver):
|
||||||
@ -234,7 +234,7 @@ class OpenDayLightDriver(driver.Driver):
|
|||||||
|
|
||||||
resource_meta.update(_get_properties(statistic.get('properties')))
|
resource_meta.update(_get_properties(statistic.get('properties')))
|
||||||
|
|
||||||
return (1, resource_id, resource_meta)
|
return 1, resource_id, resource_meta
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _iter_port(extractor, data):
|
def _iter_port(extractor, data):
|
||||||
@ -307,7 +307,7 @@ class OpenDayLightDriver(driver.Driver):
|
|||||||
|
|
||||||
break
|
break
|
||||||
|
|
||||||
return (1, resource_id, resource_meta)
|
return 1, resource_id, resource_meta
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _switch_port_receive_packets(statistic, resource_id,
|
def _switch_port_receive_packets(statistic, resource_id,
|
||||||
@ -392,7 +392,7 @@ class OpenDayLightDriver(driver.Driver):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _switch_table(statistic, resource_id, resource_meta):
|
def _switch_table(statistic, resource_id, resource_meta):
|
||||||
return (1, resource_id, resource_meta)
|
return 1, resource_id, resource_meta
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _switch_table_active_entries(statistic, resource_id,
|
def _switch_table_active_entries(statistic, resource_id,
|
||||||
@ -427,7 +427,7 @@ class OpenDayLightDriver(driver.Driver):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _switch_flow(statistic, resource_id, resource_meta):
|
def _switch_flow(statistic, resource_id, resource_meta):
|
||||||
return (1, resource_id, resource_meta)
|
return 1, resource_id, resource_meta
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _switch_flow_duration_seconds(statistic, resource_id,
|
def _switch_flow_duration_seconds(statistic, resource_id,
|
||||||
|
@ -39,11 +39,11 @@ class StackCRUD(plugin.NotificationBase):
|
|||||||
@property
|
@property
|
||||||
def event_types(self):
|
def event_types(self):
|
||||||
return [
|
return [
|
||||||
'%s.create.end' % (self.resource_name),
|
'%s.create.end' % self.resource_name,
|
||||||
'%s.update.end' % (self.resource_name),
|
'%s.update.end' % self.resource_name,
|
||||||
'%s.delete.end' % (self.resource_name),
|
'%s.delete.end' % self.resource_name,
|
||||||
'%s.resume.end' % (self.resource_name),
|
'%s.resume.end' % self.resource_name,
|
||||||
'%s.suspend.end' % (self.resource_name),
|
'%s.suspend.end' % self.resource_name,
|
||||||
]
|
]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -692,7 +692,7 @@ class Connection(base.Connection):
|
|||||||
|
|
||||||
# Note: we don't flush here, explicitly (unless a new trait or event
|
# Note: we don't flush here, explicitly (unless a new trait or event
|
||||||
# does it). Otherwise, just wait until all the Events are staged.
|
# 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):
|
def record_events(self, event_models):
|
||||||
"""Write the events to SQL database via sqlalchemy.
|
"""Write the events to SQL database via sqlalchemy.
|
||||||
|
@ -151,7 +151,7 @@ class TestCoordinate(tests_base.BaseTestCase):
|
|||||||
younger = self._younger_by(offset)
|
younger = self._younger_by(offset)
|
||||||
pid = uuid.uuid4()
|
pid = uuid.uuid4()
|
||||||
self.partition_coordinator.presence(pid, younger)
|
self.partition_coordinator.presence(pid, younger)
|
||||||
return (pid, younger)
|
return pid, younger
|
||||||
|
|
||||||
def _check_assignments(self, others, alarm_ids, per_worker,
|
def _check_assignments(self, others, alarm_ids, per_worker,
|
||||||
expect_uneffected=None):
|
expect_uneffected=None):
|
||||||
|
@ -202,14 +202,14 @@ def faux_getCmd(authData, transportTarget, oid):
|
|||||||
try:
|
try:
|
||||||
return GETCMD_MAP[oid]
|
return GETCMD_MAP[oid]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return ("faux_getCmd Error", None, 0, [])
|
return "faux_getCmd Error", None, 0, []
|
||||||
|
|
||||||
|
|
||||||
def faux_nextCmd(authData, transportTarget, oid):
|
def faux_nextCmd(authData, transportTarget, oid):
|
||||||
try:
|
try:
|
||||||
return NEXTCMD_MAP[oid]
|
return NEXTCMD_MAP[oid]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return ("faux_nextCmd Error", None, 0, [])
|
return "faux_nextCmd Error", None, 0, []
|
||||||
|
|
||||||
|
|
||||||
def faux_getCmd_new(authData, transportTarget, *oids, **kwargs):
|
def faux_getCmd_new(authData, transportTarget, *oids, **kwargs):
|
||||||
|
@ -156,7 +156,7 @@ class BinApiTestCase(base.BaseTestCase):
|
|||||||
self.assertIsNone(self.subp.poll())
|
self.assertIsNone(self.subp.poll())
|
||||||
else:
|
else:
|
||||||
return r, c
|
return r, c
|
||||||
return (None, None)
|
return None, None
|
||||||
|
|
||||||
def test_v2(self):
|
def test_v2(self):
|
||||||
response, content = self.get_response('v2/meters')
|
response, content = self.get_response('v2/meters')
|
||||||
|
@ -92,7 +92,7 @@ class ScalingTransformer(transformer.TransformerBase):
|
|||||||
def handle_sample(self, context, s):
|
def handle_sample(self, context, s):
|
||||||
"""Handle a sample, converting if necessary."""
|
"""Handle a sample, converting if necessary."""
|
||||||
LOG.debug(_('handling sample %s'), (s,))
|
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)
|
s = self._convert(s)
|
||||||
LOG.debug(_('converted to: %s'), (s,))
|
LOG.debug(_('converted to: %s'), (s,))
|
||||||
return s
|
return s
|
||||||
|
Loading…
Reference in New Issue
Block a user