diff src/bridge/bridge_constructor/bridge_contructor.py @ 587:952322b1d490

Remove trailing whitespaces.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 18 Jan 2013 17:55:34 +0100
parents ca13633d3b6b
children beaf6bec2fcd
line wrap: on
line diff
--- a/src/bridge/bridge_constructor/bridge_contructor.py	Fri Jan 18 17:55:27 2013 +0100
+++ b/src/bridge/bridge_constructor/bridge_contructor.py	Fri Jan 18 17:55:34 2013 +0100
@@ -53,11 +53,11 @@
 
 
 class ParseError(Exception):
-    #Used when the signature parsing is going wrong (invalid signature ?) 
+    #Used when the signature parsing is going wrong (invalid signature ?)
     pass
 
 class Constructor:
-    
+
     def __init__(self, bridge_template, options):
         self.bridge_template = bridge_template
         self.options = options
@@ -74,14 +74,14 @@
                 value = None
             function[option] = value
         return function
-    
+
     def getDefault(self, name):
         """Return default values of a function in a dict
         @param name: Name of the function to get
         @return: dict, each key is the integer param number (no key if no default value)"""
         default_dict={}
         def_re = re.compile(r"param_(\d+)_default")
-        
+
         for option in self.bridge_template.options(name):
             match = def_re.match(option)
             if match:
@@ -90,7 +90,7 @@
                 except ValueError:
                     raise ParseError("Invalid value [%s] for parameter number" % match.group(1))
                 default_dict[idx] = self.bridge_template.get(name, option)
-        
+
         return default_dict
 
     def getFlags(self, name):
@@ -102,7 +102,7 @@
             if option in FLAGS:
                 flags.append(option)
         return flags
-    
+
     def getArgumentsDoc(self, name):
         """Return documentation of arguments
         @param name: Name of the function to get
@@ -175,10 +175,10 @@
         @param name: dictionary of arguments name like given by getArguments
         @param default: dictionary of default values, like given by getDefault
         @param unicode_protect: activate unicode protection on strings (return strings as unicode(str))
-        @return: list of arguments that correspond to a signature (e.g.: "sss" return "arg1, arg2, arg3")""" 
+        @return: list of arguments that correspond to a signature (e.g.: "sss" return "arg1, arg2, arg3")"""
         idx=0
         attr_string=[]
-        
+
         for arg in self.argumentsParser(signature):
             attr_string.append(("unicode(%(name)s)%(default)s" if (unicode_protect and arg=='s') else "%(name)s%(default)s") % {
                 'name':name[idx][0] if (name and name.has_key(idx)) else "arg_%i" % idx,
@@ -186,7 +186,7 @@
                 }) #give arg_1, arg2, etc or name1, name2=default, etc. \
                    #give unicode(arg_1), unicode(arg_2), etc. if unicode_protect is set and arg is a string
             idx+=1
-        
+
         return ", ".join(attr_string)
 
     def generateCoreSide(self):
@@ -209,7 +209,7 @@
                 os.mkdir(DEST_DIR)
             full_path=os.path.join(DEST_DIR,filename)
             if os.path.exists(full_path) and not self.options.force:
-                print ("The destination file [%s] already exists ! Use --force to overwrite it" % full_path) 
+                print ("The destination file [%s] already exists ! Use --force to overwrite it" % full_path)
             try:
                 with open(full_path,'w') as dest_file:
                     dest_file.write('\n'.join(file_buf))
@@ -223,8 +223,8 @@
 
     def __init__(self, bridge_template, options):
         Constructor.__init__(self, bridge_template, options)
-        self.core_template="mediawiki_template.tpl" 
-        self.core_dest="mediawiki.wiki" 
+        self.core_template="mediawiki_template.tpl"
+        self.core_dest="mediawiki.wiki"
 
     def _addTextDecorations(self, text):
         """Add text decorations like coloration or shortcuts"""
@@ -259,7 +259,7 @@
             if arg_default.has_key(i):
                 wiki.append(":''DEFAULT: %s''" % arg_default[i])
         return "\n".join(wiki)
-         
+
     def _wikiReturn(self, name):
         """Format return doc with the wiki syntax
         @param name: name of the function
