Gaudi Framework, version v23r6

Home   Generated: Wed Jan 30 2013
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
EnvConfig.Variable.EnvExpander Class Reference
Inheritance diagram for EnvConfig.Variable.EnvExpander:
Inheritance graph
[legend]
Collaboration diagram for EnvConfig.Variable.EnvExpander:
Collaboration graph
[legend]

Public Member Functions

def __init__
 
def isTarget
 
def process
 
- Public Member Functions inherited from EnvConfig.Variable.VariableProcessor
def __init__
 
def isTarget
 
def process
 
def __call__
 

Private Member Functions

def _repl
 

Private Attributes

 _exp
 

Detailed Description

Variable processor to expand the reference to environment variables.

Definition at line 62 of file Variable.py.

Constructor & Destructor Documentation

def EnvConfig.Variable.EnvExpander.__init__ (   self,
  env 
)

Definition at line 66 of file Variable.py.

66 
67  def __init__(self, env):
68  super(EnvExpander, self).__init__(env)
69  self._exp = re.compile(r"\$([A-Za-z_][A-Za-z0-9_]*)|\$\(([A-Za-z_][A-Za-z0-9_]*)\)|\$\{([A-Za-z_][A-Za-z0-9_]*)\}|\$\{(\.)\}")

Member Function Documentation

def EnvConfig.Variable.EnvExpander._repl (   self,
  value 
)
private

Definition at line 74 of file Variable.py.

74 
75  def _repl(self, value):
76  m = self._exp.search(value)
77  if m:
78  value = (value[:m.start()]
79  + str(self._env[filter(None, m.groups())[0]])
80  + value[m.end():])
81  return self._repl(value)
82  else:
83  return value
def EnvConfig.Variable.EnvExpander.isTarget (   self,
  variable 
)

Definition at line 70 of file Variable.py.

70 
71  def isTarget(self, variable):
72  return (super(EnvExpander, self).isTarget(variable)
73  and variable.expandVars)
def EnvConfig.Variable.EnvExpander.process (   self,
  variable,
  value 
)

Definition at line 84 of file Variable.py.

84 
85  def process(self, variable, value):
86  if isinstance(value, str):
87  value = self._repl(value)
88  else:
89  # expand only in the elements that are new
90  old_values = set(variable.val)
91  value = map(lambda v: v if v in old_values else self._repl(v), value)
92  return value

Member Data Documentation

EnvConfig.Variable.EnvExpander._exp
private

Definition at line 68 of file Variable.py.


The documentation for this class was generated from the following file:
Generated at Wed Jan 30 2013 17:13:49 for Gaudi Framework, version v23r6 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004