python3 - 2to3 + miscell obvious tweaks
[sfa.git] / sfatables / commands / List.py
index 86d52a2..20576ba 100644 (file)
@@ -1,8 +1,7 @@
 import os, time
 import libxml2
-import pdb
 
-from sfatables.globals import *
+from sfatables.globals import sfatables_config
 from sfatables.pretty import Pretty
 from sfatables.command import Command
 
@@ -28,7 +27,6 @@ class List(Command):
         value_nodes = p.xpathEval("//rule/argument[value!='']/value")
         element_nodes = p.xpathEval("//argument[value!='']/parent::rule/@element")
 
-        print element_nodes, type, xmlextension_path
         if (len(element_nodes)>1):
             raise Exception("Invalid rule %s contains multiple elements."%xmlextension_path)
 
@@ -40,8 +38,8 @@ class List(Command):
             names = [n.content for n in name_nodes]
             values = [v.content for v in value_nodes]
 
-            name_values = zip(names,values)
-            name_value_pairs = map(lambda (n,v):n+'='+v, name_values)
+            name_values = list(zip(names,values))
+            name_value_pairs = [n_v[0]+'='+n_v[1] for n_v in name_values]
 
             argument_str = ",".join(name_value_pairs)
 
@@ -60,13 +58,13 @@ class List(Command):
                     (magic,number,type) = file.split('-')
                     rule_numbers[int(number)]=1
 
-        rule_list = rule_numbers.keys()
+        rule_list = list(rule_numbers.keys())
         rule_list.sort()
         return rule_list
 
     def call(self, command_options, match_options, target_options):
         if (len(command_options.args) < 1):
-            print "Please specify the name of the chain you would like to list, e.g. sfatables -L INCOMING."
+            print("Please specify the name of the chain you would like to list, e.g. sfatables -L INCOMING.")
             return
 
         chain = command_options.args[0]