:param filename: str of the file name to stream the data to
        :return: None
192647
def stream_to_file(self, filename):
        
        stream_size = 0
        try:
            partial_chunk = ''
            chunk_size = 1024
            m3u8_dir = None
            if filename[-5:].lower() == '.m3u8':
                self.repeat_needed = True
                m3u8_dir = self.get_ts_folder(filename)

            self.content_length = self.response.headers.get('Content-Length',
                                                            None)
            if not self.content_length:
                self.content_length = self.response.headers.get(
                    'x-een-svc-renderer-file-size', None)

            with open(filename, 'a') as fn:
                stream_size = self.download_chunks(
                    chunk_size, fn, m3u8_dir, partial_chunk, stream_size)
        except ZeroReturnError as e:
            pass
        except Exception as e:
            self._timestamps.setdefault('exception', time.time())
            self.error = ApiError(
                "Failed to Stream Data to file:%s" % filename,
                status_code=self.status_code,
                status_description=str(e),
                url=self.response.url)
            raise Exception(self.error)

        self.raw_data = self.data = self.filename + ' size = ' + str(
            self.content_length)
        self.content_length = self.content_length or stream_size
1112227
def to_file_url(filename):
    
    url = 'file://' + os.path.abspath(filename).replace(os.path.sep, '/')
    return url
398819
def save(self, filename=None):
        
        filename = filename or self._filename
        o = open(filename, 'w')
        o.write(self.write())
        o.close()
657558
def _read_file(self, filename):
        

        if self.__compression:
            f = gzip.GzipFile(filename, "rb")
        else:
            f = open(filename, "rb")
        res = pickle.load(f)
        f.close()
        return res
715601
def load_from_file(filename):
    '''
    
    '''
    t = None
    with open(filename, 'rU') as infile:
        tdata = infile.read()
        t = Topology.unserialize(tdata)
    return t
769205
def _read_name_file(self, filename):
        
        file_path = os.path.join(self._DATA_DIR, filename)
        with open(file_path) as f:
            names = json.load(f)

        return names
874378
def _encode_filename(filename):  # pragma: no cover
    
    # Don't replace unknown characters as '?' is forbidden in Windows filenames
    errors = 'ignore' if os.name == 'nt' else 'replace'

    if not isinstance(filename, bytes):
        if os.name == 'nt' and cairo.cairo_version() >= 11510:
            # Since 1.15.10, cairo uses utf-8 filenames on Windows
            filename = filename.encode('utf-8', errors=errors)
        else:
            try:
                filename = filename.encode(sys.getfilesystemencoding())
            except UnicodeEncodeError:
                # Use plain ASCII filenames as fallback
                filename = filename.encode('ascii', errors=errors)

    # TODO: avoid characters forbidden in filenames?
    return ffi.new('char[]', filename)
1320331
def file(filename):
        
        m = hashlib.md5()
        with open(filename, 'rb') as f:
            m.update(f.read())
            result = m.hexdigest()
            return result
716915
def load( filename ):
        
        try:
            f = open(filename, 'r')
            
        except IOError:
            logger.exception('Could not load the file: %s' % filename)
            return False
        
        strdata = f.read()
        f.close()
        
        return XViewProfile.fromString(strdata)
202067
def save_to_file(self, filename: str) -> ConfigFile:
        
        newclass = ConfigFile(fd=filename, load_hook=self.normal_class_hook[0],
                              dump_hook=self.normal_class_hook[1], safe_load=self.safe_load)
        return newclass
31741
def parse_file(self, filename, skip_unreadable=False):
        
        if not os.access(filename, os.R_OK):
            if skip_unreadable:
                return
            raise ConfigReadingError("Unable to open file %s." % filename)
        with open(filename, 'rt') as f:
            return self.parse(f, name_hint=filename)
712592
def set_filename(self, filename):
        
        self.filename = filename
        self.logger = logging.getLogger(filename)
657801
def parseFilename(filename):
    

    # Parse out any extension specified in filename
    _indx = filename.find('[')
    if _indx > 0:
        # Read extension name provided
        _fname = filename[:_indx]
        _extn = filename[_indx + 1:-1]
    else:
        _fname = filename
        _extn = None

    return _fname, _extn
230378
def read(filename: str, limit: Optional[int]=None) -> Tuple[list, int]:
    

    audiofile = AudioSegment.from_file(filename)

    if limit:
        audiofile = audiofile[:limit * 1000]

    data = np.fromstring(audiofile._data, np.int16)

    channels = []
    for chn in range(audiofile.channels):
        channels.append(data[chn::audiofile.channels])

    fs = audiofile.frame_rate

    return channels, fs
1260245
def store_to_file(self, filename):
    
    with tf.gfile.Open(filename, "w") as f:
      for i in range(len(self._id_to_token)):
        f.write(self._id_to_token[i] + "\n")
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
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)