fix new N402 errors

fix the N402 errors that have slipped in in the last 48 hrs since
starting this patch series.

fix an N401 error that our scanner current can't find because it
only looks for doc strings on classes and defs.

this is the xeno's paradox of patch series, but we're getting close.

Change-Id: I4a763bb4c812335d853eae05c72464f18ab93297
This commit is contained in:
Sean Dague 2013-01-09 16:00:36 -05:00
parent 8143021bdb
commit 5fca1d9e97
16 changed files with 53 additions and 55 deletions

View File

@ -56,7 +56,7 @@ QUEUE = Queue.Queue()
# They are split for stub-out.
def discovery(portal_address, portal_port):
"""Do iSCSI discovery on portal"""
"""Do iSCSI discovery on portal."""
utils.execute('iscsiadm',
'-m', 'discovery',
'-t', 'st',
@ -66,7 +66,7 @@ def discovery(portal_address, portal_port):
def login_iscsi(portal_address, portal_port, target_iqn):
"""Login to an iSCSI target"""
"""Login to an iSCSI target."""
utils.execute('iscsiadm',
'-m', 'node',
'-p', '%s:%s' % (portal_address, portal_port),
@ -79,7 +79,7 @@ def login_iscsi(portal_address, portal_port, target_iqn):
def logout_iscsi(portal_address, portal_port, target_iqn):
"""Logout from an iSCSI target"""
"""Logout from an iSCSI target."""
utils.execute('iscsiadm',
'-m', 'node',
'-p', '%s:%s' % (portal_address, portal_port),
@ -90,7 +90,7 @@ def logout_iscsi(portal_address, portal_port, target_iqn):
def make_partitions(dev, root_mb, swap_mb):
"""Create partitions for root and swap on a disk device"""
"""Create partitions for root and swap on a disk device."""
commands = ['o,w',
'n,p,1,,+%dM,t,1,83,w' % root_mb,
'n,p,2,,+%dM,t,2,82,w' % swap_mb,
@ -106,13 +106,13 @@ def make_partitions(dev, root_mb, swap_mb):
def is_block_device(dev):
"""Check whether a device is block or not"""
"""Check whether a device is block or not."""
s = os.stat(dev)
return stat.S_ISBLK(s.st_mode)
def dd(src, dst):
"""Execute dd from src to dst"""
"""Execute dd from src to dst."""
utils.execute('dd',
'if=%s' % src,
'of=%s' % dst,
@ -122,7 +122,7 @@ def dd(src, dst):
def mkswap(dev, label='swap1'):
"""Execute mkswap on a device"""
"""Execute mkswap on a device."""
utils.execute('mkswap',
'-L', label,
dev,
@ -131,7 +131,7 @@ def mkswap(dev, label='swap1'):
def block_uuid(dev):
"""Get UUID of a block device"""
"""Get UUID of a block device."""
out, _ = utils.execute('blkid', '-s', 'UUID', '-o', 'value', dev,
run_as_root=True,
check_exit_code=[0])
@ -219,7 +219,7 @@ def deploy(address, port, iqn, lun, image_path, pxe_config_path,
class Worker(threading.Thread):
"""Thread that handles requests in queue"""
"""Thread that handles requests in queue."""
def __init__(self):
super(Worker, self).__init__()
@ -250,7 +250,7 @@ class Worker(threading.Thread):
class BareMetalDeploy(object):
"""WSGI server for bare-metal deployment"""
"""WSGI server for bare-metal deployment."""
def __init__(self):
self.worker = Worker()

View File

@ -298,7 +298,7 @@
},
{
"alias": "os-admin-networks",
"description": "Admin-only Network Management Extension",
"description": "Admin-only Network Management Extension.",
"links": [],
"name": "AdminNetworks",
"namespace": "http://docs.openstack.org/compute/ext/os-admin-networks/api/v1.1",
@ -306,7 +306,7 @@
},
{
"alias": "os-networks",
"description": "Tenant-based Network Management Extension",
"description": "Tenant-based Network Management Extension.",
"links": [],
"name": "OSNetworks",
"namespace": "http://docs.openstack.org/compute/ext/os-networks/api/v1.1",

View File

@ -126,13 +126,13 @@
<description>Allow multiple create in the Create Server v1.1 API.</description>
</extension>
<extension alias="os-admin-networks" updated="2011-12-23T00:00:00+00:00" namespace="http://docs.openstack.org/compute/ext/os-admin-networks/api/v1.1" name="AdminNetworks">
<description>Admin-only Network Management Extension</description>
<description>Admin-only Network Management Extension.</description>
</extension>
<extension alias="os-networks-associate" updated="2012-11-19T00:00:00+00:00" namespace="http://docs.openstack.org/compute/ext/networks_associate/api/v2" name="NetworkAssociationSupport">
<description>Network association support.</description>
</extension>
<extension alias="os-networks" updated="2011-12-23T00:00:00+00:00" namespace="http://docs.openstack.org/compute/ext/os-networks/api/v1.1" name="OSNetworks">
<description>Tenant-based Network Management Extension</description>
<description>Tenant-based Network Management Extension.</description>
</extension>
<extension alias="os-quota-class-sets" updated="2012-03-12T00:00:00+00:00" namespace="http://docs.openstack.org/compute/ext/quota-classes-sets/api/v1.1" name="QuotaClasses">
<description>Quota classes management support.</description>

View File

@ -151,7 +151,7 @@ class AdminNetworkController(wsgi.Controller):
class Admin_networks(extensions.ExtensionDescriptor):
"""Admin-only Network Management Extension"""
"""Admin-only Network Management Extension."""
name = "AdminNetworks"
alias = "os-admin-networks"

View File

@ -187,7 +187,7 @@ class NetworkController(object):
class Os_networks(extensions.ExtensionDescriptor):
"""Tenant-based Network Management Extension"""
"""Tenant-based Network Management Extension."""
name = "OSNetworks"
alias = "os-networks"

View File

@ -66,7 +66,7 @@ class ServerPasswordController(object):
class Server_password(extensions.ExtensionDescriptor):
"""Server password support"""
"""Server password support."""
name = "ServerPassword"
alias = "os-server-password"

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
""" utilities for multiple APIs"""
"""utilities for multiple APIs."""
from nova import db
from nova.openstack.common import cfg

View File

@ -1622,32 +1622,32 @@ def instance_fault_get_by_instance_uuids(context, instance_uuids):
def action_start(context, values):
"""Start an action for an instance"""
"""Start an action for an instance."""
return IMPL.action_start(context, values)
def action_finish(context, values):
"""Finish an action for an instance"""
"""Finish an action for an instance."""
return IMPL.action_finish(context, values)
def actions_get(context, uuid):
"""Get all instance actions for the provided instance"""
"""Get all instance actions for the provided instance."""
return IMPL.actions_get(context, uuid)
def action_get_by_id(context, uuid, action_id):
"""Get the action by id and given instance"""
"""Get the action by id and given instance."""
return IMPL.action_get_by_id(context, uuid, action_id)
def action_event_start(context, values):
"""Start an event on an instance action"""
"""Start an event on an instance action."""
return IMPL.action_event_start(context, values)
def action_event_finish(context, values):
"""Finish an event on an instance action"""
"""Finish an event on an instance action."""
return IMPL.action_event_finish(context, values)

View File

@ -4595,7 +4595,7 @@ def actions_get(context, instance_uuid):
def action_get_by_id(context, instance_uuid, action_id):
"""Get the action by id and given instance"""
"""Get the action by id and given instance."""
action = model_query(context, models.InstanceAction).\
filter_by(instance_uuid=instance_uuid).\
filter_by(id=action_id).\
@ -4614,7 +4614,7 @@ def _action_get_by_request_id(context, instance_uuid, request_id,
def action_event_start(context, values):
"""Start an event on an instance action"""
"""Start an event on an instance action."""
session = get_session()
with session.begin():
action = _action_get_by_request_id(context, values['instance_uuid'],
@ -4634,7 +4634,7 @@ def action_event_start(context, values):
def action_event_finish(context, values):
"""Finish an event on an instance action"""
"""Finish an event on an instance action."""
session = get_session()
with session.begin():
action = _action_get_by_request_id(context, values['instance_uuid'],

View File

@ -985,7 +985,7 @@ class InstanceFault(BASE, NovaBase):
class InstanceAction(BASE, NovaBase):
"""Track client actions on an instance"""
"""Track client actions on an instance."""
__tablename__ = 'instance_actions'
id = Column(Integer, primary_key=True, nullable=False, autoincrement=True)
action = Column(String(255))
@ -1001,7 +1001,7 @@ class InstanceAction(BASE, NovaBase):
class InstanceActionEvent(BASE, NovaBase):
"""Track events that occur during an InstanceAction"""
"""Track events that occur during an InstanceAction."""
__tablename__ = 'instance_actions_events'
id = Column(Integer, primary_key=True, nullable=False, autoincrement=True)
event = Column(String(255))

View File

@ -3475,7 +3475,7 @@ class ComputeTestCase(BaseTestCase):
db.instance_destroy(c, inst_uuid)
def test_rebuild_on_host_instance_exists(self):
"""Rebuild if instance exists raise an exception"""
"""Rebuild if instance exists raise an exception."""
# creating testdata
c = self.context.elevated()

View File

@ -540,7 +540,7 @@ class DbApiTestCase(test.TestCase):
self.assertEqual(expected, instance_faults)
def test_instance_action_start(self):
"""Create an instance action"""
"""Create an instance action."""
ctxt = context.get_admin_context()
uuid = str(stdlib_uuid.uuid4())
@ -563,7 +563,7 @@ class DbApiTestCase(test.TestCase):
self.assertEqual(ctxt.project_id, actions[0]['project_id'])
def test_instance_action_finish(self):
"""Create an instance action"""
"""Create an instance action."""
ctxt = context.get_admin_context()
uuid = str(stdlib_uuid.uuid4())
@ -593,7 +593,7 @@ class DbApiTestCase(test.TestCase):
self.assertEqual(ctxt.project_id, actions[0]['project_id'])
def test_instance_actions_get_by_instance(self):
"""Ensure we can get actions by UUID"""
"""Ensure we can get actions by UUID."""
ctxt1 = context.get_admin_context()
ctxt2 = context.get_admin_context()
uuid1 = str(stdlib_uuid.uuid4())
@ -625,7 +625,7 @@ class DbApiTestCase(test.TestCase):
self.assertEqual('run_instance', actions[1]['action'])
def test_instance_action_get_by_instance_and_action(self):
"""Ensure we can get an action by instance UUID and action id"""
"""Ensure we can get an action by instance UUID and action id."""
ctxt1 = context.get_admin_context()
ctxt2 = context.get_admin_context()
uuid1 = str(stdlib_uuid.uuid4())
@ -657,7 +657,7 @@ class DbApiTestCase(test.TestCase):
self.assertEqual(ctxt1.request_id, action['request_id'])
def test_instance_action_event_start(self):
"""Create an instance action event"""
"""Create an instance action event."""
ctxt = context.get_admin_context()
uuid = str(stdlib_uuid.uuid4())
@ -683,7 +683,7 @@ class DbApiTestCase(test.TestCase):
self.assertEqual(start_time, events[0]['start_time'])
def test_instance_action_event_finish(self):
"""Finish an instance action event"""
"""Finish an instance action event."""
ctxt = context.get_admin_context()
uuid = str(stdlib_uuid.uuid4())
@ -717,7 +717,7 @@ class DbApiTestCase(test.TestCase):
self.assertEqual(finish_time, events[0]['finish_time'])
def test_instance_action_event_get_by_id(self):
"""Get a specific instance action event"""
"""Get a specific instance action event."""
ctxt1 = context.get_admin_context()
ctxt2 = context.get_admin_context()
uuid1 = str(stdlib_uuid.uuid4())

View File

@ -154,17 +154,17 @@ def get_deploy_ari_id(instance):
def get_image_dir_path(instance):
"""Generate the dir for an instances disk"""
"""Generate the dir for an instances disk."""
return os.path.join(CONF.instances_path, instance['name'])
def get_image_file_path(instance):
"""Generate the full path for an instances disk"""
"""Generate the full path for an instances disk."""
return os.path.join(CONF.instances_path, instance['name'], 'disk')
def get_pxe_config_file_path(instance):
"""Generate the path for an instances PXE config file"""
"""Generate the path for an instances PXE config file."""
return os.path.join(CONF.baremetal.tftp_root, instance['uuid'], 'config')
@ -185,7 +185,7 @@ def get_partition_sizes(instance):
def get_pxe_mac_path(mac):
"""Convert a MAC address into a PXE config file name"""
"""Convert a MAC address into a PXE config file name."""
return os.path.join(
CONF.baremetal.tftp_root,
'pxelinux.cfg',
@ -232,7 +232,7 @@ def get_tftp_image_info(instance):
class PXE(base.NodeDriver):
"""PXE bare metal driver"""
"""PXE bare metal driver."""
def __init__(self):
super(PXE, self).__init__()
@ -352,7 +352,7 @@ class PXE(base.NodeDriver):
def cache_images(self, context, node, instance,
admin_password, image_meta, injected_files, network_info):
"""Prepare all the images for this instance"""
"""Prepare all the images for this instance."""
tftp_image_info = get_tftp_image_info(instance)
self._cache_tftp_images(context, instance, tftp_image_info)
@ -361,7 +361,7 @@ class PXE(base.NodeDriver):
injected_files, admin_password)
def destroy_images(self, context, node, instance):
"""Delete instance's image file"""
"""Delete instance's image file."""
bm_utils.unlink_without_raise(get_image_file_path(instance))
bm_utils.unlink_without_raise(get_image_dir_path(instance))
@ -420,7 +420,7 @@ class PXE(base.NodeDriver):
bm_utils.create_link_without_raise(pxe_config_file_path, mac_path)
def deactivate_bootloader(self, context, node, instance):
"""Delete PXE bootloader images and config"""
"""Delete PXE bootloader images and config."""
try:
image_info = get_tftp_image_info(instance)
except exception.NovaException:

View File

@ -22,7 +22,7 @@ import subprocess
def execute_get_output(*command):
"""Execute and return stdout"""
"""Execute and return stdout."""
devnull = open(os.devnull, 'w')
command = map(str, command)
proc = subprocess.Popen(command, close_fds=True,
@ -32,7 +32,7 @@ def execute_get_output(*command):
def execute(*command):
"""Execute without returning stdout"""
"""Execute without returning stdout."""
devnull = open(os.devnull, 'w')
command = map(str, command)
proc = subprocess.Popen(command, close_fds=True,

View File

@ -38,7 +38,7 @@ pluginlib.configure_logging("xenstore")
class XenstoreError(pluginlib.PluginError):
"""Errors that occur when calling xenstore-* through subprocesses"""
"""Errors that occur when calling xenstore-* through subprocesses."""
def __init__(self, cmd, return_code, stderr, stdout):
msg = "cmd: %s; returncode: %d; stderr: %s; stdout: %s"

View File

@ -63,7 +63,7 @@ class SmokeTestCase(unittest.TestCase):
return status == 0
def wait_for_running(self, instance, tries=60, wait=1):
"""Wait for instance to be running"""
"""Wait for instance to be running."""
for x in xrange(tries):
instance.update()
if instance.state.startswith('running'):
@ -73,7 +73,7 @@ class SmokeTestCase(unittest.TestCase):
return False
def wait_for_deleted(self, instance, tries=60, wait=1):
"""Wait for instance to be deleted"""
"""Wait for instance to be deleted."""
for x in xrange(tries):
try:
#NOTE(dprince): raises exception when instance id disappears
@ -85,7 +85,7 @@ class SmokeTestCase(unittest.TestCase):
return False
def wait_for_ping(self, ip, command="ping", tries=120):
"""Wait for ip to be pingable"""
"""Wait for ip to be pingable."""
for x in xrange(tries):
if self.can_ping(ip, command):
return True
@ -93,7 +93,7 @@ class SmokeTestCase(unittest.TestCase):
return False
def wait_for_ssh(self, ip, key_name, tries=30, wait=5):
"""Wait for ip to be sshable"""
"""Wait for ip to be sshable."""
for x in xrange(tries):
try:
conn = self.connect_ssh(ip, key_name)
@ -141,9 +141,7 @@ class SmokeTestCase(unittest.TestCase):
**kwargs)
def split_clc_url(self, clc_url):
"""
Splits a cloud controller endpoint url.
"""
"""Splits a cloud controller endpoint url."""
parts = httplib.urlsplit(clc_url)
is_secure = parts.scheme == 'https'
ip, port = parts.netloc.split(':')