mirror of https://github.com/dethos/inlinehashes
add check jobs: black and mypy
This commit is contained in:
parent
729da4afed
commit
900e3c9572
|
@ -0,0 +1,47 @@
|
||||||
|
name: Check source
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
format:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Set up Python 3.9
|
||||||
|
uses: actions/setup-python@v3
|
||||||
|
with:
|
||||||
|
python-version: "3.9"
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip install poetry
|
||||||
|
poetry install
|
||||||
|
- name: Check format with black
|
||||||
|
run: |
|
||||||
|
poetry run black --check .
|
||||||
|
|
||||||
|
typing:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Set up Python 3.9
|
||||||
|
uses: actions/setup-python@v3
|
||||||
|
with:
|
||||||
|
python-version: "3.9"
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip install poetry
|
||||||
|
poetry install
|
||||||
|
- name: Check typing with mypy
|
||||||
|
run: |
|
||||||
|
poetry run mypy inlinehashes/
|
|
@ -13,7 +13,7 @@ permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
|
@ -11,7 +11,7 @@ from itertools import chain
|
||||||
import hashlib
|
import hashlib
|
||||||
import base64
|
import base64
|
||||||
|
|
||||||
from bs4 import BeautifulSoup, Tag
|
from bs4 import BeautifulSoup, Tag # type: ignore
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True)
|
||||||
|
@ -199,7 +199,7 @@ def parse(content: str, target: str = "all") -> List[Inline]:
|
||||||
if target == "all":
|
if target == "all":
|
||||||
search_queries = chain(*_VALID_TARGETS.values())
|
search_queries = chain(*_VALID_TARGETS.values())
|
||||||
elif target in _VALID_TARGETS.keys():
|
elif target in _VALID_TARGETS.keys():
|
||||||
search_queries = _VALID_TARGETS[target]
|
search_queries = chain(_VALID_TARGETS[target])
|
||||||
else:
|
else:
|
||||||
raise ValueError("Invalid Target")
|
raise ValueError("Invalid Target")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue