parameters: (self, value)
return_statement: return d
docstring: Default converter for the cfg:// protocol.
docstring_summary: Default converter for the cfg:// protocol.
docstring_tokens: Default converter for the cfg : // protocol .
function: def cfg_convert(self, value):
          """Default converter for the cfg:// protocol."""
          rest = value
          m = self.WORD_PATTERN.match(rest)
          if m is None:
              raise ValueError("Unable to convert %r" % value)
          else:
              rest = rest[m.end():]
              d = self.config[m.groups()[0]]
              #print d, rest
              while rest:
                  m = self.DOT_PATTERN.match(rest)
                  if m:
                      d = d[m.groups()[0]]
                  else:
                      m = self.INDEX_PATTERN.match(rest)
                      if m:
                          idx = m.groups()[0]
                          if not self.DIGIT_PATTERN.match(idx):
                              d = d[idx]
                          else:
                              try:
                                  n = int(idx) # try as number first (most likely)
                                  d = d[n]
                              except TypeError:
                                  d = d[idx]
                  if m:
                      rest = rest[m.end():]
                  else:
                      raise ValueError('Unable to convert '
                                       '%r at %r' % (value, rest))
          #rest should be empty
          return d
function_tokens: def cfg_convert ( self , value ) : rest = value m = self . WORD_PATTERN . match ( rest ) if m is None : raise ValueError ( "Unable to convert %r" % value ) else : rest = rest [ m . end ( ) : ] d = self . config [ m . groups ( ) [ 0 ] ] #print d, rest while rest : m = self . DOT_PATTERN . match ( rest ) if m : d = d [ m . groups ( ) [ 0 ] ] else : m = self . INDEX_PATTERN . match ( rest ) if m : idx = m . groups ( ) [ 0 ] if not self . DIGIT_PATTERN . match ( idx ) : d = d [ idx ] else : try : n = int ( idx ) # try as number first (most likely) d = d [ n ] except TypeError : d = d [ idx ] if m : rest = rest [ m . end ( ) : ] else : raise ValueError ( 'Unable to convert ' '%r at %r' % ( value , rest ) ) #rest should be empty return d