# Path: numjuggler/utils/io.py
# @contextmanager
# def resolve_fname_or_stream(fname_or_stream, mode="r"):
#     is_input = mode == 'r'
#     if fname_or_stream is None:
#         if is_input:
#             yield sys.stdin
#         else:
#             yield sys.stdout
#     elif is_input and hasattr(fname_or_stream, "read") or not is_input and hasattr(fname_or_stream, "write"):
#         yield fname_or_stream
#     else:
#         with open(fname_or_stream, mode=mode) as fid:
#             yield fid


from collections import OrderedDict
from numjuggler.utils.io import resolve_fname_or_stream
    from numbering import get_numbers
            return (self.__x1 <= value <= self.__x2)

    def __str__(self):
        if self.__x2 is None:
            return str(self.__x1)
        else:
            return '[{} -- {}]'.format(self.__x1, self.__x2)

    def __hash__(self):
        return hash((self.__x1, self.__x2))

    def __eq__(self, o):
        return hash(self) == hash(o)

    def __ne__(self, o):
        return hash(self) != hash(o)

# Possible number types:
ntList = ('cel', 'sur', 'u', 'tr', 'mat')

_ntd = dict(map(lambda x: (x[0], x), ntList))


def read_map_file(fname, log=False):
    """
    Read map file and return dictionary of LikeFunction objects.
    """
    # Dictionary type -> LikeFunction
    maps = {}


# Path: numjuggler/utils/io.py
# @contextmanager
# def resolve_fname_or_stream(fname_or_stream, mode="r"):
#     is_input = mode == 'r'
#     if fname_or_stream is None:
#         if is_input:
#             yield sys.stdin
#         else:
#             yield sys.stdout
#     elif is_input and hasattr(fname_or_stream, "read") or not is_input and hasattr(fname_or_stream, "write"):
#         yield fname_or_stream
#     else:
#         with open(fname_or_stream, mode=mode) as fid:
#             yield fid


# Path: numjuggler/likefunc.py
from collections import OrderedDict
from numjuggler.utils.io import resolve_fname_or_stream
    from numbering import get_numbers

            return (self.__x1 <= value <= self.__x2)

    def __str__(self):
        if self.__x2 is None:
            return str(self.__x1)
        else:
            return '[{} -- {}]'.format(self.__x1, self.__x2)

    def __hash__(self):
        return hash((self.__x1, self.__x2))

    def __eq__(self, o):
        return hash(self) == hash(o)

    def __ne__(self, o):
        return hash(self) != hash(o)

# Possible number types:
ntList = ('cel', 'sur', 'u', 'tr', 'mat')

_ntd = dict(map(lambda x: (x[0], x), ntList))


def read_map_file(fname, log=False):
    """
    Read map file and return dictionary of LikeFunction objects.
    """
    # Dictionary type -> LikeFunction
    maps = {}


    with resolve_fname_or_stream(fname, 'r') as mapfile: