Added precommit hook
This commit is contained in:
parent
f8a6271f9a
commit
ea89cf6dde
4
.github/workflows/format.yml
vendored
4
.github/workflows/format.yml
vendored
@ -1,4 +1,4 @@
|
||||
name: Prettier
|
||||
name: Lint and format
|
||||
|
||||
on: push
|
||||
|
||||
@ -27,7 +27,7 @@ jobs:
|
||||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
||||
|
||||
- name: Format with black
|
||||
run: black --check .
|
||||
run: black .
|
||||
|
||||
- name: Commit changes
|
||||
uses: stefanzweifel/git-auto-commit-action@v4.1.2
|
||||
|
@ -1,7 +1,7 @@
|
||||
from tempfile import SpooledTemporaryFile
|
||||
import xml.etree.ElementTree as ET
|
||||
from xml.etree.ElementTree import Element
|
||||
from typing import Optional, Union
|
||||
from typing import Optional
|
||||
from fastapi import HTTPException
|
||||
|
||||
from .utils import Document_Tokens, strip_whitespace
|
||||
@ -71,7 +71,7 @@ def fb22tokens(file: SpooledTemporaryFile) -> Document_Tokens:
|
||||
metadata["title"] = book_info.find("./book-title", namespaces).text
|
||||
metadata["author"] = get_author(book_info.find("./author", namespaces))
|
||||
metadata["cover"] = get_cover(book_info.find("./coverpage", namespaces))
|
||||
if not "cover" in metadata.keys():
|
||||
if "cover" not in metadata.keys():
|
||||
metadata.pop("cover")
|
||||
|
||||
if len(metadata.keys()):
|
||||
@ -108,7 +108,7 @@ def get_author(author: Element) -> str:
|
||||
"last-name",
|
||||
):
|
||||
el = author.find("./" + tag_name, namespaces)
|
||||
if not el is None:
|
||||
if el is not None:
|
||||
res.append(el.text)
|
||||
if len(res) == 0:
|
||||
res = author.find("./nickname", namespaces).text
|
||||
|
@ -1,6 +1,4 @@
|
||||
from fastapi import FastAPI, File, UploadFile, HTTPException
|
||||
from fastapi.responses import HTMLResponse
|
||||
from typing import Union
|
||||
|
||||
from .epub import epub2html
|
||||
from .fb2 import fb22html
|
||||
|
@ -1,13 +1,23 @@
|
||||
aiofiles==0.7.0
|
||||
appdirs==1.4.4
|
||||
asgiref==3.4.0
|
||||
black==21.6b0
|
||||
click==8.0.1
|
||||
EbookLib==0.17.1
|
||||
fastapi==0.65.2
|
||||
flake8==3.9.2
|
||||
h11==0.12.0
|
||||
lxml==4.6.3
|
||||
mccabe==0.6.1
|
||||
mypy-extensions==0.4.3
|
||||
pathspec==0.8.1
|
||||
pycodestyle==2.7.0
|
||||
pydantic==1.8.2
|
||||
pyflakes==2.3.1
|
||||
python-multipart==0.0.5
|
||||
regex==2021.7.1
|
||||
six==1.16.0
|
||||
starlette==0.14.2
|
||||
toml==0.10.2
|
||||
typing-extensions==3.10.0.0
|
||||
uvicorn==0.14.0
|
||||
|
Loading…
x
Reference in New Issue
Block a user