Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Koushikphy committed Jun 7, 2023
1 parent 4e4030d commit b6899ad
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
17 changes: 11 additions & 6 deletions kbib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ def listDuplicates(files):
bib_db = bibtexparser.loads('\n'.join(open(f).read() for f in bibFiles))
entries = bib_db.entries

dat = defaultdict(list)
dat = defaultdict(set)
# duplication will be decided based only on these keys
keysToMatch = ['year','volume','pages']

Expand All @@ -347,14 +347,19 @@ def listDuplicates(files):
idd = en.get('ID')
if checkTex:
if idd in cites: # only references that are cited
dat[it].append(en.get('ID'))
dat[it].add(en.get('ID'))
else:
dat[it].append(en.get('ID'))
dat[it].add(en.get('ID'))


for k,v in dat.items():
if len(v)>1:
print(v)
dupList = [list(v) for _,v in dat.items() if len(v)>1 ]
if len(dupList)==0:
print('No duplicate reference found.')
return
print("The following bib entries may be duplicate. Please check:\n")
for i,el in enumerate(dupList,start=1):
print(f"{i}. {', '.join(el)}")



# progress = Progress()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
txt = f.read()

setup(name='kbib',
version='0.1.8',
version='0.1.9',
description='A command line tool to get bibtex information from DOIs and PDFs',
long_description=txt,
long_description_content_type='text/markdown',
Expand Down

0 comments on commit b6899ad

Please sign in to comment.