Removed circular import
This commit is contained in:
1 parent
a6befcf99b
commit
ee21a77a69
3 files changed
+87
-34
No files matched your search
+1
-11
@@ -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."""
|
||||
|
||||
Reference in new issue
Block a user