Loads GPT partition table.

        Args:
            filename (str): path to file or device to open for reading
            bs (uint): Block size of the volume, default: 512

        Raises:
            IOError: If file does not exist or not readable
435953
def load(self, filename, bs=512):
        
        with open(filename, 'rb') as f:
            f.seek(GPT_HEADER_OFFSET + 0x0C)
            header_size = struct.unpack("<I", f.read(4))[0]
            f.seek(GPT_HEADER_OFFSET)

            header_data = f.read(header_size)
            self.header = GPT_HEADER(header_data)

            if (self.header.signature != GPT_SIGNATURE):
                raise Exception("Invalid GPT signature")

            self.__load_partition_entries(f, bs)
1258097
def get_file_contents(filename):
    
    data = None
    try:
        with open(filename) as pf:
            data = pf.read()
    except IOError:
        # File not found, return None
        pass
    return data
1114874
def load(self, filename):
        
        try:
            self._xroot = ElementTree.parse(filename).getroot()
            self._xstack = [self._xroot]
        except ExpatError:
            self.clear()
        
        return self._xroot is not None
1273750
def load(filename, default=None):
    '''
    
    '''
    ext = get_ext(filename)
    if ext in ldict:
        return ldict[ext](filename)
    else:
        return default
1286801
def loadFile(self, fileName):
        

        self.fileName = fileName
        # Assign QFile object with the current name.
        self.file = QtCore.QFile(fileName)
        if self.file.exists():
            # Load the file into the widget and reset the undo stack
            # to delete the undo object create by the setText method.
            # Without it, an undo operation would delete the content
            # of the widget which is intuitive.
            self.qteScintilla.setText(open(fileName).read())
            self.qteScintilla.qteUndoStack.reset()
        else:
            msg = "File <b>{}</b> does not exist".format(self.qteAppletID())
            self.qteLogger.info(msg)
769812
def from_file(self, filename):
        
        with gzip.open(filename, 'rb') as f:
            self.parse(f.read())
1161526
def load_filename(self, filename, index=None):
        
        filename = str(filename)  # QString protection
        if index is None:
            index = self._get_tab_index()
        page = self.pages[index]

        # Maybe this is set on purpose before loading attempt to leave new load_dir set (?)
        self.load_dir, _ = os.path.split(filename)

        clss = page.clss_load
        if len(clss) == 1:
            # If there is only one class to handle the file, will load it in a way that eventual
            # load errors will raise
            f = clss[0]()
            f.load(filename)
        else:
            # At the moment, the multi-class alternative will not display particular error information
            # if the file does not load
            f = f311.load_with_classes(filename, page.clss_load)
            if f is None:
                raise RuntimeError("Could not load '{0!s}'".format(filename))

        self.load(f, index)
1124466
def readfile(filename, binary=False):
    

    if not os.path.isfile(filename):
        return None

    try:
        flags = 'r' if not binary else 'rb'
        with open(filename, flags) as _file:
            return _file.read()

    except (OSError, IOError):
        return None
809742
def _read_from_file(self, filename):
        """"""
        try:
            with open(filename, 'rb') as f:
                return self._loads(f.read())
        except (IOError, OSError):
            logger.warning('Error opening file: {}'.format(filename))
            return None
390907
def open(filename, frame='unspecified'):
        
        data = Image.load_data(filename)
        return SegmentationImage(data, frame)
446852
def read_partition(self, i):
        
        self._load_metadata()
        if i < 0 or i >= self.npartitions:
            raise IndexError('%d is out of range' % i)

        return self._get_partition(i)
1301891
def read(filename):
    
    fname = os.path.join(here, filename)
    with codecs.open(fname, encoding='utf-8') as f:
        return f.read()
583357
def open(self, filename, mode='r', **kwargs):
        '''
        
        '''
        if 'r' in mode and not self.backend.exists(filename):
            raise FileNotFound(filename)
        return self.backend.open(filename, mode, **kwargs)
341623
def load(self , filename=None, data=None):
        

        self.__load(filename=filename, data=data)
939871
def load(filename, compressed=True, prealloc=None):
        
        # switch load based on file ext
        _, file_ext = os.path.splitext(filename)
        if compressed:
            if file_ext != COMPRESSED_TENSOR_EXT:
                raise ValueError('Can only load compressed tensor with %s extension' %(COMPRESSED_TENSOR_EXT))
            data = np.load(filename)['arr_0']
        else:
            if file_ext != TENSOR_EXT:
                raise ValueError('Can only load tensor with .npy extension')
            data = np.load(filename)
            
        # fill prealloc tensor
        if prealloc is not None:
            prealloc.reset()
            prealloc.add_batch(data)
            return prealloc
            
        # init new tensor
        tensor = Tensor(data.shape, data.dtype, data=data)
        return tensor
730656
def load_file_or_hdu(filename):
    
    if isinstance(filename, fits.HDUList):
        hdulist = filename
    else:
        hdulist = fits.open(filename, ignore_missing_end=True)
    return hdulist
1320331
def file(filename):
        
        m = hashlib.md5()
        with open(filename, 'rb') as f:
            m.update(f.read())
            result = m.hexdigest()
            return result