Output the contents of one or more files to a single concatenated string.
492944
def read_files(*filenames):
    
    output = []
    for filename in filenames:
        f = codecs.open(filename, encoding='utf-8')
        try:
            output.append(f.read())
        finally:
            f.close()
    return '\n\n'.join(output)
1245485
def concat_generator(filename, up_threshold, low_threshold=10):
  """"""
  txt = ""
  for line in tf.gfile.Open(filename):
    line = line.strip()
    if len(txt) + len(line) + 1 >= up_threshold:
      ret = txt
      txt = ""
      # We don't yield very short long parts to prevent noisy examples.
      if len(ret) > low_threshold and len(ret) < up_threshold:
        yield {"targets": ret}

    if not txt:
      txt = line
    else:
      txt = " ".join([txt, line])
436256
def raw(self, output):
        """"""
        if isinstance(output, (list, tuple)):
            output = '\n'.join(map(str, output))
        self.outfile.write(str(output))
1291757
def _get_clstr_outfile(self):
        """"""
        if self.Parameters['-o'].isOn():
            return ''.join([self.Parameters['-o'].Value, '.clstr'])
        else:
            raise ValueError, "No output file specified"
4426
def merge_bytes(binder_strings):
    """"""
    output = None
    for byte_string in binder_strings:
        binder = Binder().from_bytes(byte_string)
        if output is None:
            output = binder
        else:
            output.merge(binder)
    return output.to_bytes()
812821
def write_file(filename, content):
    """"""
    print 'Generating {0}'.format(filename)
    with open(filename, 'wb') as out_f:
        out_f.write(content)
815757
def dumps(self):
        """"""

        ret_str = []
        for item in self._arg_list:
            if isinstance(item, TikZUserPath):
                ret_str.append(item.dumps())
            elif isinstance(item, TikZCoordinate):
                ret_str.append(item.dumps())
            elif isinstance(item, str):
                ret_str.append(item)

        return ' '.join(ret_str)
789001
def dumps(self):
        """"""

        ret_str = self.path_type

        if self.options is not None:
            ret_str += self.options.dumps()

        return ret_str
557117
def concat(options={})
      output_format = options[:output_format] ? options[:output_format] : "wav"
      dst = Tempfile.new(["out", ".#{output_format}"])
      files = get_array(@file)
      begin
        parameters = files.dup
        parameters << ":dest"
        parameters = parameters.flatten.compact.join(" ").strip.squeeze(" ")
        success = Cocaine::CommandLine.new("sox", parameters).run(:dest => get_path(dst))
      rescue => e
        raise AudioHeroError, "There was an error joining #{@file}"
      end
      # no garbage collect option for join
      dst
    end
778923
def write_files(text, where='.'):
    """"""
    for filename in text:
        target = os.path.join(where, filename)
        write_file(target, text[filename])
781308
def multipart_content(*files):
    
    outer = MIMEMultipart()
    for fname in files:
        mtype = get_type(fname)
        maintype, subtype = mtype.split('/', 1)
        with open(fname) as f:
            msg = MIMEText(f.read(), _subtype=subtype)
        msg.add_header('Content-Disposition', 'attachment', 
                       filename=os.path.basename(fname))
        outer.attach(msg)
    return outer.as_string()
301148
def parseArgs():
    """"""
    parser = argparse.ArgumentParser()
    parser.add_argument("name", help="the file you want to split")
    parser.add_argument("out1", help="the name of the first file you want to output")
    parser.add_argument("out2", help="the name of the second file you want to output")
    return parser.parse_args()
134569
def filesfile_string(self):
        """"""
        lines = []
        app = lines.append

        #optic.in     ! Name of input file
        #optic.out    ! Unused
        #optic        ! Root name for all files that will be produced
        app(self.input_file.path)                           # Path to the input file
        app(os.path.join(self.workdir, "unused"))           # Path to the output file
        app(os.path.join(self.workdir, self.prefix.odata))  # Prefix for output data

        return "\n".join(lines)
1374379
def append_result(self, results, num_matches):
        """"""
        filename, lineno, colno, match_end, line = results

        if filename not in self.files:
            file_item = FileMatchItem(self, filename, self.sorting,
                                      self.text_color)
            file_item.setExpanded(True)
            self.files[filename] = file_item
            self.num_files += 1

        search_text = self.search_text
        title = "'%s' - " % search_text
        nb_files = self.num_files
        if nb_files == 0:
            text = _('String not found')
        else:
            text_matches = _('matches in')
            text_files = _('file')
            if nb_files > 1:
                text_files += 's'
            text = "%d %s %d %s" % (num_matches, text_matches,
                                    nb_files, text_files)
        self.set_title(title + text)

        file_item = self.files[filename]
        line = self.truncate_result(line, colno, match_end)
        item = LineMatchItem(file_item, lineno, colno, line, self.text_color)
        self.data[id(item)] = (filename, lineno, colno)
913846
def dumps(self):
        """

        content = self.dumps_content()

        if not content.strip() and self.omit_if_empty:
            return ''

        string = ''

        start = Command(self.latex_name, arguments=self.arguments,
                        options=self.options)

        string += start.dumps() + '{ \n'

        if content != '':
            string += content + '\n}'
        else:
            string += '}'

        return string
7866
def ptconcat(output_file, input_files, overwrite=False):
    """"""
    filt = tb.Filters(
        complevel=5, shuffle=True, fletcher32=True, complib='zlib'
    )
    out_tabs = {}
    dt_file = input_files[0]
    log.info("Reading data struct '%s'..." % dt_file)
    h5struc = tb.open_file(dt_file, 'r')
    log.info("Opening output file '%s'..." % output_file)
    if overwrite:
        outmode = 'w'
    else:
        outmode = 'a'
    h5out = tb.open_file(output_file, outmode)

    for node in h5struc.walk_nodes('/', classname='Table'):
        path = node._v_pathname
        log.debug(path)
        dtype = node.dtype
        p, n = os.path.split(path)
        out_tabs[path] = h5out.create_table(
            p, n, description=dtype, filters=filt, createparents=True
        )
    h5struc.close()
    for fname in input_files:
        log.info('Reading %s...' % fname)
        h5 = tb.open_file(fname)
        for path, out in out_tabs.items():
            tab = h5.get_node(path)
            out.append(tab[:])
        h5.close()
    h5out.close()
43648
def dump(self):
        """"""
        text = ''

        for result in self.objects:
            if result.is_failure or result.is_error:
                text += '\n#{red}#{bright}'
                text += '{}\n'.format(''.ljust(79, '='))

                status = 'FAILED' if result.is_failure else 'ERROR'
                text += '{}: {}\n'.format(status, result.process)
                text += '{}\n#{{reset_all}}'.format(''.ljust(79, '='))

                if result.output:
                    text += result.output

                if result.error:
                    if result.output:
                        text += '\n{}\n'.format(''.ljust(79, '-'))
                        text += 'Additional error output:\n'
                        text += '{}\n'.format(''.ljust(79, '-'))
                    text += result.error

                if not text.endswith('\n'):
                    text += '\n'

        if self.has_modified_files:
            text += '\n#{{yellow}}#{{bright}}{}\n'.format(''.ljust(79, '-'))
            text += 'Modified files:\n'
            text += '{}\n'.format(''.ljust(79, '-'))
            for path, modified_by in self.modified_files:
                text += '#{{reset_all}}{} #{{cyan}}<- {}\n'.format(path, ', '.join(modified_by))

        return text