Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v0.9.27 (2025-12-10)

### Refactor

- **link**: add URL validation for link status and result

## v0.9.26 (2025-12-09)

### Refactor
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Strain Authentication and Identification Methods - saim

[![release: 0.9.26](https://img.shields.io/badge/rel-0.9.26-blue.svg?style=flat-square)](https://github.com/LeibnizDSMZ/saim.git)
[![release: 0.9.27](https://img.shields.io/badge/rel-0.9.27-blue.svg?style=flat-square)](https://github.com/LeibnizDSMZ/saim.git)
[![MIT LICENSE](https://img.shields.io/badge/License-MIT-brightgreen.svg?style=flat-square)](https://choosealicense.com/licenses/mit/)
[![Documentation Status](https://img.shields.io/badge/docs-GitHub-blue.svg?style=flat-square)](https://LeibnizDSMZ.github.io/saim/)

Expand Down
6 changes: 3 additions & 3 deletions configs/dev/requirements.dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,9 @@ typing-extensions==4.15.0 \
--hash=sha256:0cea48d173cc12fa28ecabc3b837ea3cf6f38c6d1136f85cbaaf598984861466 \
--hash=sha256:f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548
# via mypy
urllib3==2.6.0 \
--hash=sha256:c90f7a39f716c572c4e3e58509581ebd83f9b59cced005b7db7ad2d22b0db99f \
--hash=sha256:cb9bcef5a4b345d5da5d145dc3e30834f58e8018828cbc724d30b4cb7d4d49f1
urllib3==2.6.1 \
--hash=sha256:5379eb6e1aba4088bae84f8242960017ec8d8e3decf30480b3a1abdaa9671a3f \
--hash=sha256:e67d06fe947c36a7ca39f4994b08d73922d40e6cca949907be05efa6fd75110b
# via types-requests
vulture==2.14 \
--hash=sha256:cb8277902a1138deeab796ec5bef7076a6e0248ca3607a3f3dee0b6d9e9b8415 \
Expand Down
6 changes: 3 additions & 3 deletions configs/dev/requirements.docs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,9 @@ six==1.17.0 \
--hash=sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274 \
--hash=sha256:ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81
# via python-dateutil
urllib3==2.6.0 \
--hash=sha256:c90f7a39f716c572c4e3e58509581ebd83f9b59cced005b7db7ad2d22b0db99f \
--hash=sha256:cb9bcef5a4b345d5da5d145dc3e30834f58e8018828cbc724d30b4cb7d4d49f1
urllib3==2.6.1 \
--hash=sha256:5379eb6e1aba4088bae84f8242960017ec8d8e3decf30480b3a1abdaa9671a3f \
--hash=sha256:e67d06fe947c36a7ca39f4994b08d73922d40e6cca949907be05efa6fd75110b
# via requests
watchdog==6.0.0 \
--hash=sha256:07df1fdd701c5d4c8e55ef6cf55b8f0120fe1aef7ef39a1c6fc6bc2e606d517a \
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "saim"
version = "0.9.26"
version = "0.9.27"
description = """A library for identifying strains."""
readme = "README.md"
authors = [
Expand All @@ -23,7 +23,7 @@ dependencies = [
"python-keycloak ==5.8.1",
"requests ==2.32.5",
"requests-cache ==1.2.1",
"cafi @ git+https://github.com/LeibnizDSMZ/cafi.git@v0.9.13",
"cafi @ git+https://github.com/LeibnizDSMZ/cafi.git@v0.9.14",
]

[project.scripts]
Expand Down
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ attrs==25.4.0 \
# via
# cattrs
# requests-cache
cafi @ git+https://github.com/LeibnizDSMZ/cafi.git@72a82fe8adce0b3ac4e9ced363550541692cf500
cafi @ git+https://github.com/LeibnizDSMZ/cafi.git@e90398f246bba7539af28bfaaeca0dcbd54c206c
# via saim
cattrs==25.3.0 \
--hash=sha256:1ac88d9e5eda10436c4517e390a4142d88638fe682c436c93db7ce4a277b884a \
Expand Down Expand Up @@ -335,9 +335,9 @@ url-normalize==2.2.1 \
--hash=sha256:3deb687587dc91f7b25c9ae5162ffc0f057ae85d22b1e15cf5698311247f567b \
--hash=sha256:74a540a3b6eba1d95bdc610c24f2c0141639f3ba903501e61a52a8730247ff37
# via requests-cache
urllib3==2.6.0 \
--hash=sha256:c90f7a39f716c572c4e3e58509581ebd83f9b59cced005b7db7ad2d22b0db99f \
--hash=sha256:cb9bcef5a4b345d5da5d145dc3e30834f58e8018828cbc724d30b4cb7d4d49f1
urllib3==2.6.1 \
--hash=sha256:5379eb6e1aba4088bae84f8242960017ec8d8e3decf30480b3a1abdaa9671a3f \
--hash=sha256:e67d06fe947c36a7ca39f4994b08d73922d40e6cca949907be05efa6fd75110b
# via
# requests
# requests-cache
17 changes: 17 additions & 0 deletions src/saim/culture_link/private/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from typing import Iterator, final

from cafi.container.links import CatalogueLink
from pydantic import HttpUrl, ValidationError
from saim.culture_link.private.constants import (
CAT_DET_EXP_DAYS,
CAT_EXP_DAYS,
Expand Down Expand Up @@ -89,6 +90,15 @@ class LinkStatus:
link_type: str
status: VerificationStatus

def __post_init__(self) -> None:
try:
if self.link != "":
object.__setattr__(self, "link", str(HttpUrl(self.link)))
except ValidationError:
object.__setattr__(self, "link", "")
if self.link == "":
object.__setattr__(self, "status", VerificationStatus.no_url)


@final
@dataclass(frozen=True, slots=True)
Expand All @@ -97,6 +107,13 @@ class LinkResult:
brc_id: int
found_ccno: CCNoDes

def __post_init__(self) -> None:
try:
if self.link != "":
object.__setattr__(self, "link", str(HttpUrl(self.link)))
except ValidationError:
object.__setattr__(self, "link", "")


@final
@dataclass(frozen=True, slots=True)
Expand Down
3 changes: 1 addition & 2 deletions src/saim/culture_link/validate_cafi.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from cafi.library.loader import load_catalogue_db, load_regex_db
from cafi.container.acr_db import AcrDbEntry
from cafi.container.links import LinkLevel
from cafi.container.fun.format import url_to_str
from saim.culture_link.create_links import CcnoLinkGenerator, SearchRequest
from saim.designation.manager import AcronymManager

Expand All @@ -21,7 +20,7 @@ def _create_search_request_homepage(
exclude=(LinkLevel.cat,),
)
for task_id, (acr_id, acr_entry) in enumerate(cc_db.items())
if url_to_str(acr_entry.homepage) != ""
if str(acr_entry.homepage) != ""
]


Expand Down
4 changes: 1 addition & 3 deletions src/saim/shared/data_con/culture.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
from saim.shared.data_ops.clean import detect_empty_dict_keys
from saim.shared.parse.date import check_date_str, date_to_str
from saim.taxon_name.manager import TaxonManager
from cafi.container.fun.format import url_to_str

_REQ_KEYS: Final[tuple[str, ...]] = (
"acronym",
Expand Down Expand Up @@ -131,8 +130,7 @@ class CultureCCNo(BaseModel):
source: CiDSrc
# optional fields - default
url: (
Annotated[HttpUrl, PlainSerializer(lambda val: url_to_str(val), return_type=str)]
| None
Annotated[HttpUrl, PlainSerializer(lambda val: str(val), return_type=str)] | None
) = None
cul_id: Annotated[int, Field(ge=1)] | None = Field(default=None, alias="cultureId")
history: Annotated[str, AfterValidator(clean_text_rm_tags), Field(min_length=2)] = ""
Expand Down
2 changes: 1 addition & 1 deletion src/saim/shared/misc/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@


ENCODING: Final[str] = "utf-8"
VERSION: Final[str] = "v0.9.26"
VERSION: Final[str] = "v0.9.27"
14 changes: 7 additions & 7 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.