Analyzes the parsed results from Flake8 or PEP 8 output and creates FileResult instances
        :param output_file: If specified, output will be written to this file instead of stdout.
978316
def analyze(self, output_file=None):
        

        fr = None
        for path, code, line, char, desc in self.parser.parse():

            # Create a new FileResult and register it if we have changed to a new file
            if path not in self.files:
                # Update statistics
                if fr:
                    self.update_stats(fr)
                fr = FileResult(path)
                self.files[path] = fr

            # Add line to the FileResult
            fr.add_error(code, line, char, desc)

        # Add final FileResult to statistics, if any were parsed
        if fr:
            self.update_stats(fr)

        # Generate HTML file
        self.generate(output_file=output_file)
330856
def add_container_output_args(argument_parser):
    
    argument_parser.add_argument("--output-directory", metavar="DIR", default="output.files",
        help="target directory for result files (default: './output.files')")
    argument_parser.add_argument("--result-files", metavar="PATTERN", action="append", default=[],
        help="pattern for specifying which result files should be copied to the output directory "
            "(default: '.')")
693642
def output_results(results, mvdelim = '\n', output = sys.stdout):
    """"""

    # We collect all the unique field names, as well as 
    # convert all multivalue keys to the right form
    fields = set()
    for result in results:    
        for key in result.keys():
            if(isinstance(result[key], list)):
                result['__mv_' + key] = encode_mv(result[key])
                result[key] = mvdelim.join(result[key])
        fields.update(list(result.keys()))

    # convert the fields into a list and create a CSV writer
    # to output to stdout
    fields = sorted(list(fields))

    writer = csv.DictWriter(output, fields)

    # Write out the fields, and then the actual results
    writer.writerow(dict(list(zip(fields, fields))))
    writer.writerows(results)
142407
def to_file(output_file, encoder=EliotJSONEncoder):
    
    Logger._destinations.add(
        FileDestination(file=output_file, encoder=encoder)
    )
590900
def writeOutput(self, filename, samples, srcFs, targetFs):
        
        import librosa
        inputLength = samples.shape[-1]
        if srcFs != targetFs:
            if inputLength < targetFs:
                logger.info("Input signal is too short (" + str(inputLength) +
                            " samples) for resampling to " + str(targetFs) + "Hz")
                outputSamples = samples
                targetFs = srcFs
            else:
                logger.info("Resampling " + str(inputLength) + " samples from " + str(srcFs) + "Hz to " +
                            str(targetFs) + "Hz")
                outputSamples = librosa.resample(samples, srcFs, targetFs, res_type='kaiser_fast')
        else:
            outputSamples = samples
        logger.info("Writing output to " + filename)
        maxv = np.iinfo(np.int32).max
        librosa.output.write_wav(filename, (outputSamples * maxv).astype(np.int32), targetFs)
        logger.info("Output written to " + filename)
606227
def _output_results(
            self):
        
        self.log.info('starting the ``_output_results`` method')

        content = ""
        maxNameLen = 0

        for r in self.results:
            if maxNameLen < len(r["ned_name"]):
                maxNameLen = len(r["ned_name"])

        if len(self.results) == 0:
            content += "No resuls found"
        else:
            thisHeader = "| "
            thisLine = "| "
            for head in self.headers:
                if head == "ned_name":
                    s = maxNameLen
                else:
                    s = self.resultSpacing
                thisHeader += str(head).ljust(s,
                                              ' ') + " | "
                thisLine += ":".ljust(s,
                                      '-') + " | "
            content += thisHeader
            content += "\n" + thisLine
            for r in self.results:
                thisRow = "| "
                for head in self.headers:
                    if head == "ned_name":
                        s = maxNameLen
                    else:
                        s = self.resultSpacing
                    thisRow += str(r[head]).ljust(s,
                                                  ' ') + " | "
                content += "\n" + thisRow

        if self.quiet == False:
            print content
        if self.outputFilePath:
            import codecs
            writeFile = codecs.open(
                self.outputFilePath, encoding='utf-8', mode='w')
            writeFile.write(content)
            writeFile.close()

        self.log.info('completed the ``_output_results`` method')
        return None
