def resolve(self, container):
        """
        Resolve this instance in the context of a container.

        @param container: The container to resolve from.
        @type container: L{Container}
        @return: The resolved value.
        @rtype: any
        @raise ConfigResolutionError: If resolution fails.
        """
        rv = None
        path = object.__getattribute__(container, 'path')
        current = self.findConfig(container)
        while current is not None:
            if self.type == BACKTICK:
                namespaces = object.__getattribute__(current, 'namespaces')
                found = False
                s = str(self)[1:-1]
                for ns in namespaces:
                    try:
                        try:
                            rv = eval(s, vars(ns))
                        except TypeError: #Python 2.7 - vars is a dictproxy
                            rv = eval(s, {}, vars(ns))
                        found = True
                        break
                    except:
                        logger.debug("unable to resolve %r in %r", s, ns)
                        pass
                if found:
                    break
            else:
                firstkey = self.elements[0]
                if firstkey in current.resolving:
                    current.resolving.remove(firstkey)
                    raise ConfigResolutionError("Circular reference: %r" % firstkey)
                current.resolving.add(firstkey)
                key = firstkey
                try:
                    rv = current[key]
                    for item in self.elements[1:]:
                        key = item[1]
                        rv = rv[key]
                    current.resolving.remove(firstkey)
                    break
                except ConfigResolutionError:
                    raise
                except:
                    logger.debug("Unable to resolve %r: %s", key, sys.exc_info()[1])
                    rv = None
                    pass
                current.resolving.discard(firstkey)
            current = self.findConfig(object.__getattribute__(current, 'parent'))
        if current is None:
            raise ConfigResolutionError("unable to evaluate %r in the configuration %s" % (self, path))
        return rv
dataset/ETHPy150Open twitterdev/twitter-for-bigquery/libs/config.py/Reference.resolve/original