]> www.infradead.org Git - users/hch/nvmetcli.git/commitdiff
nvmetcli: pep8 fixes
authorChristoph Hellwig <hch@lst.de>
Sat, 6 Oct 2018 12:31:02 +0000 (14:31 +0200)
committerChristoph Hellwig <hch@lst.de>
Sat, 6 Oct 2018 12:39:17 +0000 (14:39 +0200)
Signed-off-by: Christoph Hellwig <hch@lst.de>
nvmetcli

index 131d7845262c91472a186637f71ea89537f017a3..03a1e9f30a7a1b91fede32f9cc4311a87e685d69 100755 (executable)
--- a/nvmetcli
+++ b/nvmetcli
@@ -27,9 +27,11 @@ import nvmet as nvme
 from string import hexdigits
 import uuid
 
+
 def ngiud_set(nguid):
     return any(c in hexdigits and c != '0' for c in nguid)
 
+
 class UINode(configshell.node.ConfigNode):
     def __init__(self, name, parent=None, cfnode=None, shell=None):
         configshell.node.ConfigNode.__init__(self, name, parent, shell)
@@ -166,9 +168,10 @@ class UISubsystemNode(UINode):
 
     def summary(self):
         info = []
-        info.append("version=" + self.cfnode.get_attr("attr","version"))
-        info.append("allow_any=" + self.cfnode.get_attr("attr","allow_any_host"))
-        info.append("serial=" + self.cfnode.get_attr("attr","serial"))
+        info.append("version=" + self.cfnode.get_attr("attr", "version"))
+        info.append("allow_any=" +
+                    self.cfnode.get_attr("attr", "allow_any_host"))
+        info.append("serial=" + self.cfnode.get_attr("attr", "serial"))
         return (", ".join(info), True)
 
 
@@ -370,7 +373,8 @@ class UIPortNode(UINode):
     ui_desc_addr = {
         'adrfam': ('string', 'Address Family (e.g. ipv4 or fc)'),
         'treq': ('string', 'Transport Security Requirements'),
-        'traddr': ('string', 'Transport Address (e.g. IP Address or FC wwnn:wwpn)'),
+        'traddr': ('string',
+                   'Transport Address (e.g. IP Address or FC wwnn:wwpn)'),
         'trsvcid': ('string', 'Transport Service ID (e.g. IP Port)'),
         'trtype': ('string', 'Transport Type (e.g. rdma or loop or fc)'),
     }
@@ -391,18 +395,19 @@ class UIPortNode(UINode):
         if trsvcid != "none":
             info.append("trsvcid=%s" % trsvcid)
 
-       '''
-       Support older target driver w/o the inline_data_size parameter
-       '''
-       try:
-               inline_data_size = self.cfnode.get_attr("param", "inline_data_size")
-       except:
-               inline_data_size = "n/a"
-       if inline_data_size != "n/a":
-               info.append("inline_data_size=" + inline_data_size);
+        '''
+        Support older target driver w/o the inline_data_size parameter
+        '''
+        try:
+            inline_data_size = self.cfnode.get_attr("param", "inline_data_size")
+        except Exception as e:
+            inline_data_size = "n/a"
+        if inline_data_size != "n/a":
+            info.append("inline_data_size=" + inline_data_size)
         enabled = not (not self.cfnode.subsystems and not list(self.cfnode.referrals))
         return (", ".join(info), True if enabled else 0)
 
+
 class UIPortSubsystemsNode(UINode):
     def __init__(self, parent):
         UINode.__init__(self, 'subsystems', parent)
@@ -501,7 +506,8 @@ class UIReferralNode(UINode):
     ui_desc_addr = {
         'adrfam': ('string', 'Address Family (e.g. ipv4 or fc)'),
         'treq': ('string', 'Transport Security Requirements'),
-        'traddr': ('string', 'Transport Address (e.g. IP Address or FC wwnn:wwpn)'),
+        'traddr': ('string',
+                   'Transport Address (e.g. IP Address or FC wwnn:wwpn)'),
         'trsvcid': ('string', 'Transport Service ID (e.g. IP Port)'),
         'trtype': ('string', 'Transport Type (e.g. rdma or loop or fc)'),
         'portid': ('number', 'Port identifier'),
@@ -665,5 +671,6 @@ def main():
         except Exception as msg:
             shell.log.error(str(msg))
 
+
 if __name__ == "__main__":
     main()