def __init__(self, file_name='-', read_values=False, debug=False):
        self._debug = debug
        self._read_values = read_values
        if file_name == '-':
            fh = sys.stdin
        else:
            try:
                fh = open(file_name)
            except __HOLE__ as ex:
                raise ThriftFile.Error('Could not open %s: %s' % (file_name, ex))

        if HAS_MMAP and file_name != '-':
            self._data = mmap.mmap(fh.fileno(), 0, access=mmap.ACCESS_READ)
            self._view = None
        else:
            # this might hurt...
            self._data = fh.read()
            self._view = memoryview(self._data)
dataset/ETHPy150Open pinterest/thrift-tools/thrift_tools/thrift_file.py/ThriftFile.__init__