How to use the duecredit.config.DUECREDIT_FILE 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 __init__(self, collector, outputs="stdout,pickle", fn=DUECREDIT_FILE):
        self._due = collector
        self.fn = fn
        # for now decide on output "format" right here
        self._outputs = [
            self._get_output_handler(
                type_.lower().strip(), collector, fn=fn)
            for type_ in os.environ.get('DUECREDIT_OUTPUTS', outputs).split(',')
            if type_
        ]
github duecredit / duecredit / duecredit / cmdline / cmd_summary.py View on Github external
def setup_parser(parser):

    parser.add_argument(
        "-f", "--filename", default=DUECREDIT_FILE,
        help="Filename containing collected citations. Default: %(default)s")

    parser.add_argument(
        "--style", choices=("apa", "harvard1"), default="harvard1",
        help="Style to be used for listing citations")

    parser.add_argument(
        "--format", choices=("text", "bibtex"), default="text",
        help="Way to present the summary")
github duecredit / duecredit / duecredit / dueswitch.py View on Github external
def _get_active_due():
    from .config import CACHE_DIR, DUECREDIT_FILE
    from duecredit.collector import CollectorSummary, DueCreditCollector
    from .io import load_due

    # TODO:  this needs to move to atexit handling, that we load previous
    # one and them merge with new ones.  Informative bits could be -- how
    # many new citations we got
    if os.path.exists(DUECREDIT_FILE):
        try:
            due_ = load_due(DUECREDIT_FILE)
        except Exception as e:
            lgr.warning("Failed to load previously collected %s. "
                        "DueCredit will not be active for this session."
                        % DUECREDIT_FILE)
            return _get_inactive_due()
    else:
        due_ = DueCreditCollector()

    return due_
github duecredit / duecredit / duecredit / dueswitch.py View on Github external
def _get_active_due():
    from .config import CACHE_DIR, DUECREDIT_FILE
    from duecredit.collector import CollectorSummary, DueCreditCollector
    from .io import load_due

    # TODO:  this needs to move to atexit handling, that we load previous
    # one and them merge with new ones.  Informative bits could be -- how
    # many new citations we got
    if os.path.exists(DUECREDIT_FILE):
        try:
            due_ = load_due(DUECREDIT_FILE)
        except Exception as e:
            lgr.warning("Failed to load previously collected %s. "
                        "DueCredit will not be active for this session."
                        % DUECREDIT_FILE)
            return _get_inactive_due()
    else:
        due_ = DueCreditCollector()

    return due_
github duecredit / duecredit / duecredit / io.py View on Github external
    def __init__(self, collector, fn=DUECREDIT_FILE):
        self.collector = collector
        self.fn = fn
github duecredit / duecredit / duecredit / io.py View on Github external
    def load(cls, filename=DUECREDIT_FILE):
        with open(filename, 'rb') as f:
            return pickle.load(f)