Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# 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
self.add(entry)
entry_ = self._entries[entry.get_key()]
else:
entry_ = self._entries[entry]
entry_key = entry_.get_key()
citation_key = Citation.get_key(path=path, entry_key=entry_key)
try:
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: