Changeset 833

Show
Ignore:
Timestamp:
03/07/08 14:46:43 (9 months ago)
Author:
sontag
Message:

closes #24. removed the unused filename arg from the IrafPar?* class constructors. added a deprecation warning to makeIrafPar - eventually its filename arg will be removed

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/cl2py.py

    r789 r833  
    105105        #raise TypeError('string must be a string') 
    106106        clInput = string 
    107         efilename = 'string_proc' 
     107        efilename = 'string_proc' # revisit this setting (tik #24), maybe '' ? 
    108108        if usecache: 
    109109            index, pycode = codeCache.get(None,mode=mode,source=clInput) 
  • trunk/lib/irafpar.py

    r803 r833  
    4545_real_types = [ 'r', 'd' ] 
    4646 
    47 def IrafParFactory(fields,filename=None,strict=0): 
     47def IrafParFactory(fields, strict=0): 
    4848 
    4949    """IRAF parameter factory 
     
    5959    type = fields[1] 
    6060    if type in _string_types: 
    61         return IrafParS(fields,filename,strict) 
     61        return IrafParS(fields,strict) 
    6262    elif type in _string_list_types: 
    63         return IrafParLS(fields,filename,strict) 
     63        return IrafParLS(fields,strict) 
    6464    elif type == "*gcur" or type == "gcur": 
    65         return IrafParGCur(fields,filename,strict) 
     65        return IrafParGCur(fields,strict) 
    6666    elif type == "*imcur" or type == "imcur": 
    67         return IrafParImCur(fields,filename,strict) 
     67        return IrafParImCur(fields,strict) 
    6868    elif type == "*ukey" or type == "ukey": 
    69         return IrafParUKey(fields,filename,strict) 
     69        return IrafParUKey(fields,strict) 
    7070    elif type == "pset": 
    71         return IrafParPset(fields,filename,strict) 
     71        return IrafParPset(fields,strict) 
    7272    elif type in _real_types: 
    73         return IrafParR(fields,filename,strict) 
     73        return IrafParR(fields,strict) 
    7474    elif type == "i": 
    75         return IrafParI(fields,filename,strict) 
     75        return IrafParI(fields,strict) 
    7676    elif type == "b": 
    77         return IrafParB(fields,filename,strict) 
     77        return IrafParB(fields,strict) 
    7878    elif type == "ar": 
    79         return IrafParAR(fields,filename,strict) 
     79        return IrafParAR(fields,strict) 
    8080    elif type == "ai": 
    81         return IrafParAI(fields,filename,strict) 
     81        return IrafParAI(fields,strict) 
    8282    elif type == "as": 
    83         return IrafParAS(fields,filename,strict) 
     83        return IrafParAS(fields,strict) 
    8484    elif type == "ab": 
    85         return IrafParAB(fields,filename,strict) 
     85        return IrafParAB(fields,strict) 
    8686    elif type[:1] == "a": 
    8787        raise SyntaxError("Cannot handle arrays of type %s" % type) 
     
    114114 
    115115    """Create an IrafPar variable""" 
     116 
     117    # Deprecation note 
     118    if filename!=None and len(filename)>0 and filename!='string_proc': 
     119       warning("Use of filename arg in makeIrafPar is rather deprecated\n"+\ 
     120               ", filename = \'"+filename+"'", level=-1) 
    116121 
    117122    # if init_value is already an IrafPar, just return it 
     
    183188            fields[i] = str(fields[i]) 
    184189    try: 
    185         return IrafParFactory(fields, filename, strict=strict) 
     190        return IrafParFactory(fields, strict=strict) 
    186191    except ValueError, e: 
    187192        errmsg = "Bad value for parameter `%s'\n%s" % (name, str(e)) 
     
    245250    """Non-array IRAF parameter base class""" 
    246251 
    247     def __init__(self,fields,filename,strict=0): 
     252    def __init__(self,fields,strict=0): 
    248253        orig_len = len(fields) 
    249254        if orig_len < 3 or None in fields[0:3]: 
     
    848853    """IRAF array parameter class""" 
    849854 
    850     def __init__(self,fields,filename,strict=0): 
     855    def __init__(self,fields,strict=0): 
    851856        orig_len = len(fields) 
    852857        if orig_len < 3: 
     
    12801285    """IRAF pset parameter class""" 
    12811286 
    1282     def __init__(self,fields,filename,strict=0): 
    1283         IrafParS.__init__(self,fields,filename,strict) 
     1287    def __init__(self,fields,strict=0): 
     1288        IrafParS.__init__(self,fields,strict) 
    12841289        # omitted pset parameters default to null string 
    12851290        if self.value is None: self.value = "" 
     
    13151320    """IRAF list parameter base class""" 
    13161321 
    1317     def __init__(self,fields,filename,strict=0): 
    1318         IrafPar.__init__(self,fields,filename,strict) 
     1322    def __init__(self,fields,strict=0): 
     1323        IrafPar.__init__(self,fields,strict) 
    13191324        # filehandle for input file 
    13201325        self.__dict__['fh'] = None 
     
    25092514                i1 = mm.end() 
    25102515            try: 
    2511                 par = IrafParFactory(flist,filename,strict=strict) 
     2516                par = IrafParFactory(flist, strict=strict) 
    25122517            except KeyboardInterrupt: 
    25132518                raise