Skip to content
Snippets Groups Projects
Commit 64946077 authored by Christoph Hellwig's avatar Christoph Hellwig
Browse files

pep8


Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 1ad60d72
Branches
No related tags found
No related merge requests found
......@@ -73,26 +73,26 @@ class CFSNode(object):
if mode not in ['any', 'lookup', 'create']:
raise CFSError("Invalid mode: %s" % mode)
if self.exists and mode == 'create':
raise CFSError("This %s already exists in configFS"
% self.__class__.__name__)
raise CFSError("This %s already exists in configFS" %
self.__class__.__name__)
elif not self.exists and mode == 'lookup':
raise CFSNotFound("No such %s in configfs: %s"
% (self.__class__.__name__, self.path))
raise CFSNotFound("No such %s in configfs: %s" %
(self.__class__.__name__, self.path))
if not self.exists:
try:
os.mkdir(self.path)
except:
raise CFSError("Could not create %s in configFS"
% self.__class__.__name__)
raise CFSError("Could not create %s in configFS" %
self.__class__.__name__)
def _exists(self):
return os.path.isdir(self.path)
def _check_self(self):
if not self.exists:
raise CFSNotFound("This %s does not exist in configFS"
% self.__class__.__name__)
raise CFSNotFound("This %s does not exist in configFS" %
self.__class__.__name__)
def list_attrs(self, group, writable=None):
'''
......@@ -184,7 +184,8 @@ class CFSNode(object):
with open(path, 'w') as file_fd:
file_fd.write(str(value))
except Exception as e:
raise CFSError("Cannot enable attribute %s: %s (%s)" % (self.path, e, value))
raise CFSError("Cannot enable attribute %s: %s (%s)" %
(self.path, e, value))
self._enable = value
def delete(self):
......@@ -488,8 +489,7 @@ class Namespace(CFSNode):
subsystem = property(_get_subsystem,
doc="Get the parent Subsystem object.")
nsid = property(_get_nsid,
doc="Get the NSID as an int.")
nsid = property(_get_nsid, doc="Get the NSID as an int.")
@classmethod
def setup(cls, subsys, n, err_func):
......
......@@ -38,10 +38,11 @@ class UINode(configshell.node.ConfigNode):
def _init_group(self, group):
setattr(self.__class__, "ui_getgroup_%s" % group,
lambda self, attr: self.cfnode.get_attr(group, attr))
lambda self, attr:
self.cfnode.get_attr(group, attr))
setattr(self.__class__, "ui_setgroup_%s" % group,
lambda self, attr, value: self.cfnode.set_attr(group, attr, value))
lambda self, attr, value:
self.cfnode.set_attr(group, attr, value))
attrs = self.cfnode.list_attrs(group)
attrs_ro = self.cfnode.list_attrs(group, writable=False)
......@@ -87,7 +88,8 @@ class UINode(configshell.node.ConfigNode):
class UIRootNode(UINode):
def __init__(self, shell):
UINode.__init__(self, '/', parent=None, cfnode=nvme.Root(), shell=shell)
UINode.__init__(self, '/', parent=None, cfnode=nvme.Root(),
shell=shell)
def refresh(self):
self._children = set([])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment