def cfg_convert(self, value):
rest = value<EOL>m = self.WORD_PATTERN.match(rest)<EOL>if m is None:<EOL><INDENT>raise ValueError("<STR_LIT>" % value)<EOL><DEDENT>else:<EOL><INDENT>rest = rest[m.end():]<EOL>d = self.config[m.groups()[<NUM_LIT:0>]]<EOL>while rest:<EOL><INDENT>m = self.DOT_PATTERN.match(rest)<EOL>if m:<EOL><INDENT>d = d[m.groups()[<NUM_LIT:0>]]<EOL><DEDENT>else:<EOL><INDENT>m = self.INDEX_PATTERN.match(rest)<EOL>if m:<EOL><INDENT>idx = m.groups()[<NUM_LIT:0>]<EOL>if not self.DIGIT_PATTERN.match(idx):<EOL><INDENT>d = d[idx]<EOL><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>n = int(idx)<EOL>d = d[n]<EOL><DEDENT>except TypeError:<EOL><INDENT>d = d[idx]<EOL><DEDENT><DEDENT><DEDENT><DEDENT>if m:<EOL><INDENT>rest = rest[m.end():]<EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>'<EOL>'<STR_LIT>' % (value, rest))<EOL><DEDENT><DEDENT><DEDENT>return d<EOL>
Default converter for the cfg:// protocol.