Changeset 79ba1fc in sasview


Ignore:
Timestamp:
Apr 18, 2012 8:52:17 AM (12 years ago)
Author:
Mathieu Doucet <doucetm@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
3bd7cec
Parents:
d47c349
Message:

Fixing code style problems

Location:
sansmodels/src/python_wrapper
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sansmodels/src/python_wrapper/WrapperGenerator.py

    r1b758b3 r79ba1fc  
    134134        key = "[FIXED]" 
    135135        try: 
    136             self.fixed= lineparser.readhelper(lines,key, key2,key3, file= self.file) 
     136            self.fixed= lineparser.readhelper(lines, key,  
     137                                              key2, key3, file=self.file) 
    137138        except: 
    138139           raise    
     
    140141        key = "[NON_FITTABLE_PARAMS]" 
    141142        try: 
    142             self.non_fittable= lineparser.readhelper(lines,key, key2,key3, file= self.file) 
     143            self.non_fittable= lineparser.readhelper(lines, key, key2, 
     144                                                     key3, file=self.file) 
    143145        except: 
    144146           raise    
     
    147149        key = "[ORIENTATION_PARAMS]"     
    148150        try: 
    149             self.orientation_params = lineparser.readhelper( lines,key,  
    150                                                     key2,key3, file= self.file) 
     151            self.orientation_params = lineparser.readhelper(lines, key,  
     152                                                    key2, key3, file=self.file) 
    151153        except: 
    152154           raise  
     
    452454            
    453455            # fixed list  details 
    454             newline = self.replaceToken(newline,  
    455                                         "[FIXED]",str(self.fixed)) 
    456             # non-fittable list  details 
    457             newline = self.replaceToken(newline,  
    458                                         "[NON_FITTABLE_PARAMS]",str(self.non_fittable)) 
     456            fixed_str = str(self.fixed) 
     457            fixed_str.replace(', ', '\n                      ') 
     458            newline = self.replaceToken(newline, "[FIXED]",fixed_str) 
     459             
     460            # non-fittable list details 
     461            newline = self.replaceToken(newline,  
     462                                        "[NON_FITTABLE_PARAMS]", 
     463                                        str(self.non_fittable)) 
     464             
    459465            ## parameters with orientation 
    460         
    461             newline = self.replaceToken(newline,  
    462                                "[ORIENTATION_PARAMS]",str(self.orientation_params)) 
     466            oriented_str = str(self.orientation_params) 
     467            oriented_str.replace(', ', '\n                                  ') 
     468            newline = self.replaceToken(newline,  
     469                               "[ORIENTATION_PARAMS]", oriented_str) 
    463470            
    464471            # Write new line to the wrapper .c file 
  • sansmodels/src/python_wrapper/lineparser.py

    r101065a r79ba1fc  
    5757 
    5858   
    59 def readhelper(lines,key, key2,key3 , file): 
     59def readhelper(lines, key, key2, key3 , file): 
    6060   
    6161    temp="" 
     
    6868        if line.count(key.lstrip().rstrip())>0 :#[FIXED]= ..... 
    6969            try: 
    70                 #print "found key", key 
    7170                find_fixed= True 
    7271                index = line.index(key) 
    7372                toks  = line[index:].split("=",1 ) 
    7473                temp  = toks[1].lstrip().rstrip() 
    75                 find_key2, find_key3=look_for_tag( string1=temp,begin=key2, end=key3 ) 
    76                 #print "looking for endpoints",find_key2, find_key3 
    77                 ##[key]=<text>param </text> 
     74                find_key2, find_key3=look_for_tag( string1=temp, 
     75                                                   begin=key2, end=key3 ) 
    7876                if find_key2 and find_key3: 
    79                      
    8077                    temp1=[] 
    8178                    temp2=[] 
     
    8784                    temp4=split_list(separator=',', mylist=temp3) 
    8885                    listtofill= temp3 + temp4 
    89                     #print "endpoints found",listtofill 
    9086                    return listtofill 
    9187                     
     
    106102                    temp4=split_list(separator=',', mylist=temp3) 
    107103             
    108                     if len(temp3+ temp4)==0: 
     104                    if len(temp3 + temp4)==0: 
    109105                        # [FIXED]=  only one param 
    110106                        listtofill+= temp1 
     
    136132            if not find_key2: 
    137133                raise ValueError, "Could not parse file %s" % file 
    138             #print "find_key3",find_key3,line,key3 
    139134            if find_key3: 
    140                 #print "At the ned of the file----->" 
    141135                temp1=[] 
    142136                temp2=[] 
     
    159153                    temp4=split_list(separator=',', mylist=temp1) 
    160154                 
    161                 if len(temp3+ temp4)==0:# [FIXED]=  only one param 
    162                     listtofill+= temp1 
     155                if len(temp3 + temp4)==0:# [FIXED]=  only one param 
     156                    listtofill += temp1 
    163157                listtofill+=temp3+temp4 #    
    164158                break 
    165159             
    166160            else: 
    167                 temp2=split_text(separator='//',string1=line) 
    168                 temp5=split_text(separator="\*",string1=line) 
     161                temp2=split_text(separator='//', string1=line) 
     162                temp5=split_text(separator="\*", string1=line) 
    169163                if len(temp5)>0: 
    170                     temp3=split_list(separator=';',mylist=temp5) 
     164                    temp3=split_list(separator=';', mylist=temp5) 
    171165                    temp4=split_list(separator=',', mylist=temp5) 
    172166                elif len(temp2)>0: 
    173                     temp3=split_list(separator=';',mylist=temp2) 
     167                    temp3=split_list(separator=';', mylist=temp2) 
    174168                    temp4=split_list(separator=',', mylist=temp2) 
    175169                else: 
    176170                    if look_for_tag( string1=line,begin=";")[0]:# split ";" first 
    177                         temp3=split_text(separator=';',string1=line) 
     171                        temp3=split_text(separator=';', string1=line) 
    178172                        temp4=split_list(separator=',', mylist=temp3) 
    179173                    else: 
    180                         temp3=split_text(separator=',',string1=line)# slip "," first 
     174                        temp3=split_text(separator=',', string1=line)# slip "," first 
    181175                        temp4=split_list(separator=';', mylist=temp3) 
    182176                if len(temp3+ temp4)==0:# [FIXED]=  only one param 
    183177                    if line.lstrip().rstrip()!="": 
    184                         listtofill= [line.lstrip().rstrip()] 
     178                        listtofill=[line.lstrip().rstrip()] 
    185179                listtofill+=temp3+temp4 # 
    186180                break 
  • sansmodels/src/python_wrapper/modelTemplate.txt

    rd47c349 r79ba1fc  
    1717 
    1818:WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY 
    19          DO NOT MODIFY THIS FILE, MODIFY [INCLUDE_FILE] 
     19         DO NOT MODIFY THIS FILE, MODIFY 
     20            [INCLUDE_FILE] 
    2021         AND RE-RUN THE GENERATOR SCRIPT 
    2122""" 
     
    2930    """ 
    3031    obj = [PYTHONCLASS]() 
    31     #[CPYTHONCLASS].__init__(obj) is called by [PYTHONCLASS] constructor 
     32    # [CPYTHONCLASS].__init__(obj) is called by 
     33    # the [PYTHONCLASS] constructor 
    3234    return obj 
    3335 
     
    145147         
    146148        """ 
    147         return [CPYTHONCLASS].set_dispersion(self, parameter, dispersion.cdisp) 
     149        return [CPYTHONCLASS].set_dispersion(self, 
     150               parameter, dispersion.cdisp) 
    148151         
    149152    
Note: See TracChangeset for help on using the changeset viewer.