@@ -317,7 +317,7 @@
 %(async)s
 {| class="wikitable" style="text-align:left; width:80%%;"
 ! scope=row | category
-| %(category)s 
+| %(category)s
 |-
 %(signature)s
 ! scope=row | parameters
@@ -325,7 +325,7 @@
 %(parameters)s%(return)s
 |}
 """ % completion)
-        
+
         #at this point, signals_part, and methods_part should be filled,
         #we just have to place them in the right part of the template
         core_bridge = []
@@ -342,7 +342,7 @@
                         core_bridge.append(line.replace('\n',''))
         except IOError:
             print ("Can't open template file [%s]" % self.core_template)
-            sys.exit(1) 
+            sys.exit(1)
 
         #now we write to final file
         self.finalWrite(self.core_dest, core_bridge)
@@ -351,9 +351,9 @@
 
     def __init__(self, bridge_template, options):
         Constructor.__init__(self, bridge_template, options)
-        self.core_template="dbus_core_template.py" 
-        self.frontend_template="dbus_frontend_template.py" 
-        self.frontend_dest = self.core_dest="DBus.py" 
+        self.core_template="dbus_core_template.py"
+        self.frontend_template="dbus_frontend_template.py"
+        self.frontend_dest = self.core_dest="DBus.py"
 
     def generateCoreSide(self):
         signals_part = []
@@ -371,7 +371,7 @@
         'sig_in':function['sig_in'] or '',
         'sig_out':function['sig_out'] or '',
         'category':'PLUGIN' if function['category'] == 'plugin' else 'CORE',
-        'name':section, 
+        'name':section,
         'args':self.getArguments(function['sig_in'], name=arg_doc, default=default )
         }
 
@@ -427,7 +427,7 @@
                         core_bridge.append(line.replace('\n',''))
         except IOError:
             print ("Can't open template file [%s]" % self.core_template)
-            sys.exit(1) 
+            sys.exit(1)
 
         #now we write to final file
         self.finalWrite(self.core_dest, core_bridge)
@@ -446,7 +446,7 @@
         'sig_in':function['sig_in'] or '',
         'sig_out':function['sig_out'] or '',
         'category':'plugin' if function['category'] == 'plugin' else 'core',
-        'name':section, 
+        'name':section,
         'args':self.getArguments(function['sig_in'], name=arg_doc, default=default)
         }
 
@@ -483,7 +483,7 @@
                         frontend_bridge.append(line.replace('\n',''))
         except IOError:
             print ("Can't open template file [%s]" % self.frontend_template)
-            sys.exit(1) 
+            sys.exit(1)
 
         #now we write to final file
         self.finalWrite(self.frontend_dest, frontend_bridge)
@@ -493,8 +493,8 @@
 
     def __init__(self, bridge_template, options):
         Constructor.__init__(self, bridge_template, options)
-        
-        self.template="dbus_xml_template.xml" 
+
+        self.template="dbus_xml_template.xml"
         self.core_dest="org.goffi.sat.xml"
         self.default_annotation = { 'a{ss}': 'StringDict',
                                     'a(sa{ss}as)': 'QList<Contact>',
@@ -540,7 +540,7 @@
                         annot_elt.setAttribute('value', self.default_annotation[arg])
                         new_elt.appendChild(annot_elt)
                 idx+=1
-            
+
             if function['sig_out']:
                 arg_elt = doc.createElement('arg')
                 arg_elt.setAttribute('type', function['sig_out'])
@@ -575,7 +575,7 @@
 class BridgeConstructor:
     def __init__(self):
         self.options = None
-    
+
     def check_options(self):
         """Check command line options"""
         _usage="""
@@ -597,7 +597,7 @@
                     help=("Add debug information printing"))
         parser.add_option("--no_unicode", action="store_false", dest="unicode", default=True,
                     help=("Remove unicode type protection from string results"))
-        parser.add_option("--flags", action="store", type="string", 
+        parser.add_option("--flags", action="store", type="string",
                     help=("Constructors' specific flags, comma separated"))