Print all parses and their violations in a structured format.
195978
def report(self,meter=None,include_bounded=False,reverse=True):
		

		ReportStr = ''
		if not meter:
			from Meter import Meter
			meter=Meter.genDefault()
		if (hasattr(self,'allParses')):
			self.om(unicode(self))
			allparses=self.allParses(meter=meter,include_bounded=include_bounded)
			numallparses=len(allparses)
			#allparses = reversed(allparses) if reverse else allparses
			for pi,parseList in enumerate(allparses):
				line=self.iparse2line(pi).txt
				#parseList.sort(key = lambda P: P.score())
				hdr="\n\n"+'='*30+'\n[line #'+str(pi+1)+' of '+str(numallparses)+']: '+line+'\n\n\t'
				ftr='='*30+'\n'
				ReportStr+=self.om(hdr+meter.printParses(parseList,reverse=reverse).replace('\n','\n\t')[:-1]+ftr,conscious=False)
		else:
			for child in self.children:
				if type(child)==type([]): continue
				ReportStr+=child.report()

		return ReportStr
168247
def showSectionsHeaders(peInstance):
    
    
    print "[+] Sections information:\n"
    print "--> NumberOfSections: %d\n" % peInstance.ntHeaders.fileHeader.numberOfSections.value
    for section in peInstance.sectionHeaders:
        fields = section.getFields()
        for field in fields:
            if isinstance(fields[field],  datatypes.String):
                fmt = "%s = %s"
            else:
                fmt = "%s = 0x%08x"
            print fmt % (field,  fields[field].value)
        print "\n"
556708
def report_parsing_problems(parsing_out):
    """"""
    _, empty, faulty = parsing_out
    if CONFIG_FILE in empty or CONFIG_FILE in faulty:
        print('Unable to read global config file', CONFIG_FILE,
              file=sys.stderr)
        print('Please run stagpy config --create',
              sep='\n', end='\n\n', file=sys.stderr)
    if CONFIG_LOCAL in faulty:
        print('Unable to read local config file', CONFIG_LOCAL,
              file=sys.stderr)
        print('Please run stagpy config --create_local',
              sep='\n', end='\n\n', file=sys.stderr)
467435
def print_filters():
    """"""
    for filter_name in VALID_FILTERS:
        filter_func = getattr(filters, 'filter_{0}'.format(filter_name))
        description = filter_func.__doc__
        if description:
            description = re.sub(r'\n\s+', ' ', description)
            description.strip()

        print('{0}: {1}\n'.format(filter_name, description))
739969
def output_lines(self):
        
        if self.exception:
            return [self.EXCEPTION_HEADERS[0], '  ...'] + self.exception_detail
        else:
            return self.output
517094
def print_results(self, results, min_ratio=None, indent=False, pval=0.05, prt=sys.stdout):
        """"""
        results_adj = self.get_adj_records(results, min_ratio, pval)
        self.print_results_adj(results_adj, indent, prt)
434095
function parse(contents, retained, parser) {
    var errors = [], data = [], lines = 0;

    // optional parser
    if (!parser) parser = JSON;

    // process each line of the file
    contents.toString().split('\n').forEach(function(line) {
        if (!line) return;
        lines++;
        try {
            data.push(parser.parse(line));
        } catch (e) {
            e.line = line;
            errors.push(e);
        }
    });

    // if no errors/data, don't return an empty array
    var ret = {};
    if (errors.length) ret.errors = errors;
    if (data.length) ret.data = data;

    // if every line failed, probably not line-delimited
    if (errors.length == lines) ret.errors = retained;

    return ret;
}
184472
def handle_raw_output(ctx, data):
    """"""
    if ctx.obj['format'] == 'json':
        print(json_dump(data))
        exit(0)
    if ctx.obj['format'] == 'yaml':
        print(yaml_dump(data), end='')
        exit(0)
432133
def pretty_print(self, warnings=False):
        
        msg = []
        if (warnings) and (len(self.warnings) > 0):
            msg.append(u"Warnings:")
            for warning in self.warnings:
                msg.append(u"  %s" % warning)
        if len(self.errors) > 0:
            msg.append(u"Errors:")
            for error in self.errors:
                msg.append(u"  %s" % error)
        return u"\n".join(msg)
1212437
def _format_args():
        """"""
        if request and request.args.get('prettyprint'):
            return dict(
                indent=2,
                separators=(', ', ': '),
            )
        else:
            return dict(
                indent=None,
                separators=(',', ':'),
            )
23591
def print_results_adj(results, indent=False, prt=sys.stdout):
        """"""
        # Print column headers if there are results to be printed
        if results:
            prt.write("{R}\n".format(R="\t".join(GOEnrichmentStudy.get_prtflds_default(results))))
        # Print the GOEA results
        for rec in results:
            prt.write("{R}\n".format(R=rec.__str__(indent=indent)))
1066652
def print(self, output_file=sys.stdout, log=False):
        """"""

        for soln in iter(self):
            print(soln, file=output_file)
            print(SOLN_SEP, file=output_file)

        if self.status == 0:
            print(SEARCH_COMPLETE, file=output_file)

        if (self.status == 1 and self._n_solns == 0) or self.status >= 2:
            print({
                Status.INCOMPLETE : ERROR,
                Status.UNKNOWN: UNKNOWN,
                Status.UNSATISFIABLE: UNSATISFIABLE,
                Status.UNBOUNDED: UNBOUNDED,
                Status.UNSATorUNBOUNDED: UNSATorUNBOUNDED,
                Status.ERROR: ERROR
            }[self.status], file=output_file)

            if self.stderr:
                print(self.stderr.strip(), file=sys.stderr)

        elif log:
            print(str(self.log), file=output_file)
376489
def print_contents(self):
        
        print "\t\t\t".join(self.columns)
        temp_list = []
        for i in self.columns:
            temp_list.append(self.get_column(i))
        for i in zip(*(temp_list)):
            print "\t\t\t".join(map(str, i))
883828
def print_statements(self):
        """"""
        for i, stmt in enumerate(self.statements):
            print("%s: %s" % (i, stmt))
756888
def print_violations(self, violations):
        
        for v in violations:
            line_nr = v.line_nr if v.line_nr else "-"
            self.display.e(u"{0}: {1}".format(line_nr, v.rule_id), exact=True)
            self.display.ee(u"{0}: {1} {2}".format(line_nr, v.rule_id, v.message), exact=True)
            if v.content:
                self.display.eee(u"{0}: {1} {2}: \"{3}\"".format(line_nr, v.rule_id, v.message, v.content),
                                 exact=True)
            else:
                self.display.eee(u"{0}: {1} {2}".format(line_nr, v.rule_id, v.message), exact=True)
439424
def _pprint(dic):
    """"""
    for key, value in dic.items():
        print("        {0}: {1}".format(key, value))
166427
def build_tree_parser(patterns):
    
    def output():
        for pattern in patterns:
            yield (pattern.build_full_tree(), pattern.regex)
    return list(output())