fix N402 for rest of nova

fix N402 (single line docstrings should end in a period) for
rest of nova files

Change-Id: I57d0d9ab01345dd83e544e476d79d2c2ca68ee51
This commit is contained in:
Sean Dague
2013-01-08 17:00:49 -05:00
parent 1ba06cc315
commit f784d83703
6 changed files with 23 additions and 23 deletions

View File

@@ -62,7 +62,7 @@ def is_swap_or_ephemeral(device_name):
def mappings_prepend_dev(mappings): def mappings_prepend_dev(mappings):
"""Prepend '/dev/' to 'device' entry of swap/ephemeral virtual type""" """Prepend '/dev/' to 'device' entry of swap/ephemeral virtual type."""
for m in mappings: for m in mappings:
virtual = m['virtual'] virtual = m['virtual']
if (is_swap_or_ephemeral(virtual) and if (is_swap_or_ephemeral(virtual) and
@@ -75,7 +75,7 @@ _dev = re.compile('^/dev/')
def strip_dev(device_name): def strip_dev(device_name):
"""remove leading '/dev/'""" """remove leading '/dev/'."""
return _dev.sub('', device_name) if device_name else device_name return _dev.sub('', device_name) if device_name else device_name
@@ -83,7 +83,7 @@ _pref = re.compile('^((x?v|s)d)')
def strip_prefix(device_name): def strip_prefix(device_name):
"""remove both leading /dev/ and xvd or sd or vd """ """remove both leading /dev/ and xvd or sd or vd."""
device_name = strip_dev(device_name) device_name = strip_dev(device_name)
return _pref.sub('', device_name) return _pref.sub('', device_name)
@@ -139,7 +139,7 @@ def instance_block_mapping(instance, bdms):
def match_device(device): def match_device(device):
"""Matches device name and returns prefix, suffix""" """Matches device name and returns prefix, suffix."""
match = re.match("(^/dev/x{0,1}[a-z]{0,1}d{0,1})([a-z]+)[0-9]*$", device) match = re.match("(^/dev/x{0,1}[a-z]{0,1}d{0,1})([a-z]+)[0-9]*$", device)
if not match: if not match:
return None return None

View File

@@ -15,7 +15,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
"""Policy Engine For Nova""" """Policy Engine For Nova."""
import os.path import os.path

View File

@@ -20,7 +20,7 @@ import re
class CommandFilter(object): class CommandFilter(object):
"""Command filter only checking that the 1st argument matches exec_path""" """Command filter only checking that the 1st argument matches exec_path."""
def __init__(self, exec_path, run_as, *args): def __init__(self, exec_path, run_as, *args):
self.name = '' self.name = ''
@@ -30,7 +30,7 @@ class CommandFilter(object):
self.real_exec = None self.real_exec = None
def get_exec(self, exec_dirs=[]): def get_exec(self, exec_dirs=[]):
"""Returns existing executable, or empty string if none found""" """Returns existing executable, or empty string if none found."""
if self.real_exec is not None: if self.real_exec is not None:
return self.real_exec return self.real_exec
self.real_exec = "" self.real_exec = ""
@@ -46,7 +46,7 @@ class CommandFilter(object):
return self.real_exec return self.real_exec
def match(self, userargs): def match(self, userargs):
"""Only check that the first argument (command) matches exec_path""" """Only check that the first argument (command) matches exec_path."""
if (os.path.basename(self.exec_path) == userargs[0]): if (os.path.basename(self.exec_path) == userargs[0]):
return True return True
return False return False
@@ -60,12 +60,12 @@ class CommandFilter(object):
return [to_exec] + userargs[1:] return [to_exec] + userargs[1:]
def get_environment(self, userargs): def get_environment(self, userargs):
"""Returns specific environment to set, None if none""" """Returns specific environment to set, None if none."""
return None return None
class RegExpFilter(CommandFilter): class RegExpFilter(CommandFilter):
"""Command filter doing regexp matching for every argument""" """Command filter doing regexp matching for every argument."""
def match(self, userargs): def match(self, userargs):
# Early skip if command or number of args don't match # Early skip if command or number of args don't match
@@ -89,7 +89,7 @@ class RegExpFilter(CommandFilter):
class DnsmasqFilter(CommandFilter): class DnsmasqFilter(CommandFilter):
"""Specific filter for the dnsmasq call (which includes env)""" """Specific filter for the dnsmasq call (which includes env)."""
CONFIG_FILE_ARG = 'CONFIG_FILE' CONFIG_FILE_ARG = 'CONFIG_FILE'
@@ -114,7 +114,7 @@ class DnsmasqFilter(CommandFilter):
class DeprecatedDnsmasqFilter(DnsmasqFilter): class DeprecatedDnsmasqFilter(DnsmasqFilter):
"""Variant of dnsmasq filter to support old-style FLAGFILE""" """Variant of dnsmasq filter to support old-style FLAGFILE."""
CONFIG_FILE_ARG = 'FLAGFILE' CONFIG_FILE_ARG = 'FLAGFILE'
@@ -164,7 +164,7 @@ class KillFilter(CommandFilter):
class ReadFileFilter(CommandFilter): class ReadFileFilter(CommandFilter):
"""Specific filter for the utils.read_file_as_root call""" """Specific filter for the utils.read_file_as_root call."""
def __init__(self, file_path, *args): def __init__(self, file_path, *args):
self.file_path = file_path self.file_path = file_path

View File

@@ -93,7 +93,7 @@ def setup_syslog(execname, facility, level):
def build_filter(class_name, *args): def build_filter(class_name, *args):
"""Returns a filter object of class class_name""" """Returns a filter object of class class_name."""
if not hasattr(filters, class_name): if not hasattr(filters, class_name):
logging.warning("Skipping unknown filter class (%s) specified " logging.warning("Skipping unknown filter class (%s) specified "
"in filter definitions" % class_name) "in filter definitions" % class_name)
@@ -103,7 +103,7 @@ def build_filter(class_name, *args):
def load_filters(filters_path): def load_filters(filters_path):
"""Load filters from a list of directories""" """Load filters from a list of directories."""
filterlist = [] filterlist = []
for filterdir in filters_path: for filterdir in filters_path:
if not os.path.isdir(filterdir): if not os.path.isdir(filterdir):

View File

@@ -352,7 +352,7 @@ class ProcessLauncher(object):
return wrap return wrap
def wait(self): def wait(self):
"""Loop waiting on children to die and respawning as necessary""" """Loop waiting on children to die and respawning as necessary."""
while self.running: while self.running:
wrap = self._wait_child() wrap = self._wait_child()
if not wrap: if not wrap:

View File

@@ -692,7 +692,7 @@ def to_bytes(text, default=0):
def delete_if_exists(pathname): def delete_if_exists(pathname):
"""delete a file, but ignore file not found error""" """delete a file, but ignore file not found error."""
try: try:
os.unlink(pathname) os.unlink(pathname)
@@ -848,7 +848,7 @@ def parse_server_string(server_str):
def bool_from_str(val): def bool_from_str(val):
"""Convert a string representation of a bool into a bool value""" """Convert a string representation of a bool into a bool value."""
if not val: if not val:
return False return False
@@ -861,7 +861,7 @@ def bool_from_str(val):
def is_valid_boolstr(val): def is_valid_boolstr(val):
"""Check if the provided string is a valid bool string or not. """ """Check if the provided string is a valid bool string or not."""
val = str(val).lower() val = str(val).lower()
return val == 'true' or val == 'false' or \ return val == 'true' or val == 'false' or \
val == 'yes' or val == 'no' or \ val == 'yes' or val == 'no' or \
@@ -950,7 +950,7 @@ def monkey_patch():
def convert_to_list_dict(lst, label): def convert_to_list_dict(lst, label):
"""Convert a value or list into a list of dicts""" """Convert a value or list into a list of dicts."""
if not lst: if not lst:
return None return None
if not isinstance(lst, list): if not isinstance(lst, list):
@@ -959,7 +959,7 @@ def convert_to_list_dict(lst, label):
def timefunc(func): def timefunc(func):
"""Decorator that logs how long a particular function took to execute""" """Decorator that logs how long a particular function took to execute."""
@functools.wraps(func) @functools.wraps(func)
def inner(*args, **kwargs): def inner(*args, **kwargs):
start_time = time.time() start_time = time.time()
@@ -1000,7 +1000,7 @@ def make_dev_path(dev, partition=None, base='/dev'):
def total_seconds(td): def total_seconds(td):
"""Local total_seconds implementation for compatibility with python 2.6""" """Local total_seconds implementation for compatibility with python 2.6."""
if hasattr(td, 'total_seconds'): if hasattr(td, 'total_seconds'):
return td.total_seconds() return td.total_seconds()
else: else:
@@ -1167,7 +1167,7 @@ def strcmp_const_time(s1, s2):
def walk_class_hierarchy(clazz, encountered=None): def walk_class_hierarchy(clazz, encountered=None):
"""Walk class hierarchy, yielding most derived classes first""" """Walk class hierarchy, yielding most derived classes first."""
if not encountered: if not encountered:
encountered = [] encountered = []
for subclass in clazz.__subclasses__(): for subclass in clazz.__subclasses__():