Removed circular import

This commit is contained in:
florian committed 2026-10-31 15:47:38 +01:00
1 parent a6befcf99b
commit ee21a77a69
3 files changed
+87 -34

No files matched your search

+1 -11
View File
@@ -1,12 +1,11 @@
from dataclasses import dataclass
from enum import StrEnum
from typing import Self, assert_never
from typing import Self
from urllib.parse import urlsplit
from pydantic import BaseModel, Field, field_validator, model_validator
from feed_errors import InvalidFeedUrlError, UnsupportedPathError, WrongHostError
from feed_handler import grab_gitea_release_information, grab_royal_road_chapter_information
REPO_CHARS = frozenset("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_.-")
@@ -21,15 +20,6 @@ class FeedEntryType(StrEnum):
ROYALROAD = "royalroad"
GITEA = "gitea"
def fetch_latest(feed_type: FeedEntryType, url: str) -> FeedUpdate:
match feed_type:
case FeedEntryType.ROYALROAD:
return grab_royal_road_chapter_information(url)
case FeedEntryType.GITEA:
return grab_gitea_release_information(url)
case _:
assert_never(feed_type)
def _path_segments(raw: str, feed_type: FeedEntryType, host: str) -> list[str]:
"""Check scheme and host, then return the non-empty path segments."""