771977
def collect_output(self, out_file=None):
        
        if self.logger.isEnabledFor(logging.INFO):
            self.logger.info(
                "collecting output %s", " to %s" % out_file if out_file else ''
            )
            self.logger.info("self.output %s", self.output)
        return collect_output(self.output, out_file)
217095
def write_resultfiles(self):
        
        t0=time.time()
        writer = ow.output_writer(output_dictionary=self.result)
        if len(self.options.outpath)>=3 and self.options.outpath[-3:]==".h5":
            writer.write_hdf5(filename=self.options.outpath,timestamp=self.options.timestamp)
        else:
            writer.write_txt(outdir=self.options.outpath,timestamp=self.options.timestamp,delimiter=self.options.delimiter,float_format=self.options.float_format)
        t1=time.time()
        print(("Elapsed time for writing the output files is %.2f seconds" % (t1-t0)))
625204
def temp_output_file(prefix="tmp", suffix="", dir=None, make_parents=False, always_clean=False):
  
  return _temp_output(False, prefix=prefix, suffix=suffix, dir=dir, make_parents=make_parents,
                      always_clean=always_clean)
881464
def _parse_stdout(self, out_folder):
        """"""
        fname = self.node.load_process_class()._DEFAULT_OUTPUT_FILE  # pylint: disable=protected-access
        if fname not in out_folder._repository.list_object_names():  # pylint: disable=protected-access
            raise OutputParsingError("Cp2k output file not retrieved")

        result_dict = {'exceeded_walltime': False}
        abs_fn = os.path.join(out_folder._repository._get_base_folder().abspath, fname)  # pylint: disable=protected-access
        with io.open(abs_fn, mode="r", encoding="utf-8") as fobj:
            lines = fobj.readlines()
            for i_line, line in enumerate(lines):
                if line.startswith(' ENERGY| '):
                    result_dict['energy'] = float(line.split()[8])
                    result_dict['energy_units'] = "a.u."
                if 'The number of warnings for this run is' in line:
                    result_dict['nwarnings'] = int(line.split()[-1])
                if 'exceeded requested execution time' in line:
                    result_dict['exceeded_walltime'] = True
                if "KPOINTS| Band Structure Calculation" in line:
                    from aiida.orm import BandsData
                    bnds = BandsData()
                    kpoints, labels, bands = self._parse_bands(lines, i_line)
                    bnds.set_kpoints(kpoints)
                    bnds.labels = labels
                    bnds.set_bands(bands, units='eV')
                    self.out('output_bands', bnds)

        if 'nwarnings' not in result_dict:
            raise OutputParsingError("CP2K did not finish properly.")

        self.out('output_parameters', Dict(dict=result_dict))
440025
private static void reportResults(TiffReader tiffReader, int result, String filename,
      String output_file) {
    TiffDocument to = tiffReader.getModel();
    if (output_file != null) {
      // TODO: Create xml file with report
    } else {
      // Display results human readable
      switch (result) {
        case -1:
          System.out.println("File '" + filename + "' does not exist");
          break;
        case -2:
          System.out.println("IO Exception in file '" + filename + "'");
          break;
        case 0:
          if (tiffReader.getBaselineValidation().correct) {
            // The file is correct
            System.out.println("Everything ok in file '" + filename + "'");
            System.out.println("IFDs: " + to.getIfdCount());
            System.out.println("SubIFDs: " + to.getSubIfdCount());

            to.printMetadata();
            TiffEPProfile bpep = new TiffEPProfile(to);
            bpep.validate();
            bpep.getValidation().printErrors();

            TiffITProfile bpit = new TiffITProfile(to, 0);
            bpit.validate();
            bpit.getValidation().printErrors();

            int nifd = 1;
            for (TiffObject o : to.getImageIfds()) {
              IFD ifd = (IFD) o;
              if (ifd != null) {
                System.out.println("IFD " + nifd++ + " TAGS:");
                ifd.printTags();
              }
            }
          } else {
            // The file is not correct
            System.out.println("Errors in file '" + filename + "'");
            if (to != null) {
              System.out.println("IFDs: " + to.getIfdCount());
              System.out.println("SubIFDs: " + to.getSubIfdCount());
              
              // int index = 0;
              to.printMetadata();
            }
            tiffReader.getBaselineValidation().printErrors();
          }
          tiffReader.getBaselineValidation().printWarnings();
          break;
        default:
          System.out.println("Unknown result (" + result + ") in file '" + filename + "'");
          break;
      }
    }
  }
