def __init__(self, filename=None, buffer=None, fileobj=None):
        super(NBTFile, self).__init__()
        self.filename = filename
        self.type = TAG_Byte(self.id)
        closefile = True
        #make a file object
        if filename:
            self.file = GzipFile(filename, 'rb')
        elif buffer:
            if hasattr(buffer, 'name'):
                self.filename = buffer.name
            self.file = buffer
            closefile = False
        elif fileobj:
            if hasattr(fileobj, 'name'):
                self.filename = fileobj.name
            self.file = GzipFile(fileobj=fileobj)
        else:
            self.file = None
            closefile = False
        #parse the file given initially
        if self.file:
            self.parse_file()
            if closefile:
                # Note: GzipFile().close() does NOT close the fileobj, 
                # So the caller is still responsible for closing that.
                try:
                    self.file.close()
                except (AttributeError, __HOLE__):
                    pass
            self.file = None
dataset/ETHPy150Open benbaptist/minecraft-wrapper/src/nbt.py/NBTFile.__init__