# Path: clonedigger/logilab/common/compat.py
# def imap(function, *iterables):
#     iterables = list(map(iter, iterables))
#     while True:
#         args = [next(i) for i in iterables]
#         if function is None:
#             yield tuple(args)
#         else:
#             yield function(*args)                
# 
# def chain(*iterables):
#     for it in iterables:
#         for element in it:
#             yield element
# 
# class set(_baseset):
#     """mutable set"""
#     def add(self, value):
#         self._data[value] = 1
# 
#     def remove(self, element):
#         """removes <element> from set"""
#         del self._data[element]
# 
#     def pop(self):
#         """pops an arbitrary element from set"""
#         return self._data.popitem()[0]
# 
#     def __hash__(self):
#         """mutable et cannot be hashed."""
#         raise TypeError("set objects are not hashable")


from future import standard_library
from builtins import next
from builtins import range
from builtins import *
from past.utils import old_div
from builtins import object
from copy import copy
from clonedigger.logilab.common.compat import imap, chain, set
from clonedigger.logilab.astng import MANAGER, YES, InferenceContext, Instance, Generator, \
     unpack_infer, _infer_stmts, nodes, copy_context
from clonedigger.logilab.astng import ASTNGError, InferenceError, UnresolvableName, \
     NoDefault, NotFoundError, ASTNGBuildingException
# 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
"""this module contains a set of functions to handle inference on astng trees

:author:    Sylvain Thenault
:copyright: 2003-2008 LOGILAB S.A. (Paris, FRANCE)
:contact:   http://www.logilab.fr/ -- mailto:python-projects@logilab.org
:copyright: 2003-2008 Sylvain Thenault
:contact:   mailto:thenault@gmail.com
"""
from __future__ import division
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import absolute_import
standard_library.install_aliases()

from __future__ import generators

__doctype__ = "restructuredtext en"




    
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(node)
        context.push(node)

# Path: clonedigger/logilab/common/compat.py
# def imap(function, *iterables):
#     iterables = list(map(iter, iterables))
#     while True:
#         args = [next(i) for i in iterables]
#         if function is None:
#             yield tuple(args)
#         else:
#             yield function(*args)                
# 
# def chain(*iterables):
#     for it in iterables:
#         for element in it:
#             yield element
# 
# class set(_baseset):
#     """mutable set"""
#     def add(self, value):
#         self._data[value] = 1
# 
#     def remove(self, element):
#         """removes <element> from set"""
#         del self._data[element]
# 
#     def pop(self):
#         """pops an arbitrary element from set"""
#         return self._data.popitem()[0]
# 
#     def __hash__(self):
#         """mutable et cannot be hashed."""
#         raise TypeError("set objects are not hashable")


# Path: clonedigger/logilab/astng/inference.py
from future import standard_library
from builtins import next
from builtins import range
from builtins import *
from past.utils import old_div
from builtins import object
from copy import copy
from clonedigger.logilab.common.compat import imap, chain, set
from clonedigger.logilab.astng import MANAGER, YES, InferenceContext, Instance, Generator, \
     unpack_infer, _infer_stmts, nodes, copy_context
from clonedigger.logilab.astng import ASTNGError, InferenceError, UnresolvableName, \
     NoDefault, NotFoundError, ASTNGBuildingException

# 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
"""this module contains a set of functions to handle inference on astng trees

:author:    Sylvain Thenault
:copyright: 2003-2008 LOGILAB S.A. (Paris, FRANCE)
:contact:   http://www.logilab.fr/ -- mailto:python-projects@logilab.org
:copyright: 2003-2008 Sylvain Thenault
:contact:   mailto:thenault@gmail.com
"""
from __future__ import division
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import absolute_import
standard_library.install_aliases()

from __future__ import generators

__doctype__ = "restructuredtext en"




    
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(node)
        context.push(node)

        yielded = set()