407335
def do_results(args):
    
    config,name,label,coord = args

    filenames = make_filenames(config,label)
    srcfile = filenames['srcfile']
    samples = filenames['samfile']

    if not exists(srcfile):
        logger.warning("Couldn't find %s; skipping..."%srcfile)
        return
    if not exists(samples):
        logger.warning("Couldn't find %s; skipping..."%samples)
        return

    logger.info("Writing %s..."%srcfile)
    from ugali.analysis.results import write_results
    write_results(srcfile,config,srcfile,samples)
926057
def handle_container_output_args(options, parser):
    
    if options.result_files:
        result_files_patterns = [os.path.normpath(p) for p in options.result_files if p]
        for pattern in result_files_patterns:
            if pattern.startswith(".."):
                parser.error("Invalid relative result-files pattern '{}'.".format(pattern))
    else:
        result_files_patterns = ["."]

    output_dir = options.output_directory
    if os.path.exists(output_dir) and not os.path.isdir(output_dir):
        parser.error("Output directory '{}' must not refer to an existing file.".format(output_dir))
    return {
        'output_dir': output_dir,
        'result_files_patterns': result_files_patterns,
        }
17468
def output_extras(self, output_file):
        
        output_directory = dirname(output_file)

        def local_path(name):
            return join(output_directory, self.path_helper.local_name(name))

        files_directory = "%s_files%s" % (basename(output_file)[0:-len(".dat")], self.path_helper.separator)
        names = filter(lambda o: o.startswith(files_directory), self.output_directory_contents)
        return dict(map(lambda name: (local_path(name), name), names))
169247
def get_output_from_pipe(self, input_file):
        
        args = shlex.split(self.cmd)
        p = Popen(args, stdout=PIPE, stdin=PIPE)  # | grep es
        p.stdin.write(bytearray(input_file.encode("utf8")))  # echo test |
        return p.communicate()[0].decode("utf8")
1136777
def to_file(self, outputfile=DEFAULT_OUTPUTFILE):
        
    
        if outputfile != NO_OUTPUTFILE:
            if outputfile == DEFAULT_OUTPUTFILE:
                outputfile = 'profile_' + str(hash(self)) + ".html"
            # TODO: should be done in the template
            with codecs.open(outputfile, 'w+b', encoding='utf8') as self.file:
                self.file.write(templates.template('wrapper').render(content=self.html))
1251487
def export(self, output_file_name):
        
        if self._best_estimator is None:
            raise ValueError('A model has not been optimized. Please call fit()'
                             ' first.')

        # Write print_model() to file
        with open(output_file_name, 'w') as output_file:
            output_file.write(self.print_model())
        # if decision tree, print tree into dot file
        if 'DecisionTree' in self.ml_type:
            export_graphviz(self._best_estimator,
                            out_file=output_file_name+'.dot',
                            feature_names = self.stacks_2_eqns(self._best_inds)
                            if self._best_inds else None,
                            class_names=['True','False'],
                            filled=False,impurity = True,rotate=True)