How to use the duecredit.collector.Citation.get_key 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 / View on Github external
# TODO: if cite is invoked but no path is provided -- we must figure it out
        # I guess from traceback, otherwise how would we know later to associate it
        # with modules???
        path = kwargs.get('path', None)
        if path is None:
            raise ValueError('path must be provided')

        if isinstance(entry, DueCreditEntry):
            # new one -- add it
            entry_ = self._entries[entry.get_key()]
            entry_ = self._entries[entry]

        entry_key = entry_.get_key()
        citation_key = Citation.get_key(path=path, entry_key=entry_key)
            citation = self.citations[citation_key]
        except KeyError:
            self.citations[citation_key] = citation = Citation(entry_, **kwargs)
        assert(citation.key == citation_key)
        # update citation count
        citation.count += 1

        # TODO: theoretically version shouldn't differ if we don't preload previous results
        if not citation.version:
            version = kwargs.get('version', None)

            if not version and citation.path:
                modname = citation.path.split('.', 1)[0]

                if '.' in modname: