Skip to content

Commit

Permalink
Code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
volkm committed May 25, 2023
1 parent 4d921d7 commit d6a7307
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 13 deletions.
1 change: 1 addition & 0 deletions bibtex_dblp/database.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging

import pybtex.database

import bibtex_dblp.dblp_api as dblp_api
Expand Down
10 changes: 7 additions & 3 deletions bin/convert_dblp.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@


def main():
parser = argparse.ArgumentParser(description='Convert DBLP entries to specific format (condensed, standard, crossref).')
parser = argparse.ArgumentParser(
description='Convert DBLP entries to specific format (condensed, standard, crossref).')

parser.add_argument('infile', help='Input bibtex file', type=str)
parser.add_argument('--out', '-o', help='Output bibtex file. If no output file is given, the input file will be overwritten.', type=str, default=None)
parser.add_argument('--format', '-f', help='DBLP format type to convert into', type=BibFormat, choices=list(BibFormat), default=BibFormat.condensed)
parser.add_argument('--out', '-o',
help='Output bibtex file. If no output file is given, the input file will be overwritten.',
type=str, default=None)
parser.add_argument('--format', '-f', help='DBLP format type to convert into', type=BibFormat,
choices=list(BibFormat), default=BibFormat.condensed)

parser.add_argument('--verbose', '-v', help='print more output', action="store_true")
args = parser.parse_args()
Expand Down
25 changes: 17 additions & 8 deletions bin/import_dblp.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,30 @@

import argparse
import logging

import pyperclip

import bibtex_dblp.config
import bibtex_dblp.database
import bibtex_dblp.io
import bibtex_dblp.dblp_api
import bibtex_dblp.io
from bibtex_dblp.dblp_api import BibFormat


def main():
parser = argparse.ArgumentParser(description='Import entry from DBLP according to given search input from cli.')

parser.add_argument('--query', '-q', help='The query to search for the publication. If none is given the query is obtained from CLI input.', type=str, default=None)
parser.add_argument('--bib', '-b', help='Bibtex file where the imported entry will be appended. If no bibtex file is given, the bibtex is printed to the CLI.', type=str,
parser.add_argument('--query', '-q',
help='The query to search for the publication. If none is given the query is obtained from CLI input.',
type=str, default=None)
parser.add_argument('--bib', '-b',
help='Bibtex file where the imported entry will be appended. If no bibtex file is given, the bibtex is printed to the CLI.',
type=str,
default=None)
parser.add_argument('--format', '-f', help='DBLP format type to convert into.', type=BibFormat, choices=list(BibFormat), default=BibFormat.condensed)
parser.add_argument('--max-results', help="Maximal number of search results to display.", type=int, default=bibtex_dblp.config.MAX_SEARCH_RESULTS)
parser.add_argument('--format', '-f', help='DBLP format type to convert into.', type=BibFormat,
choices=list(BibFormat), default=BibFormat.condensed)
parser.add_argument('--max-results', help="Maximal number of search results to display.", type=int,
default=bibtex_dblp.config.MAX_SEARCH_RESULTS)

parser.add_argument('--verbose', '-v', help='print more output', action="store_true")
args = parser.parse_args()
Expand All @@ -47,9 +54,10 @@ def main():
print("The bibliography already contains the following matches:")
for i in range(len(bib_result)):
print("({})\t{}".format(i + 1, bibtex_dblp.database.print_entry(bib_result[i][0])))
select = bibtex_dblp.io.get_user_number("Select the intended publication (0 to search online): ", 0, len(bib_result))
select = bibtex_dblp.io.get_user_number("Select the intended publication (0 to search online): ", 0,
len(bib_result))
if select > 0:
selected_entry = bib_result[select-1][0]
selected_entry = bib_result[select - 1][0]
logging.info("Selected bibtex entry:\n")
print(bibtex_dblp.database.print_entry(selected_entry))
logging.info("Use '{}' to cite it.".format(selected_entry.key))
Expand All @@ -68,7 +76,8 @@ def main():
print("({})\t{}".format(i + 1, result.publication))

# Let user select correct publication
select = bibtex_dblp.io.get_user_number("Select the intended publication (0 to abort): ", 0, search_results.total_matches)
select = bibtex_dblp.io.get_user_number("Select the intended publication (0 to abort): ", 0,
search_results.total_matches)
if select == 0:
print("Cancelled.")
exit(1)
Expand Down
5 changes: 3 additions & 2 deletions bin/update_from_dblp.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@

import argparse
import logging
import requests
from copy import deepcopy

import requests

import bibtex_dblp.config
import bibtex_dblp.database
import bibtex_dblp.io
import bibtex_dblp.dblp_api
import bibtex_dblp.io
from bibtex_dblp.dblp_api import BibFormat


Expand Down

0 comments on commit d6a7307

Please sign in to comment.