How to use the duecredit.io.TextOutput function in duecredit

To help you get started, we’ve selected a few duecredit examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github duecredit / duecredit / duecredit / collector.py View on Github external
def _get_output_handler(type_, collector, fn=None):
        # just a little factory
        if type_ in ("stdout", "stderr"):
            return TextOutput(getattr(sys, type_), collector)
        elif type_ == "pickle":
            return PickleOutput(collector, fn=fn)
        else:
            raise NotImplementedError()
github duecredit / duecredit / duecredit / io.py View on Github external
def __init__(self, fd, collector, style=None):
        super(TextOutput, self).__init__(fd, collector)
        self.style = style
        if 'DUECREDIT_STYLE' in os.environ.keys():
            self.style = os.environ['DUECREDIT_STYLE']
        else:
            self.style = 'harvard1'
github duecredit / duecredit / duecredit / cmdline / cmd_summary.py View on Github external
def run(args):
    from ..io import PickleOutput
    if not os.path.exists(args.filename):
        lgr.debug("File {0} doesn't exist.  No summary available".format(
            args.filename))
        return 1

    due = PickleOutput.load(args.filename)
    #CollectorSummary(due).dump()

    if args.format == "text":
        out = TextOutput(sys.stdout, due, args.style)
    elif args.format == "bibtex":
        out = BibTeXOutput(sys.stdout, due)
    else:
        raise ValueError("unknown to treat %s" % args.format)
    out.dump()