Package iceprod :: Package core :: Module lex :: Class ExpParser
[hide private]
[frames] | no frames]

Class ExpParser

source code

Known Subclasses:

Expression parsing class for parameter values.

Instance Methods [hide private]
 
__init__(self, opts={}, steering=Steering(), cache=False, noeval=False) source code
 
AddSysOpt(self, name, value) source code
 
AddOpt(self, name, value) source code
 
AddSteering(self, name, value) source code
 
sprintf(self, pstring, args)
Format string using the arguments in args
source code
 
fetchfilename(self, key) source code
 
fetchval(self, key) source code
 
safe_eval(self, pstring)
Evalualte Python expression after verifying that it does not contain potentially harmful or exploitable expressions.
source code
 
_getarg(self, pstring)
Retrieve argument from dictionary of commandline arguments/options
source code
 
_getsteering(self, pstring)
Retrieve value from dictionary of steering parameters
source code
 
_getdifplus(self, pstring)
Retrieve value from dictionary of steering parameters
source code
 
_getsysopt(self, pstring)
Retrieve value from dictionary of system options
source code
 
parse(self, pstring)
Parse string for valid expressions.
source code
 
call(self, func, args)
Parse a function call in the form $func(args)
source code
 
match(self, ochar, s)
Parse string until finding the matching closing character for ochar (),[],{}
source code
 
complement(self, ochar)
return complent of char or matching opening and closing symbols (),[],{}
source code
 
format_string(self, pstring, args)
Format string using the arguments in args
source code
 
cast_string(self, fstring, arg)
cast string to value according to formatting character
source code
Class Variables [hide private]
  keywords = ['sprintf', 'args', 'metadata', 'steering', 'eval',...
Method Details [hide private]

safe_eval(self, pstring)

source code 

Evalualte Python expression after verifying that it does not contain potentially harmful or exploitable expressions.

Parameters:
  • pstring - string containing expression

_getarg(self, pstring)

source code 

Retrieve argument from dictionary of commandline arguments/options

Parameters:
  • pstring - string containing expression

_getsteering(self, pstring)

source code 

Retrieve value from dictionary of steering parameters

Parameters:
  • pstring - string containing expression

_getdifplus(self, pstring)

source code 

Retrieve value from dictionary of steering parameters

Parameters:
  • pstring - string containing expression

_getsysopt(self, pstring)

source code 

Retrieve value from dictionary of system options

Parameters:
  • pstring - string containing expression

parse(self, pstring)

source code 

Parse string for valid expressions.

Parameters:
  • pstring - string containing expression

call(self, func, args)

source code 

Parse a function call in the form $func(args)

Parameters:
  • func - name of function
  • args - list of arguments to pass to function

match(self, ochar, s)

source code 

Parse string until finding the matching closing character for ochar (),[],{}

Parameters:
  • ochar - opening character
  • s - string to parse

complement(self, ochar)

source code 

return complent of char or matching opening and closing symbols (),[],{}

Parameters:
  • ochar - character
Returns:
complementary character for ochar

cast_string(self, fstring, arg)

source code 

cast string to value according to formatting character

Parameters:
  • fstring - formatting string (e.g. '%006d')
  • arg - value to cast
Returns:
converted value

Class Variable Details [hide private]

keywords

Value:
['sprintf',
 'args',
 'metadata',
 'steering',
 'eval',
 'file',
 'glob',
 'dict',
...