Compare commits
3 commits
22d762f86e
...
682b7577de
| Author | SHA1 | Date | |
|---|---|---|---|
| 682b7577de | |||
| ddaa75f44b | |||
| 9c80281220 |
4 changed files with 13 additions and 15 deletions
|
|
@ -3,7 +3,7 @@ steps:
|
||||||
image: nikolaik/python-nodejs
|
image: nikolaik/python-nodejs
|
||||||
commands:
|
commands:
|
||||||
- npm install --global pyright
|
- npm install --global pyright
|
||||||
- poetry install
|
- uv sync
|
||||||
- python --version && poetry --version && pyright --version
|
- python --version && uv version && pyright --version
|
||||||
- echo "------------- running pyright typecheck -------------"
|
- echo "------------- running pyright typecheck -------------"
|
||||||
- poetry run pyright
|
- uv run pyright
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@ when:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
pytest:
|
pytest:
|
||||||
image: ghcr.io/withlogicco/poetry:1.5.1
|
image: nikolaik/python-nodejs
|
||||||
commands:
|
commands:
|
||||||
- poetry install
|
- uv sync
|
||||||
- python --version && poetry --version
|
- python --version && uv version
|
||||||
- echo "------------- running pytest -------------"
|
- echo "------------- running pytest -------------"
|
||||||
- poetry run pytest
|
- uv run pytest
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,7 @@ import chevron
|
||||||
import papis.config
|
import papis.config
|
||||||
from papis.document import Document
|
from papis.document import Document
|
||||||
|
|
||||||
TEXT_SIMILARITY_MINIMUM = 0.75
|
COLOR_SIMILARITY_MINIMUM_FALLBACK = 0.833
|
||||||
COLOR_SIMILARITY_MINIMUM = 0.833
|
|
||||||
|
|
||||||
COLORS: dict[str, tuple[float, float, float]] = {
|
COLORS: dict[str, tuple[float, float, float]] = {
|
||||||
"blue": (0, 0, 1),
|
"blue": (0, 0, 1),
|
||||||
|
|
@ -38,14 +37,17 @@ class Annotation:
|
||||||
page: int = 0,
|
page: int = 0,
|
||||||
tag: str = "",
|
tag: str = "",
|
||||||
type: str = "Highlight",
|
type: str = "Highlight",
|
||||||
minimum_similarity_color: float = 1.0,
|
minimum_similarity_color: float | None = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
self.minimum_similarity_color = minimum_similarity_color
|
|
||||||
self.file = file
|
self.file = file
|
||||||
self._color = color
|
self._color = color
|
||||||
self.content = content
|
self.content = content
|
||||||
self.note = note
|
self.note = note
|
||||||
self.page = page
|
self.page = page
|
||||||
|
self.minimum_similarity_color = minimum_similarity_color or (
|
||||||
|
papis.config.getfloat("minimum_similarity_color", "plugins.extract")
|
||||||
|
or COLOR_SIMILARITY_MINIMUM_FALLBACK
|
||||||
|
)
|
||||||
self.tag = tag or self._tag_from_colorname(self.colorname or "")
|
self.tag = tag or self._tag_from_colorname(self.colorname or "")
|
||||||
self.type = type
|
self.type = type
|
||||||
|
|
||||||
|
|
@ -85,9 +87,6 @@ class Annotation:
|
||||||
"""
|
"""
|
||||||
annot_colors = self.color or (0.0, 0.0, 0.0)
|
annot_colors = self.color or (0.0, 0.0, 0.0)
|
||||||
nearest = None
|
nearest = None
|
||||||
minimum_similarity = (
|
|
||||||
papis.config.getfloat("minimum_similarity_color", "plugins.extract") or 1.0
|
|
||||||
)
|
|
||||||
minimum_similarity = self.minimum_similarity_color
|
minimum_similarity = self.minimum_similarity_color
|
||||||
for name, values in COLORS.items():
|
for name, values in COLORS.items():
|
||||||
similarity_ratio = self._color_similarity_ratio(values, annot_colors)
|
similarity_ratio = self._color_similarity_ratio(values, annot_colors)
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,6 @@ class PdfExtractor:
|
||||||
for (
|
for (
|
||||||
page
|
page
|
||||||
) in doc: # pyright: ignore [reportUnknownVariableType] - missing stub
|
) in doc: # pyright: ignore [reportUnknownVariableType] - missing stub
|
||||||
page = cast(mu.Page, page)
|
|
||||||
annot: mu.Annot
|
annot: mu.Annot
|
||||||
for annot in page.annots():
|
for annot in page.annots():
|
||||||
quote, note = self._retrieve_annotation_content(page, annot)
|
quote, note = self._retrieve_annotation_content(page, annot)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue