refactor: rename variables
This commit is contained in:
parent
040e756f21
commit
a14d6441a4
@ -41,7 +41,7 @@ def parser(subparsers, conf):
|
||||
return parser
|
||||
|
||||
|
||||
def many_from_path(ui, bibpath, excluded_bibtex_fields=[], ignore=False):
|
||||
def many_from_path(ui, bibpath, bibtex_field_excludes=[], ignore=False):
|
||||
"""Extract list of papers found in bibliographic files in path.
|
||||
|
||||
The behavior is to:
|
||||
@ -65,7 +65,7 @@ def many_from_path(ui, bibpath, excluded_bibtex_fields=[], ignore=False):
|
||||
try:
|
||||
bibentry = coder.decode_bibdata(read_text_file(filepath))
|
||||
# exclude bibtex fields if specified
|
||||
remove_bibtex_fields(bibentry, excluded_bibtex_fields)
|
||||
remove_bibtex_fields(bibentry, bibtex_field_excludes)
|
||||
biblist.append(bibentry)
|
||||
except coder.BibDecodingError:
|
||||
error = "Could not parse bibtex at {}.".format(filepath)
|
||||
@ -105,7 +105,7 @@ def command(conf, args):
|
||||
rp = repo.Repository(conf)
|
||||
# Extract papers from bib
|
||||
papers = many_from_path(ui, bibpath,
|
||||
excluded_bibtex_fields=conf['main']['bibtex_field_excludes'],
|
||||
bibtex_field_excludes=conf['main']['bibtex_field_excludes'],
|
||||
ignore=args.ignore_malformed)
|
||||
keys = args.keys or papers.keys()
|
||||
for k in keys:
|
||||
|
@ -88,8 +88,8 @@ def standardize_doi(doi):
|
||||
|
||||
return new_doi
|
||||
|
||||
def remove_bibtex_fields(bibentry, excluded_bibtex_fields=[]):
|
||||
def remove_bibtex_fields(bibentry, fields):
|
||||
for item in bibentry.values():
|
||||
for field in excluded_bibtex_fields:
|
||||
for field in fields:
|
||||
if field in item:
|
||||
del item[field]
|
||||
|
Loading…
x
Reference in New Issue
Block a user