Skip to content

Commit 06013ca

Browse files
committed
feat(papis-html): fix flake8 errors
1 parent 0b3600e commit 06013ca

File tree

1 file changed

+22
-28
lines changed

1 file changed

+22
-28
lines changed

papis-html/papis_html/__init__.py

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,50 @@
11
#! /usr/bin/env python3
2-
# -*- coding: utf-8 -*-
2+
3+
import os
4+
import shutil
35

46
import click
7+
58
import papis.cli
69
import papis.api
10+
import papis.logging
711
from papis.commands.export import run as export
8-
import os
9-
import shutil
10-
import logging
1112

12-
logger = logging.getLogger('papis-html')
13-
logging.basicConfig(level=logging.INFO)
13+
logger = papis.logging.get_logger("papis_html")
1414

1515
template_folder = os.path.join(
1616
os.path.dirname(os.path.abspath(__file__)),
17-
'data'
17+
"data"
1818
)
1919

20+
2021
@click.command()
2122
@papis.cli.query_option()
22-
@click.help_option('-h', '--help')
23+
@click.help_option("-h", "--help")
2324
@click.option(
24-
'-o', '--out',
25-
help='Output directory',
26-
default='bibliography'
25+
"-o", "--out",
26+
help="Output directory",
27+
default="html"
2728
)
28-
def main(query, out):
29+
def main(query: str, out: str) -> None:
2930
"""
30-
Create a simple searchable offline html site with your references
31+
Create a simple searchable offline HTML site with your documents
3132
"""
3233

33-
logger.info('Searching in database..'.format(out))
34+
logger.info("Searching in database.")
3435
docs = papis.api.get_documents_in_lib(
3536
library=papis.api.get_lib_name(),
3637
search=query
3738
)
3839

39-
logger.info('Saving in folder {}'.format(out))
40-
bibtex_text = export(docs, to_format='bibtex')
40+
bibtex_text = export(docs, to_format="bibtex")
4141

42-
logger.info('template files in {}'.format(template_folder))
43-
shutil.copytree(
44-
template_folder,
45-
out
46-
)
42+
shutil.copytree(template_folder, out)
43+
logger.info("Template files copied from '%s'", template_folder)
44+
logger.info("Saving in folder '%s'.", out)
4745

48-
bibtex_outfile = os.path.join(out, 'library.bib')
49-
logger.info('Creating bib file in {}'.format(bibtex_outfile))
50-
with open(bibtex_outfile, 'w+') as fd:
46+
bibtex_outfile = os.path.join(out, "papis-html-library.bib")
47+
with open(bibtex_outfile, "w+") as fd:
5148
fd.write(bibtex_text)
5249

53-
logger.info('Done!')
54-
55-
if __name__ == "__main__":
56-
main()
50+
logger.info("Created BibTex file: '%s'.", bibtex_outfile)

0 commit comments

Comments
 (0)