Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(45)  |  Call(41)  |  Derive(0)  |  Import(4)
return the given infer function wrapped to handle the path

        def path_wrapper(func):
    """return the given infer function wrapped to handle the path"""
    def wrapped(node, context=None, _func=func, **kwargs):
        """wrapper function handling context"""
        if context is None:
            context = InferenceContext()
        context.push(node)
        yielded = set()
        for res in _func(node, context, **kwargs):
            # unproxy only true instance, not const, tuple, dict...
            if res.__class__ is Instance:
                ares = res._proxied
            else:
                ares = res
            if not ares in yielded:
                yield res
                yielded.add(ares)
    return wrapped
        


src/p/y/pylama_pylint-0.1.6/pylama_pylint/astroid/inference.py   pylama_pylint(Download)
from astroid.exceptions import (AstroidError,
    InferenceError, NoDefault, NotFoundError, UnresolvableName)
from astroid.bases import YES, Instance, InferenceContext, \
     _infer_stmts, copy_context, path_wrapper, raise_if_nothing_infered
from astroid.protocols import _arguments_infer_argname
    context.lookupname = self.name
    return _infer_stmts(stmts, context, frame)
nodes.Name._infer = path_wrapper(infer_name)
nodes.AssName.infer_lhs = infer_name # won't work with a path wrapper
 
            ## XXX log error ?
            continue
nodes.CallFunc._infer = path_wrapper(raise_if_nothing_infered(infer_callfunc))
 
 
    else:
        yield self.do_import_module(name)
nodes.Import._infer = path_wrapper(infer_import)
 
def infer_name_module(self, name):
    except NotFoundError:
        raise InferenceError(name)
nodes.From._infer = path_wrapper(infer_from)
 
 

src/p/y/pylama_pylint-0.1.6/astroid/inference.py   pylama_pylint(Download)
from astroid.exceptions import (AstroidError,
    InferenceError, NoDefault, NotFoundError, UnresolvableName)
from astroid.bases import YES, Instance, InferenceContext, \
     _infer_stmts, copy_context, path_wrapper, raise_if_nothing_infered
from astroid.protocols import _arguments_infer_argname
    context.lookupname = self.name
    return _infer_stmts(stmts, context, frame)
nodes.Name._infer = path_wrapper(infer_name)
nodes.AssName.infer_lhs = infer_name # won't work with a path wrapper
 
            ## XXX log error ?
            continue
nodes.CallFunc._infer = path_wrapper(raise_if_nothing_infered(infer_callfunc))
 
 
    else:
        yield self.do_import_module(name)
nodes.Import._infer = path_wrapper(infer_import)
 
def infer_name_module(self, name):
    except NotFoundError:
        raise InferenceError(name)
nodes.From._infer = path_wrapper(infer_from)
 
 

src/a/s/astroid-1.1.1/inference.py   astroid(Download)
from astroid.exceptions import (AstroidError,
    InferenceError, NoDefault, NotFoundError, UnresolvableName)
from astroid.bases import YES, Instance, InferenceContext, \
     _infer_stmts, copy_context, path_wrapper, raise_if_nothing_infered
from astroid.protocols import _arguments_infer_argname
    context.lookupname = self.name
    return _infer_stmts(stmts, context, frame)
nodes.Name._infer = path_wrapper(infer_name)
nodes.AssName.infer_lhs = infer_name # won't work with a path wrapper
 
            ## XXX log error ?
            continue
nodes.CallFunc._infer = path_wrapper(raise_if_nothing_infered(infer_callfunc))
 
 
    else:
        yield self.do_import_module(name)
nodes.Import._infer = path_wrapper(infer_import)
 
def infer_name_module(self, name):
    except NotFoundError:
        raise InferenceError(name)
nodes.From._infer = path_wrapper(infer_from)
 
 

src/a/s/astroid-1.1.1/test/unittest_inference.py   astroid(Download)
from astroid import InferenceError, builder, nodes
from astroid.inference import infer_end as inference_infer_end
from astroid.bases import YES, Instance, BoundMethod, UnboundMethod,\
                                path_wrapper, BUILTINS
 
    def test_path_wrapper(self):
        def infer_default(self, *args):
            raise InferenceError
        infer_default = path_wrapper(infer_default)
        infer_end = path_wrapper(inference_infer_end)