def path_wrapper(func):
 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):
   if (res.__class__ is Instance):
    ares = res._proxied
   else:
    ares = res
   if (not (ares in yielded)):
    (yield res)
    yielded.add(ares)
 return wrapped

def path_wrapper ( func ) : def wrapped ( node , context = None , _func = func , ** kwargs ) : if ( context is None ) : context = InferenceContext ( ) context . push ( node ) yielded = set ( ) for res in _func ( node , context , ** kwargs ) : if ( res . __class__ is Instance ) : ares = res . _proxied else : ares = res if ( not ( ares in yielded ) ) : ( yield res ) yielded . add ( ares ) return wrapped
return the given infer function wrapped to handle the path .